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 08-14-2002, 04:27 AM
Spectre1337 Spectre1337 is offline
Banned
Spectre1337's Avatar
Join Date: Nov 2001
Location: United States
Posts: 790
Spectre1337 is on a distinguished road
Send a message via AIM to Spectre1337 Send a message via Yahoo to Spectre1337
Arrow startswith ?

I have never learned how to use that command, and now I need it..

Can someone just explain how to use it? Is it like
NPC Code:
if (startswith(#l,level){say2 You are in level-blah.graal;} 



Reply With Quote
  #2  
Old 08-14-2002, 04:37 AM
RavenTelvecho RavenTelvecho is offline
Registered User
RavenTelvecho's Avatar
Join Date: Apr 2002
Location: Toronto, Ontario, Canada
Posts: 0
RavenTelvecho is on a distinguished road
Send a message via ICQ to RavenTelvecho Send a message via AIM to RavenTelvecho Send a message via Yahoo to RavenTelvecho
Re: startswith ?

Quote:
Originally posted by Spectre1337
I have never learned how to use that command, and now I need it..

Can someone just explain how to use it? Is it like
NPC Code:
if (startswith(#l,level){say2 You are in level-blah.graal;} 



NPC Code:
if (startswith(level,#L)){say2 You are in level-blah.graal;} 


or u could simply do
NPC Code:
if (startswith(level,#L)){say2 You are in #L;} 


but im not sure of ur case
__________________

^tuff newbie ;x
RavenTelvecho
!Booj
we are 'brothers'
Reply With Quote
  #3  
Old 08-14-2002, 04:39 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
X.X this is Projectshifter btw, my account is not working!

startswith would be used like if you want to make like a warpto script:
NPC Code:

if (playerchats && startswith(#c,warp))
{ tokenize #c;
this.x=#t(1);
this.y=#t(2);
setstring client.level,#t(3);
freezeplayer 1;
sleep 1;
setlevel2 this.x,this.y,#s(client.level);
}



a bit of extra stuff, but it says that if the string starts with what you specify. Your string:
NPC Code:

if (startswith(#L,level)){say2 You are in level-blah.graal;}


would make it so that if the level started with level then it would perform the action. #L needs to be capital, and it does the Level of the NPC, on an NPC Server you would want to use #F. You need to put a second end paranthese ')' to end the if statement not just the startswith.
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #4  
Old 08-14-2002, 04:42 AM
RavenTelvecho RavenTelvecho is offline
Registered User
RavenTelvecho's Avatar
Join Date: Apr 2002
Location: Toronto, Ontario, Canada
Posts: 0
RavenTelvecho is on a distinguished road
Send a message via ICQ to RavenTelvecho Send a message via AIM to RavenTelvecho Send a message via Yahoo to RavenTelvecho
Quote:
Originally posted by emortylone
X.X this is Projectshifter btw, my account is not working!

startswith would be used like if you want to make like a warpto script:
NPC Code:

if (playerchats && startswith(#c,warp))
{ tokenize #c;
this.x=#t(1);
this.y=#t(2);
setstring client.level,#t(3);
freezeplayer 1;
sleep 1;
setlevel2 this.x,this.y,#s(client.level);
}



a bit of extra stuff, but it says that if the string starts with what you specify. Your string:
NPC Code:

if (startswith(#L,level)){say2 You are in level-blah.graal;}


would make it so that if the level started with level then it would perform the action. #L needs to be capital, and it does the Level of the NPC, on an NPC Server you would want to use #F. You need to put a second end paranthese ')' to end the if statement not just the startswith.
---Shifter
i said that k? but u added extra hehe <3
__________________

^tuff newbie ;x
RavenTelvecho
!Booj
we are 'brothers'
Reply With Quote
  #5  
Old 08-14-2002, 04:46 AM
Spectre1337 Spectre1337 is offline
Banned
Spectre1337's Avatar
Join Date: Nov 2001
Location: United States
Posts: 790
Spectre1337 is on a distinguished road
Send a message via AIM to Spectre1337 Send a message via Yahoo to Spectre1337
To be honest, I don't know tokensize or t things either.
Back when everyone was learning to script, I was eating pizza.

Sorry
Reply With Quote
  #6  
Old 08-14-2002, 04:57 AM
RavenTelvecho RavenTelvecho is offline
Registered User
RavenTelvecho's Avatar
Join Date: Apr 2002
Location: Toronto, Ontario, Canada
Posts: 0
RavenTelvecho is on a distinguished road
Send a message via ICQ to RavenTelvecho Send a message via AIM to RavenTelvecho Send a message via Yahoo to RavenTelvecho
Quote:
if (playerchats && startswith(#c,warp))
{ tokenize #c;
this.x=#t(1);
this.y=#t(2);
setstring client.level,#t(3);
freezeplayer 1;
sleep 1;
setlevel2 this.x,this.y,#s(client.level);
}
tokenize #c;
divides str [#c] into words (tokens) which can be read with
#t(index)

so for example:
if (playerenters||timeout) {
message #v(this.x);
timeout=.05;
}
if (playerchats) {tokenize #c;
this.x=strtofloat(#t(6));
}

and i said "HELLO Frank, how are you? Im 8"

this.x would equal 8

also notice the strtofloat on #t(6), its cause i already knew that index of 6 would be a number... just an example to get u started...

index always starts from 0
__________________

^tuff newbie ;x
RavenTelvecho
!Booj
we are 'brothers'

Last edited by RavenTelvecho; 08-14-2002 at 05:09 AM..
Reply With Quote
  #7  
Old 08-14-2002, 06:38 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Let's forget it's
"startswith(start,#thing)"
Reply With Quote
  #8  
Old 08-14-2002, 07:10 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
startswith(text,stringname) <-correct syntax
__________________
[signature]insert here[/signature]
Reply With Quote
  #9  
Old 08-14-2002, 10:07 AM
zorakid2001 zorakid2001 is offline
Banned
Join Date: Jul 2002
Location: Oregon USA <-- this place sux0rs
Posts: 113
zorakid2001 is on a distinguished road
Send a message via ICQ to zorakid2001 Send a message via AIM to zorakid2001
how come everyone votes bad for me? Anyways.. on the command list in the npc script window thing then theres a list of scripts and their correct syntax so check that before you post a problem! unless your like me and are too lazy to read the syntax and decide to make a big long thread =D its all good

-Wonderboy
Reply With Quote
  #10  
Old 08-14-2002, 10:13 AM
RavenTelvecho RavenTelvecho is offline
Registered User
RavenTelvecho's Avatar
Join Date: Apr 2002
Location: Toronto, Ontario, Canada
Posts: 0
RavenTelvecho is on a distinguished road
Send a message via ICQ to RavenTelvecho Send a message via AIM to RavenTelvecho Send a message via Yahoo to RavenTelvecho
Quote:
Originally posted by zorakid2001
how come everyone votes bad for me? Anyways.. on the command list in the npc script window thing then theres a list of scripts and their correct syntax so check that before you post a problem! unless your like me and are too lazy to read the syntax and decide to make a big long thread =D its all good

-Wonderboy
i voted good, feel special k?
__________________

^tuff newbie ;x
RavenTelvecho
!Booj
we are 'brothers'
Reply With Quote
  #11  
Old 08-14-2002, 10:22 AM
zorakid2001 zorakid2001 is offline
Banned
Join Date: Jul 2002
Location: Oregon USA <-- this place sux0rs
Posts: 113
zorakid2001 is on a distinguished road
Send a message via ICQ to zorakid2001 Send a message via AIM to zorakid2001
thank you veryvery much. At least one person doesnt hate me =D
Reply With Quote
  #12  
Old 08-14-2002, 01:02 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by zorakid2001
how come everyone votes bad for me? Anyways.. on the command list in the npc script window thing then theres a list of scripts and their correct syntax so check that before you post a problem! unless your like me and are too lazy to read the syntax and decide to make a big long thread =D its all good

-Wonderboy

lol, the syntax i posted is right

anyways...
i like yeah, i always like prospecting scripters, although being lazy wont get you far in scripting

*goes to rate*
__________________
[signature]insert here[/signature]
Reply With Quote
  #13  
Old 08-14-2002, 04:47 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by screen_name
startswith(text,stringname) <-correct syntax
Geez, thank you. I thought I was going crazy seeing everyone else do it the other way around.
__________________

Reply With Quote
  #14  
Old 08-15-2002, 05:51 AM
Legondary_MyTH Legondary_MyTH is offline
Registered User
Join Date: May 2002
Location: Levelville
Posts: 420
Legondary_MyTH is on a distinguished road
well

Quote:
Originally posted by zorakid2001
how come everyone votes bad for me? Anyways.. on the command list in the npc script window thing then theres a list of scripts and their correct syntax so check that before you post a problem! unless your like me and are too lazy to read the syntax and decide to make a big long thread =D its all good

-Wonderboy
at least you get rated
i rated you 4
__________________
ArchMage Amedeus Valoryn of Zormite
Manager of Anarchy
Past Jobs:
Levels Admin on Renegade
LAT on Doomsday,Babylon,G3K
Developer on Faheria,Babylon
GP on Sanstrata,G3K
Reply With Quote
  #15  
Old 08-18-2002, 01:46 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
NPC Code:
"startswith (partstr,srt)"
str starts with partstr

__________________
"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
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:32 PM.


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