Graal Forums

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

ZeLpH_MyStiK 01-28-2004 03:46 PM

tokens
 
Is there anyway to tokenize a string w/o it breaking it up by spaces, and only by commas.
IE the string: This is an example,test test test,hi
would be broken up into:
This is an example
test test test
hi
I'm just wondering if there is a command for it, if not I guess i'll do it the hard way since wraptext2 width,font size,delimiter,text; doesnt seem to be working (delimiter portion of it).

mhermher 01-28-2004 04:00 PM

Re: tokens
 
Quote:

Originally posted by ZeLpH_MyStiK
Is there anyway to tokenize a string w/o it breaking it up by spaces, and only by commas.
IE the string: This is an example,test test test,hi
would be broken up into:
This is an example
test test test
hi
I'm just wondering if there is a command for it, if not I guess i'll do it the hard way since wraptext2 width,font size,delimiter,text; doesnt seem to be working (delimiter portion of it).

sarraylen(string)
#I(string,index)


Sample:

for (i=0;i<sarraylen(string);i++) {
showtext blablabla,blabla,blabla,blalb,alb,alb,#I(string,i) ;
}

osrs 01-28-2004 04:36 PM

Re: Re: tokens
 
Quote:

Originally posted by ZeLpH_MyStiK
Is there anyway to tokenize a string w/o it breaking it up by spaces, and only by commas.
IE the string: This is an example,test test test,hi
would be broken up into:
This is an example
test test test
hi
I'm just wondering if there is a command for it, if not I guess i'll do it the hard way since wraptext2 width,font size,delimiter,text; doesnt seem to be working (delimiter portion of it).

Probably the best way is wraptext.

Quote:

Originally posted by mhermher

showtext blablabla,blabla,blabla,blalb,alb,alb,#I(string,i) ;

NPC Code:

showtext index,x,y,font,style,text;



There is no blablabla :D

ZeLpH_MyStiK 01-28-2004 05:28 PM

Re: Re: Re: tokens
 
Quote:

Originally posted by osrs


Probably the best way is wraptext.



NPC Code:

showtext index,x,y,font,style,text;



There is no blablabla :D

Ya i tried wraptext2 with delimiters but it doesnt cut it off when there is a delimiter, only when it reaches the pixel width does it cut it off.

-Ramirez- 01-28-2004 05:31 PM

I asked Stefan about this before. Tokenize2 shouldn't count spaces as a delimiter at all times. He said it should be fixed in 3.1.

Loriel 01-28-2004 06:18 PM

#I() and stuff probably will not work, I think multiple words in one comma seperated string need to be enclosed by ""-quotes.

ZeLpH_MyStiK 01-28-2004 06:38 PM

Quote:

Originally posted by Loriel
#I() and stuff probably will not work, I think multiple words in one comma seperated string need to be enclosed by ""-quotes.
Yep thanks to Loriel it works. I used #I and sarraylen at first, but it turned out to be just like tokenize, and then I saw Loriel's post and added in "" to the string and again also using #I and arraylen and it works! =)

wonderboysp2p 01-31-2004 07:22 PM

Quote:

Originally posted by -Ramirez-
I asked Stefan about this before. Tokenize2 shouldn't count spaces as a delimiter at all times. He said it should be fixed in 3.1.
i mentioned that earlier.. maybe it was to stefan or maybe it was on the forums, but until then!! use quotes, like loriel said


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

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