I've heard of this problem before but I've never actually had to deal with this before until now; I have a mudlib that I'm creating and I'm having problems transferring the info from the server to the client.
I've tried a couple ways to get around this: setting the object as a player.attr which didn't work. I've tried saving the object vars to an array and transfering the array, but for some reason that didn't work either, maybe it was something wrong with my coding.
This is my function which returns a player's mud file:
PHP Code:
public function loadMudFile( acct ) {
temp.e.loadvars( getAccountPath(acct) );
for ( temp.i : e.getDynamicVarNames() ) {
if ( i.tokenize("_")[2] > 9999 || i.starts("spells_") ) {
temp.objnum++;
makevar( "temp.obj" @ objnum ) = new TStaticVar();
makevar( "temp.obj" @ objnum ).loadvarsfromarray(e.( @ i ));
temp.("obj" @ objnum).add( temp.playeritems );
}
}
temp.e = new TStaticVar();
for ( temp.i=1; temp.i<=objnum; temp.i++ ) {
makevar( "temp.e.item" @ i ) = makevar( "temp.obj" @ i );
}
return e;
}
So it loads each item into a tstaticvar, then creates a tstaticvar that holds each item as a subvariable. So to return an item stat I can say:
PHP Code:
temp.items = loadMudFile( player );
echo( items.item1.displayname );
echo( items.item4.range );
The problem like I said is just taking the info and getting it to the clientside. To do that I tried this:
PHP Code:
temp.items = loadMudFile( player.account );
for ( temp.i : items.getDynamicVarNames() ) {
temp.objnum++;
makevar( "temp.arry" @ objnum ) = makevar( "temp.items." @ i ).savevarstoarray(0);
temp.("arry" @ objnum).add( temp.itemxfer );
echo( temp.("arry" @ objnum) );
}
triggerClient( "gui" , name , "pullMUDclientside" itemxfer );
savevarstoarray is woking just fine. But when I take the arrays and add them into itemxfer, the info just seems to get lost. If anyone has any ideas on what's wrong or a better way to do it that'd be great
