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 09-27-2001, 07:39 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
tokenizing >,=,<

ok i got the standard tokenizing down but like if the token saved is a number is there a way i can use it as in the below ?

NPC Code:

// NPC made by Nyght v3.5
if (playerenters) {
toweapons *Staff Warper
}
while (created && !staff) {
destroy;
}
if (playerchats && staff && startswith(warpto,#c)) {
tokenize #c;
if (#t(1)>=0) {
this.warpcommand=0;
}else setlevel #t(1);
}



I dont think '(#t(1)>=0)' is right but i want if the number value of the token is greater than or equals to zero to set the variable this.warpcommand to 0 ....

please help ....
Reply With Quote
  #2  
Old 09-27-2001, 08:43 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
if (playerchats) {
tokenize #c;
if (startswith(warpto,#c)) {
if (staff) {
if (tokenscount==3) {
setstring local.x,#t(1);
setstring local.y,#t(2);
setstring local.level,#t(3);
timeout = .5;
}
}
}
}

if (timeout) {
setlevel2 #s(local.level),#s(local.x),#s(local.y);
}

[edit] oh i see...
hmm well...
you can do

this.counter = strtofloat(#t(1));

if (this.counter => 0) {
action;
}
Reply With Quote
  #3  
Old 09-27-2001, 09:12 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Quote:
Originally posted by Merlin
if (playerchats) {
tokenize #c;
if (startswith(warpto,#c)) {
if (staff) {
if (tokenscount==3) {
setstring local.x,#t(1);
setstring local.y,#t(2);
setstring local.level,#t(3);
timeout = .5;
}
}
}
}

if (timeout) {
setlevel2 #s(local.level),#s(local.x),#s(local.y);
}

[edit] oh i see...
hmm well...
you can do

this.counter = strtofloat(#t(1));

if (this.counter => 0) {
action;
}
ok i understand what your doing .... but here is what i want ...

i want it so if the playerchats and it starts with 'warpto' it tokenizes #c. ( I can do that but) I wanna know if there is a special command to check the numerical value of a token?(the token being >,=,<)
Reply With Quote
  #4  
Old 09-27-2001, 09:15 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
All tokens are saved as strings, so use the command 'strtofloat()' to convert it into a numerical value. You can than use >, =, or < to check the number.

tokenize #c;
if (strtofloat(#t(1))>0)) { }
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
Reply With Quote
  #5  
Old 09-27-2001, 09:19 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Quote:
Originally posted by BocoC
All tokens are saved as strings, so use the command 'strtofloat()' to convert it into a numerical value. You can than use >, =, or < to check the number.

tokenize #c;
if (strtofloat(#t(1))>0)) { }
Thats exactly what i wanted to hear Boco thanx !!!
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 07:01 AM.


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