Graal Forums

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

wonderboysp2p 10-12-2003 11:40 PM

-is there?
 
alright, i know that theres
if (keypresed)'s #p(0) and #p(1), but i want to know if an arrow key is pressed :( i was wanting to have it do something that would work like
if (keydown(in|0,3|)) but, that doesnt work... so i used a for loop instead :(

DustyPorViva 10-12-2003 11:48 PM

NPC Code:
keydown(0-3)



It doesn't initiate with keypressed though, because the arrow keys aren't read as keys.

You need to use it in a timeout.

Goboom 10-13-2003 01:21 AM

Quote:

Originally posted by DustyPorViva
NPC Code:
keydown(0-3)



It doesn't initiate with keypressed though, because the arrow keys aren't read as keys.

You need to use it in a timeout.

The kid could also detect the players dir and suppose that the key was pressed not very efficient though, just a random thought I had.

wonderboysp2p 10-13-2003 03:50 AM

Quote:

Originally posted by DustyPorViva
NPC Code:
keydown(0-3)



It doesn't initiate with keypressed though, because the arrow keys aren't read as keys.

You need to use it in a timeout.

gah stefan should make them read as keys...

i hate using

NPC Code:

if (timeout){
timeout=0.05;
//STUFFS
}

:(

Python523 10-13-2003 04:31 AM

You have a farfetched view on what in does, it is a conditional statement, it returns true or false.

osrs 10-13-2003 04:11 PM

NPC Code:

if(playerenters || timeout){
for(i=0;i<4;i++){
if(keydown(i)){
message #v(i);
}
}
timeout = 0.05;
}



Hope this help.

wonderboysp2p 10-14-2003 05:03 AM

Quote:

Originally posted by osrs
NPC Code:

if(playerenters || timeout){
for(i=0;i<4;i++){
if(keydown(i)){
message #v(i);
}
}
timeout = 0.05;
}



Hope this help.

yea thats what i ended up using.. i was just wondering whether or not graal had some way of saying "oh look a key was pressed! and wowzers! its an arrow key!"

CheeToS2 10-14-2003 01:30 PM

Quote:

Originally posted by wonderboysp2p


yea thats what i ended up using.. i was just wondering whether or not graal had some way of saying "oh look a key was pressed! and wowzers! its an arrow key!"

NPC Code:

if (created||timeout){
for (i=0;i<4;i++){
if (keydown(i)){
message oh look a key was pressed! and wowzers! its an arrow key!;
}
}
timeout=.05;
}


:)

Dach 10-14-2003 05:03 PM

Quote:

Originally posted by CheeToS2

NPC Code:

if (created||timeout){
for (i=0;i<4;i++){
if (keydown(i)){
message oh look a key was pressed! and wowzers! its an arrow key!;
}
}
timeout=.05;
}


:)

Omi :megaeek:

this will only end in pain... Spam is bad mmkay?

osrs 10-14-2003 05:58 PM

Quote:

Originally posted by wonderboysp2p
yea thats what i ended up using.. i was just wondering whether or not graal had some way of saying "oh look a key was pressed! and wowzers! its an arrow key!"
Keys between 0-3 are arrow keys, Graal will detect when you press any of them x.x'

DustyPorViva 10-14-2003 06:00 PM

Keypressed doesn't detect arrow keys...

osrs 10-14-2003 06:13 PM

Quote:

Originally posted by DustyPorViva
Keypressed doesn't detect arrow keys...
Hmm,yea, i was wrong. ^^

Lance 10-14-2003 11:15 PM

You should probably add an array or two to see if a key has been let go and pressed again, rather than just continually held down.


All times are GMT +2. The time now is 10:36 AM.

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