Thread: Tokenize
View Single Post
  #2  
Old 06-06-2001, 04:32 AM
Brandon_Bravo Brandon_Bravo is offline
Registered User
Join Date: Jun 2001
Location: Kalamazoo, Michigan USA
Posts: 206
Brandon_Bravo is on a distinguished road
Send a message via ICQ to Brandon_Bravo Send a message via AIM to Brandon_Bravo Send a message via MSN to Brandon_Bravo Send a message via Yahoo to Brandon_Bravo
Re: Tokenize

Certainly.

Tokenizing a string separates it into units called tokens.

For example:

if a playerchats and says:

warpto 30 30 onlinestartlocal.graal

#t(1) would be the first 30
#t(2) would be the second 30
#t(3) would be onlinestartlocal.graal

[ Tokens are called by using the form #t(ID) ]

An example of this is:
NPC Code:
if (playerchats) {
if (startswith(warpto,#c)) {
levelwarp();
}
}
function levelwarp() {
tokenize #c;
setstring this.level,#t(1);
setstring this.x,#t(2);
setstring this.y,#t(3);
setlevel2 #s(this.level),#s(this.x),#s(this.y);
}



That is a small example of Tokenizing.



__________________
Brandon M.

Last edited by Brandon_Bravo; 06-06-2001 at 06:03 AM..
Reply With Quote