View Single Post
  #51  
Old 02-06-2014, 12:31 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
Quote:
Originally Posted by iDigzy View Post
Thanks , would you use tokenizeing as well when doing such scripts as
PHP Code:
if (player.chat.starts("text")){ 
player.chat.substring;

Your example isn't a proper use of substring ( string.substring(index[,length]) ) , but, essentially, yes, you could tokenize the player's chat if a condition is met. I'll let someone else fill you in on substring as I know how it works (sometimes), but am not familiar enough to verse you on its uses...sorry...


random tailor example for tokenize [better ways to do this...example for simplicity sake..]:
PHP Code:
if (player.chat.starts("/set ")){ //player says "/set shoes"
  
player.chat.tokenize(); //as previously mentioned, SPACES become separators
  
if (tokens[1] == "shoes"){
    
player.colors[2] = tokens[2];
    
//OR...
    //player.colors[2] = player.chat.substring(10,-1); // not 100% sure on this??
  
}

Quote:
Also, for the delimiters, you would basically be able to put for example a word such as "idigzy" and wherever that word occurs it splits it :o?
yeah, you get the concept....
some common delimiters: are , (commas), spaces . (periods) , and so on...

there is a tokenize2 but I didn't want to include it.
You can scripthelp it.

Is there anything you are trying to do in specific, there might be a better approach?
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote