Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   the keydown events (https://forums.graalonline.com/forums/showthread.php?t=4318)

Geovanie Legend 06-09-2001 12:41 AM

the keydown events
 
Could someone be kind enough to post a list of the keydown's.. like thos
0 = a
or whatever each keydown numeric form corrisponds with in letters

Geovanie Legend 06-09-2001 12:48 AM

I mainly need the keydown's for the following buttons
Z, X, C, and V

WhoopA 06-09-2001 12:52 AM

There are no keydowns for those buttons. These are the only ones available:

0- Up
1- Left
2- Down
3- Right
4- D
5- S
6- A
7- M
8- Tab
9- Q
10- P

Geovanie Legend 06-09-2001 12:58 AM

Ugh, that sucks.. well thanks anyway =)

Geovanie Legend 06-09-2001 01:41 AM

Ok so tell me then, why don't this work?

if (playery=>6&&keydown(5)) {
playerdir=up;
playery=playery-0.5;
}

KJS 06-09-2001 02:19 AM

well
 
it should be

playerdir=0;

Geovanie Legend 06-09-2001 02:22 AM

Ok i tried...
if (playery=>6&&keydown(5)) {
playerdir=0;
playery=playery-0.5;
}
but it still don't work.. what it's suppose to be doing is move the player up by 0.5 notches every time they press S

Thak2 06-09-2001 02:59 AM

need a Timeout in there :)

NPC Code:

if (playerenters ||timeout ) {
timeout = 0.05;
}
if (timeout&&playery=>6&&keydown(5)) {
playerdir=0;
playery=playery-0.5;
timeout=0.05;
}


note: you can substitute playerenters with anyother thing you want...

Geovanie Legend 06-09-2001 03:17 AM

Ok thanks, i got it working, but one thing still isn't right.. the player can just hold down the button and move up, i want them to have to repeatedly press the button so the faster the press it the faster they move, and the slower the press it the slower they move. i'd post what i have, but i don't want anyone to steal it =)

KJS 06-09-2001 03:27 AM

to check if they have the keyup
 
ok to check if they have the key up do something like this
NPC Code:
if(keydown(<numb>) && this.keydown==0){
this.keydown=1;
//do rest of the coding
}
if(!keydown(<numb>) && this.keydown==1)
this.keydown=0;


Geovanie Legend 06-09-2001 03:43 AM

Ok i added that and it still didn't work, you can just hold down the button and move =(

KJS 06-09-2001 04:03 AM

humm I dunno
 
I dunno...

oh..

do you
disabledefmovement?

so they cant hold up...

so they have to press the button...

Geovanie Legend 06-09-2001 04:04 AM

yep i done that, lol

KJS 06-09-2001 04:12 AM

I would...
 
I dunno I would have to see your script

Tyhm 06-09-2001 05:03 AM

if(keydown(5)){
if(this.keydown==0){
this.keydown=1;
...
}
}else this.keydown=0;

KJS 06-09-2001 05:06 AM

that shouldn't
 
that shouldn't matter if it says
elseif
or
if

LiquidIce00 06-10-2001 08:19 AM

if you want it to be the more you press the faster it goes..
like if you keep pressing it really fast then I suggest you do some sort of speed string .. which adds +.5 or whatever every time the player has the key down and has a max value .. like 3 or whatever.. and also it would have to take out .5 when there is no key down
shouldnt be hard to make. I'd do it but I'm too lazy, too busy and sun burn hurts

T-Squad 06-10-2001 10:08 AM

actually it does matter with else...
basicly without else, it will do everything instantly....

for istance try doing weapon fired, and making it go something like:
if (weaponfired) {
if (this.on = 1) {
this.on = 0;
}else{
if (this.on = 0) {
this.on = 1;
}
}
}

then have another going:

if (weaponfired) {
if (this.on = 1) {
this.on = 0;
}
if (this.on = 0) {
this.on = 1;
}
}

and you will see what i mean ;-)


All times are GMT +2. The time now is 08:43 PM.

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