Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Keydown (https://forums.graalonline.com/forums/showthread.php?t=21644)

iceman8832 01-21-2002 07:45 AM

Keydown
 
Does anyone know the keydowns for a,s,d,up,down,left, and right?

iceman8832 01-21-2002 07:52 AM

Also how do you use keydowns?

Sennema 01-21-2002 08:29 AM

Keydowns... aight, here goes...

up= 0
left = 1
down = 2
right = 3
D = 4
S = 5
A = 6

Basically, it checks to see if the player is pressing the key or not. Example:

NPC Code:

if(playerenters&&!isweapon){
toweapons -Menu;
disableselectweapons;
}
if(keydown(9)&&isweapon){
replace normal weapon select crap with new stuff;
}



That was sorta bad, but it works something like that (9 is Q by the way). That's somewhat similar to this menu thing I made, and probably similar to all those other menus out there.

Shard_IceFire 01-21-2002 08:42 AM

Hmm for me keydowns only work when part of a timeout loop.

royce 01-21-2002 10:12 AM

Umnn what about "R"?????

Echos 01-21-2002 10:20 AM

Quote:

Originally posted by Shard_IceFire
Hmm for me keydowns only work when part of a timeout loop.
[Kaimetsu]

Wrong! Keydown works wherever you use it - the only problem comes when people fail to understand that it is a function rather than an event. This "Sennema" person seems to make that mistake too.

And no, you cannot use R.

[/Kaimetsu]

BocoC 01-21-2002 10:48 AM

OOO! R is a great keydown to add to my list of keydowns we MUST have!

-=List of Keydowns we MUST have=-
DELETE
R
-=End List of Keydowns we MUST have=-

WHIPENIE4 01-21-2002 10:49 AM

[screen_name says:]

kai, i didnt know that, but the only way i can seem to get keydown to work is in a timeout loop too

Echos 01-21-2002 11:07 AM

Quote:

Originally posted by WHIPENIE4
[screen_name says:]

kai, i didnt know that, but the only way i can seem to get keydown to work is in a timeout loop too

[Kaimetsu]

Well, it all very much depends on what you mean by "work". The function will, at pretty much any time, return the state of the specified key. Whether or not you use this in any useful way (which usually implies a timeout) is your own concern.

[/Kaimetsu]

Faheria_GP2 01-21-2002 02:49 PM

babylon combines "playerendsreading" and "keydown()" to make a nice sign menu

Faheria_GP2 01-21-2002 02:54 PM

here is an example of one I made on the spur of the moment, it kinda sucks though

NPC Code:

if (playerenters) {
say2 Delete all rupees?#b>Yes No;
set yes; unset no;
}
if (playerendsreading) {
if (keydown(3)) {
say2 Delete all rupees?#bYes >No;
set no; unset yes;
}
if (keydown(1)) {
say2 Delete all rupees?#b>Yes No;
set yes; unset no;
}
if (keydown(4)) {
if (yes) playerrupees=0;
unset yes; unset no;
}
}


Echos 01-21-2002 02:57 PM

Quote:

Originally posted by Faheria_GP2
here is an example of one I made on the spur of the moment, it kinda sucks though
[Kaimetsu]

I'll give you the benefit of the doubt and assume that you'd never normally use flags for such things.

[/Kaimetsu]

TDK_RC6 01-21-2002 08:31 PM

crazy kai

Slaktmaster 01-21-2002 08:40 PM

I hate flags. :(

I remember when i always used them, for everything. I didn't know about this.vars ;)

TDK_RC6 01-21-2002 09:06 PM

does anyone use the save slots for the npcs anymore??

BocoC 01-22-2002 12:45 AM

Quote:

Originally posted by TDK_RC6
does anyone use the save slots for the npcs anymore??
I haven't found much use for them yet. But the Draisine and railroad tracks use the save slot.

Sennema 01-22-2002 07:16 AM

They've worked without timeouts before for me. Not overly well, but they did work. But it's been awhile since I've used them without a timeout loop.

Sennema 01-22-2002 07:19 AM

Quote:

Originally posted by Slaktmaster
I hate flags. :(

I remember when i always used them, for everything. I didn't know about this.vars ;)

Yeah, I used to use them all the time too, until they started having a little problem in which if you set a flag in a level, NPCs didn't like to read it until the level was reloaded.

grim_squeaker_x 01-22-2002 11:06 PM

Quote:

Originally posted by Slaktmaster
I hate flags. :(
They're, however, very useful in certain cases. Like if you make a sign which only should display once, you use a flag, since those are stored with the player and not with the NPC. Plus flags are kept even after the player logs out if you use them in weapons.
Although I have to say that I, personally, prefer using the new string arrays.

Sennema 01-23-2002 07:54 AM

Quote:

Originally posted by grim_squeaker_x
They're, however, very useful in certain cases. Like if you make a sign which only should display once, you use a flag, since those are stored with the player and not with the NPC. Plus flags are kept even after the player logs out if you use them in weapons.
Although I have to say that I, personally, prefer using the new string arrays.

Yeah, flags do make some things like that easier. Less typing in some cases. I use them in a couple levels so that if the player has already chosen something there, they can't enter again. There's so many choices it's just easier to set a flag than check for each string or variable.

I haven't used the string arrays much yet. I should probably go experiment with them sometime soon.

TDK_RC6 01-23-2002 08:17 AM

man i love the string arrays

i dont know if stefan was planning on putting those in, but i sent him a email about them b4 they came out, but they sure are a lot easier to use

BocoC 01-23-2002 08:22 AM

String arrays = <3

(so would R and DELETE as future keydowns)


All times are GMT +2. The time now is 01:32 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.