Graal Forums

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

Spectre1337 08-14-2002 04:27 AM

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;} 



:(

RavenTelvecho 08-14-2002 04:37 AM

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 :)

emortylone 08-14-2002 04:39 AM

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

RavenTelvecho 08-14-2002 04:42 AM

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

Spectre1337 08-14-2002 04:46 AM

To be honest, I don't know tokensize or t things either. :D
Back when everyone was learning to script, I was eating pizza.

Sorry :(

RavenTelvecho 08-14-2002 04:57 AM

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

Torankusu 08-14-2002 06:38 AM

Let's forget it's
"startswith(start,#thing)"

screen_name 08-14-2002 07:10 AM

startswith(text,stringname) <-correct syntax

zorakid2001 08-14-2002 10:07 AM

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

RavenTelvecho 08-14-2002 10:13 AM

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?

zorakid2001 08-14-2002 10:22 AM

thank you veryvery much. At least one person doesnt hate me =D

screen_name 08-14-2002 01:02 PM

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*

CheeToS2 08-14-2002 04:47 PM

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.

Legondary_MyTH 08-15-2002 05:51 AM

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

osrs 08-18-2002 01:46 PM

NPC Code:
"startswith (partstr,srt)"
str starts with partstr


emortylone 08-25-2002 12:01 AM

LOL, I laugh @ ppl when they do (syntax,stringname) I always do it:
NPC Code:

if (strequals(#string,syntax))


it looks MUCH more organized. If you read it (read it like a sentence btw) you get if the string (playerchats) equals (start), it sounds better than if the string (start) is the value of (playerchats). It is easier to read and easier to comprehend =P
---Shifter


All times are GMT +2. The time now is 03:26 PM.

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