Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   if (keypressed) { ... (https://forums.graalonline.com/forums/showthread.php?t=56968)

Aethorpe 01-09-2005 02:43 PM

if (keypressed) { ...
 
Ok, I know that this works 0-10 with up, left, down, right, S, A, D, M, tab, Q, P.

NPC Code:
if (keypressed) {
if (keydown(#)) {

}
}



However, I was wondering if there was a method that would detect keys other than those stated above, such as the numberpad, insert, home, end, delete, and other letters, etc. If anyone could volunteer their knowledge and experiences with this, I would appreciate it. :)

middo 01-09-2005 03:38 PM

NPC Code:

if (keypressed && strequals(#p(1),k)) {
say2 OMG U PRESS K KEY.
}



That's the lazy way, and there are many better ways of putting it together, but I forget them right now.
(Some people are obsess with the keycode function, I just say screw it))

Aethorpe 01-09-2005 03:54 PM

Quote:

Originally Posted by middo
NPC Code:

if (keypressed && strequals(#p(1),k)) {
say2 OMG U PRESS K KEY.
}



That's the lazy way, and there are many better ways of putting it together, but I forget them right now.
(Some people are obsess with the keycode function, I just say screw it))

Thanks, but, uh, care to explain how that works? I'm not sure I understand '#p(1)'. Sorry, I am just starting out with this.

I also had a question about strings, what command updates a string to a new value? Maybe I am blind, but I seriously do not see one. I used setstring to create the string, this is correct, right? And to change it?

I really appreciate the help, thanks again. :)

DarkShadows_Legend 01-09-2005 05:28 PM

http://forums.graalonline.com/forums...essed+tutorial

This could help some.

Nappa 01-09-2005 06:13 PM

Dark, how dare you show off the winkie gang in your signature but not use the normal yellowish one ? I DEMAND A RECOUNT.

Gman4pwnu 01-09-2005 10:02 PM

if (keypressed){
setplayerprop #c, #p(0) #p(1) #p(2);
}

One of them should tell which key it is.

Skyld 01-09-2005 10:08 PM

#p(0) is the ascii of the key. #p(1) is the human-readable form.

EikeSiewertsen 01-09-2005 10:50 PM

Its all in the newfeatures*.txt


All times are GMT +2. The time now is 06:26 PM.

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