Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   tokenize (https://forums.graalonline.com/forums/showthread.php?t=68806)

Sum41Freeeeek 09-19-2006 02:21 AM

tokenize
 
I'm having trouble.
How do you turn
tokenize #c;
clientr.randomstring = #t(1);

into gs2?
I made my script in gs1 but I'm not sure how to do tokenize #c in gs2.

thanks :D

KuJi 09-19-2006 02:40 AM

temp.toks = player.chat.tokenize();
temp.toks[1];

=d

Admins 09-21-2006 01:03 AM

Yes the exact translation from tokenize from GS1 to GS2 is
tokens = player.chat.tokenize();

Your example could be like this (to make it as short as possible):
clientr.randomstring = player.chat.tokenize()[1];

KuJi 09-21-2006 01:20 AM

Quote:

Originally Posted by Stefan (Post 1220037)
Yes the exact translation from tokenize from GS1 to GS2 is
tokens = player.chat.tokenize();

Your example could be like this (to make it as short as possible):
clientr.randomstring = player.chat.tokenize()[1];

Ahh, didn't know you can do that =O

JkWhoSaysNi 09-21-2006 01:55 AM

hmm, does that work with other functions that return arrays? I'm sure I tried it with a self made function and it diddnt work.

contiga 09-21-2006 08:45 AM

Quote:

Originally Posted by Stefan (Post 1220037)
Yes the exact translation from tokenize from GS1 to GS2 is
tokens = player.chat.tokenize();

Your example could be like this (to make it as short as possible):
clientr.randomstring = player.chat.tokenize()[1];

Another way of tokenizing in GS2 (tokenize2 ,; ) is:

tokens = player.chat.tokenize( "_");

If I'd say hi_lol_how_are_you
tokens would be { "hi", "lol", "how", "are", "you"}.
tokens[ 3] would get "are", tokens[ 0] would get "hi".


All times are GMT +2. The time now is 03:52 AM.

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