View Single Post
  #1  
Old 04-25-2007, 01:18 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Overwriting Object Variables?

PHP Code:
public function saveChar( charID )
{
  
temp.filePath = ( "mud/playerdata/data/" @ this.account @ "_" @ temp.charID @ ".arc" );

  if ( 
temp.charID in |1, 3| )
  {
    if ( 
this.charExists( temp.filePath ) )
    {
    for ( 
temp.var: this.clientr.getDynamicVarNames() )
      {
        if ( !
temp.var.ends( "ID" ) )
        {
          
temp.clientVars.add( temp.var );
        }
      }
      
temp.savedChar = new TStaticVar();
      
temp.savedChar.loadVarsFromArray( temp.clientVars );

      for ( 
temp.theseVars: temp.savedChar.getDynamicVarNames() )
      {
          
temp.savedChar.( @ temp.theseVars ) = makevar( "temp.savedChar." @ temp.theseVars );
      }
    
      
temp.savedChar.charLevel = this.level.name;
      
temp.savedChar.charXPos = this.y;
      
temp.savedChar.charYPos = this.x;

      
temp.savedChar.saveVars( temp.filePath, 0 );
    }
    else
    {
      echo ( 
"***Mud Control: Character does not exist! Character must exist before saving!" );
    }
  }
  else
  {
    echo ( 
"***Mud Control: Invalid character ID! Character could not be saved!" );
  }
} 

Code's up that a-way ^ !

Now the problem I am having is this, I preset a var named "mudaccount" in a different function and it saves it into the text file perfectly fine listing the Admin-Playerworld145 account as the mudaccount (account I'm testing with ).

But, when I use the above function it seems to overwrite mudaccount and make it equal 1. I've tried using the append function as well but that doesn't help.


Anyone see an issue?
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote