View Single Post
  #1  
Old 01-13-2006, 06:10 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Tokenize option to return delims

I've definitely touched on this in a lot of other threads, but the tokenize function should have the ability to return specified delimiters.
There are several functions that it can serve.
Let's say you have a staff chat command.
Let's say you wanted to be able to have the staff do multiple commands in one event call?
ASSUMING:
this.commandtoken = "/"; //(would be returned by tokenize())
player.chat == "/heal/heal jake13jake";


player.chat.tokenize("/");
//let's assume the "/" was returned as a delim.
for (i=0;i<tokens.size();i+=2) {
if (tokens[i] == "/") {
parsecommands(tokens[i+1]);
}
}
pos() only finds the first one
starts() only finds the first one
unless you want to cycle through and find all of the places it says /, it really defeats the purpose of tokenize.

The amount of functionality this would add is only limited to the extent of the scripter's imagination.
Reply With Quote