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 10-02-2001, 04:52 PM
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
tokens

ok to check a word numbers numerical value you use 'strtofloat'
so:
NPC Code:

if (strtofloat(#t(1))>=1) {hide;
}


So would setting the token to a variable work in the command like for if i say "warpto 30 30 onlinestartlocal.graal":
NPC Code:

// NPC made by Nyght v3.5
if (playerenters) {
toweapons *Level Warper
}
while (created && !staff) {
destroy;
}
if (playerchats && staff && startswith(warpto,#c)) {
tokenize #c;
if (strtofloat(#t(1))>=0) {
this.warpcommand=0;
}else setlevel #t(1);
}
if (this.warpcommand=0) {
setstring newlevel,#t(3);
this.newx=#t(1);
this.newx=#t(2);
setlevel2 #s(newlevel),#v(this.newx),#v(this.newy);
}

Reply With Quote
  #2  
Old 10-02-2001, 04:55 PM
Bravo_Admin1 Bravo_Admin1 is offline
Banned
Join Date: Oct 2001
Location: USA
Posts: 21
Bravo_Admin1 is on a distinguished road
Re: tokens

Quote:
Originally posted by nyghtGT
ok to check a word numbers numerical value you use 'strtofloat'
so:
NPC Code:

if (strtofloat(#t(1))>=1) {hide;
}


So would setting the token to a variable work in the command like for if i say "warpto 30 30 onlinestartlocal.graal":
NPC Code:

// NPC made by Nyght v3.5
if (playerenters) {
toweapons *Level Warper
}
while (created && !staff) {
destroy;
}
if (playerchats && staff && startswith(warpto,#c)) {
tokenize #c;
if (strtofloat(#t(1))>=0) {
this.warpcommand=0;
}else setlevel #t(1);
}
if (this.warpcommand=0) {
setstring newlevel,#t(3);
this.newx=#t(1);
this.newx=#t(2);
setlevel2 #s(newlevel),#v(this.newx),#v(this.newy);
}

Reply With Quote
  #3  
Old 10-02-2001, 04:58 PM
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
nevermind

nevermind i just set strings for the new x and y and that should work ... thanx anyway
Reply With Quote
  #4  
Old 10-02-2001, 04:59 PM
Bravo_Admin1 Bravo_Admin1 is offline
Banned
Join Date: Oct 2001
Location: USA
Posts: 21
Bravo_Admin1 is on a distinguished road
Re: nevermind

Quote:
Originally posted by nyghtGT
nevermind i just set strings for the new x and y and that should work ... thanx anyway
Reply With Quote
  #5  
Old 10-02-2001, 05:03 PM
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
why wont this work ?

why wont this work ???:
setlevel2 #s(newlevel),#s(newx),#s(newy);

Error: Expected format var, var[i], obj[i].attr, function(a), function(a,b)
Reply With Quote
  #6  
Old 10-02-2001, 07:17 PM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Re: why wont this work ?

Quote:
Originally posted by nyghtGT
why wont this work ???:
setlevel2 #s(newlevel),#s(newx),#s(newy);

Error: Expected format var, var[i], obj[i].attr, function(a), function(a,b)
it should be:
setlevel2 #s(newlevel),strtofloat(#s(newx)),strtofloat(#s(ne wy));
Reply With Quote
  #7  
Old 10-03-2001, 02:41 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
but ...

but when i use them directly like this:
NPC Code:

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


I get another error .... Try it yourself you'll see
Reply With Quote
  #8  
Old 10-03-2001, 02:47 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
Re: Re: why wont this work ?

Quote:
Originally posted by btedji


it should be:
setlevel2 #s(newlevel),strtofloat(#s(newx)),strtofloat(#s(ne wy));
would strtofloat use working with tokens ???
'strtofloat(#t(1))'
Reply With Quote
  #9  
Old 10-03-2001, 02:50 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
strtofloat() should work with any strings
Reply With Quote
  #10  
Old 10-03-2001, 03:13 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
yeah !!!

Quote:
Originally posted by btedji
strtofloat() should work with any strings
GRACIAS !!!!!
Reply With Quote
  #11  
Old 10-03-2001, 03:18 AM
Aknts Aknts is offline
Level Designer
Aknts's Avatar
Join Date: Apr 2001
Location: USofA
Posts: 3,340
Aknts will become famous soon enough
Send a message via AIM to Aknts
Here I was bored. So I scripted it.
// NPC made by Spanky
if (playertouchsme) {
toweapons *Level Warper;
}
if (playerchats&&isweapon) {
tokenize #c;
if(strequals(#t(0),warpto)){
if(tokenscount==4){
this.x=strtofloat(#t(1));
this.y=strtofloat(#t(2));
setlevel2 #t(3),this.x,this.y;
}
if(tokenscount==3){
this.x=strtofloat(#t(1));
this.y=strtofloat(#t(2));
setlevel2 #L,this.x,this.y;
}
}}
__________________
Reply With Quote
  #12  
Old 10-03-2001, 03:21 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
this is a shorter way of doing it

NPC Code:

if(startswith(warpto ,#c))
{tokenize #c;

if(tokenscount==4)
{setlevel2 #t(1),strtofloat(#t(2)),strtofloat(#t(3));}
}

Reply With Quote
  #13  
Old 10-03-2001, 03:23 AM
Aknts Aknts is offline
Level Designer
Aknts's Avatar
Join Date: Apr 2001
Location: USofA
Posts: 3,340
Aknts will become famous soon enough
Send a message via AIM to Aknts
No with mine you can say either
Warpto #L,x,y;
or
Warpto x,y;
__________________
Reply With Quote
  #14  
Old 10-03-2001, 03:31 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by Aknts
No with mine you can say either
Warpto #L,x,y;
or
Warpto x,y;
on mine if you wanted to warpto somewhere on the same level just type the level name in!!
Reply With Quote
  #15  
Old 10-03-2001, 03:33 AM
PresShinP2P PresShinP2P is offline
Registered User
Join Date: Oct 2001
Location: Screw it
Posts: 84
PresShinP2P is on a distinguished road
Send a message via AIM to PresShinP2P
you could shorten it, example:
// NPC made by Spanky
if (playertouchsme) {
toweapons *Level Warper;
}
if (playerchats&&isweapon) {
tokenize #c;
if(strequals(#t(0),warpto)){
if(tokenscount==4){
setlevel2 #t(3),strtofloat(#t(1)),strtofloat(#t(2));
}
if(tokenscount==3){
playerx=strtofloat(#t(1));
playery=strtofloat(#t(2));
}
}}

shortened, but you sacrifice readablility
__________________
President Shinra
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 11:59 AM.


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