Graal Forums

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

Salaisuus 11-30-2004 08:06 AM

Stoping script
 
is there a command to make the key commands sleep?

if (keypressed) {
if (strequals(#p(1),1)) setani plah,;}

is there a way to "freeze" the script so that if I keep tapping 1 it wont restart the gani every time, but rather play it till the end and only then release the key for use?

VeX_RaT_Boy 11-30-2004 09:25 AM

If that is the whole script, you can use 'sleep', if not, there are plenty of other ways, using variables.

Salaisuus 11-30-2004 10:45 AM

Sleep doesnt work with the keys.

if (keypressed) {
if (strequals(#p(1),1)) setani plah,; sleep 3;}

If it isnt a continous gani it will restart it when you press during sleep time.

I suppose I could do somethign like:

if (keypressed && this.keydown=0) {
if (strequals(#p(1),1)) {this.keydown=1 setani plah,; sleep 3;
this.keydown=0;};}

I was just wondering if there was an internal command or something.

Speaking of keys how do I use keydown command?

if (keydown(A)) {
setstring clientr.plahplah,0;}

Thats how I understood its used, but that script doesnt do anything.

osrs 11-30-2004 01:05 PM

Please use [CODE] tags, this way you can organize your posts better.

Quote:

Originally Posted by Salaisuus
if (keypressed) {
if (strequals(#p(1),1)) setani plah,; sleep 3;}
If it isnt a continous gani it will restart it when you press during sleep time.

If it is a short gani (movements/animations will be done fast), I suppose a sleep is fine, otherwise, a variable setting work too.

Quote:

I suppose I could do somethign like:

if (keypressed && this.keydown=0) {
if (strequals(#p(1),1)) {this.keydown=1; setani plah,; sleep 3;
this.keydown=0;};}
I was just wondering if there was an internal command or something.
This shows how people don't read the rules & guidelines of this section.
According to KSI-GS, rule five:

Use '==' when comparing two values for equality.
Use '=' when assigning a value to a variable.

and you didn't do that, so fix it.

Quote:

Speaking of keys how do I use keydown command?

if (keydown(A)) {
setstring clientr.plahplah,0;}

Thats how I understood its used, but that script doesnt do anything.
keydown does not work like that, it is keydown(0...10), if you read some documents that are in your Graal Folder (newfeatures) it explains it quite well. Your problem is based on lack of reading, dude!

Slash-P2P 11-30-2004 09:58 PM

Quote:

Originally Posted by Salaisuus
Sleep doesnt work with the keys.

if (keypressed) {
if (strequals(#p(1),1)) setani plah,; sleep 3;}

Try freezeplayer instead of sleep.

Quote:

Originally Posted by Salaisuus
Speaking of keys how do I use keydown command?

if (keydown(A)) {
setstring clientr.plahplah,0;}

Thats how I understood its used, but that script doesnt do anything.

keydown parameters are numbered. If you don't know the number for a key, use keydown2 (read how to use it if you dont know it already). I don't know about some other people, but for me, keydown only works under another condition such as a timeout.

Key codes for keydown() (ones I know off the top of my head)
0 - Arrow key up
1 - Arrow key left
2 - Arrow key down
3 - Arrow key right
4 - Weapon fire (default: d)
5 - Sword (default: s)
6 - Grab (default: a)
7 - Map (default: m)
9 - Q-Menu (default: q)

Kaimetsu 11-30-2004 11:39 PM

Either check the player's animation before activating the effect, or implement a timer of some kind. Using sleep within a weapon is bad practice.

And keydown is neither a command nor an event. It is a function.


All times are GMT +2. The time now is 11:50 AM.

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