View Single Post
  #4  
Old 04-10-2007, 02:10 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by killerogue View Post
That's interesting. >.>

Seeing as how a friend of mine told me,

PHP Code:
for (keygetstringkeys("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 (
igetstringkeys("inv_"))
    {
      if (
== "item=")
      {
        
tokens getstringkeys("invcontents.inv_" i).substring(22).tokenize(",");
      }
      else if (
== "wep=")
      {
        
//stuff
      
}
      else if (
== "keyitem=")
      {
        
tokens getstringkeys("invcontents.inv_" i).substring(25).tokenize(",");
      }
      else if (
== "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.

Last edited by Novo; 04-10-2007 at 09:10 PM..
Reply With Quote