Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-27-2010, 04:27 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
using tokenscount

okay, so lets say i've done temp.test = clientr.equips_weapon.tokenize(",");
how do i get the number of tokens produced with tokenscount? It seems to be returning 0 whatever I do.

Also, do i need to even do temp.test = var.tokenize(","); or can i simply leave it as var.tokenize(","); and proceed to checking the number of tokens produced with tokenscount?

And also, would I be able to somehow use tokenscount easily with an array?
Example, Lets say I have:
PHP Code:
temp.array = {
  
var1.tokenize(","),
  
var2.tokenize(","),
  
//etc

or, assuming it would work:
PHP Code:
temp.array.tokenize(",") = {
  
var1,
  
var2,
  
//etc

would there be a way to grab the tokenscount of var1 and var2 without being required to do something like:
PHP Code:
temp.array[0].tokenize(",");
var.
tokenscount;
temp.array[1].tokenize(",");
var.
tokenscount;
//etc 
or something?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 07-27-2010, 04:36 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
tokenize() returns an array of tokens, so
PHP Code:
temp.tokens temp.str.tokenize(",");
temp.count temp.tokens.size(); 
will give you the number of tokens.


You can use tokenize(delim) on any string where delim specifies the delimiter (or what you want to use to separate the string).
__________________
Reply With Quote
  #3  
Old 07-27-2010, 04:58 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
If you're using an array, you don't need to tokenize it by a comma.

PHP Code:
temp.array = clientr.equip_weapons
In addition, tokenscount is GS1. The proper GS2 is:
PHP Code:
temp.tokens str.tokenize(delim);
temp.size tokens.size(); 
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:01 AM.


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