Quote:
Originally Posted by killerogue
That's interesting. >.>
Seeing as how a friend of mine told me,
PHP Code:
for (key: getstringkeys("objectname.inv_"))
Would work.
Edit: But if I did:
Here's what I'm doing:
PHP Code:
public function inventory() { invcontents = new TStaticVar(); invcontents.loadVars("levels/player_" @ player.account @ ".arc"); for (i: getstringkeys("inv_")) { if (i == "item=") { tokens = getstringkeys("invcontents.inv_" @ i).substring(22).tokenize(","); } else if (i == "wep=") { //stuff } else if (i == "keyitem=") { tokens = getstringkeys("invcontents.inv_" @ i).substring(25).tokenize(","); } else if (i == "clothes=") { tokens = getstringkeys("invcontents.inv_" @ i).substring(25).tokenize(","); } } } }
Also, doing what you said and using, with, would I have to put "this.inv_" or could I just do "inv_".
|
"inv_" really just refers to temp.inv_, inv_ (global), or player.inv_. Not "this.inv_", your method works because you're making the variable global.
It is bad practice in general, and you should really just use with ( item ).
By glancing at your script, however, you seem to be making things hard for yourself. Why don't you use the index numbers?
PHP Code:
tokens = invcontents.(@"inv_" @ i);
Personally, I do not understand what you're trying to accomplish here.