![]() |
-keyNOTdown(i)
sorry for being retarded.. i havent been doing any scripting for awhile but oh well!
how would i go about detecting when keys 0-4 were'nt being pushed? im bored and rescripting movement system and i couldnt think of what to do so he just keeps doing the walk ani unstil i press 'a' XP |
Well, there are a few ways to do it.
Probably the easiest way is to have a array for it, then run a loop and check the corrisponding key to see if it's pressed, if not, then set the variable to false or whoever you want to keep track of it. |
NPC Code:?!keydown(#) |
Quote:
|
Rick's got the idea. :)
|
else if (!keydown(0)) set ani idle,;
i had this but it screws up the walk ani X_X |
Quote:
|
Quote:
If you wanted it to be detected when keydown(0) then: if (!keydown(0)) { whatever; } else { setani idle,; } If you wanted it to not be detected when keydown(0) then: if (!keydown(0)) { setani idle,; } And you'd want to make sure with the !keydown that you'd have a timeout or something... I'm not sure if it's the same with keydown considering the fact that I don't use keydown much. |
Quote:
"Arrays wtf only Rick makes sense" |
Isnt there a quick key in here?
I forgot how it goes but it's like NPC Code: I forgot maybe it is wrong, o-well I tried. :p If you don't want it detecting add a key (!) like NPC Code: Or as kai would do: NPC Code: As it's easier to read;P |
I thiiiink the original poster's enquire was about a function that would tell him whether any of the keys 0-3 was pressed, so he could unset his walking gani accordingly... so I suppose the most sensible thing to do is
NPC Code:walking = false; |
Quote:
|
Quote:
keydown2(keycode(t),false) Quote:
oman, Loriel's script is crazygonuts, I never thought to use tokenize like that :megaeek: |
Quote:
|
If you bothered to look at the Snippets section of Graal.net (mainly the Elaborate onwall function Loriel posted) you'd already know to do it that way ;)
|
Quote:
|
I've made 2 or 3 walking systems and hadn't even considered using tokenize, I usually get by with regular arrays. Come to think of it, I don't really remember how I handled setting the animation... ohwell, back to the point, Loriel has got some wack skills in scripting
|
Quote:
|
Re-Scripting the player is a great exercise.
Difficult. But I don't think anybody expects it to be perfect. |
I wish people wouldn't make such wild guesses about how I'd do something.
|
Quote:
|
Quote:
|
Quote:
Anyways, you should come back your highly missed. Eitherway i've got nothing else to say:\ |
Quote:
|
Quote:
|
Quote:
|
Quote:
I'm sure you're right, but they've misinterpreted the document. I wouldn't script it in any of the ways presented thus far. |
Quote:
|
I wasn't dissin' you, I just wanted to make sure people knew what we were talking about.
It's interesting to see that KSI-GS found its way into the Classic tab requirements. I would never have agreed with that decision, and I doubt that the GST are enforcing it (heck, one of the members breaks almost every rule in there). |
Quote:
|
hehe another scripting thread gone awry ;)
|
NPC Code: Use elseifs, they're useful ;) |
Quote:
Think about it, what do you do to run diagonally? You press two arrow keys. |
Eh, Rick? Your keyboard lacks diagonal arrow keys?
|
Quote:
|
He's probably referring to the number pad, eg keys 7, 9, 1 & 3.
|
Laptop...
Oh sure elseifs are useful but not in this case. Unless you use if (keydown(x)&&keydown(y)){} |
Quote:
|
I might be a little late in asking this, but how exactly Loriel's tokenize convention more efficient?
it would seem to me that requesting a string to be searched through and broken down and then assigned to 2 seperate parts of an array wouldnt be as efficient at all. if (walking == 0) setani idle; else setani walk; what is less efficient about the old way? It does one check. even if you wanted to be crafty why not.. setstring blah,idle,walk; setani #I(blah,walking); although in terms of efficiency it seems equivilent to me. ::shrugs:: The tokenize idea is crazy and unique, but please explain why it is better. |
Certainly is not more efficient, but I deem it more readable or compact, especially with constructions like this ;)
NPC Code: |
| All times are GMT +2. The time now is 07:55 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.