Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-30-2004, 08:06 AM
Salaisuus Salaisuus is offline
Registered User
Join Date: Mar 2004
Posts: 68
Salaisuus is on a distinguished road
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?
Reply With Quote
  #2  
Old 11-30-2004, 09:25 AM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
If that is the whole script, you can use 'sleep', if not, there are plenty of other ways, using variables.
__________________
-Kjetil Valen
Reply With Quote
  #3  
Old 11-30-2004, 10:45 AM
Salaisuus Salaisuus is offline
Registered User
Join Date: Mar 2004
Posts: 68
Salaisuus is on a distinguished road
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.
Reply With Quote
  #4  
Old 11-30-2004, 01:05 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
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!
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #5  
Old 11-30-2004, 09:58 PM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
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)
Reply With Quote
  #6  
Old 11-30-2004, 11:39 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
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.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:00 PM.


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