Quote:
Originally Posted by Chompy
Hmm, ok
One last question: can I set a member directly? Since when I load a member
by using obj.loadvars() it appears as an array, like if I did echo( arcnames[ 0]) it would return the first member, so.. Can I set it directly?
PHP Code:
object.arcnames[ 0] = "foo";
This is for the ammount stuff, to change an current ammount of an arc
|
You could make a function for it.. player.changeArc( arc, positive or negative ammount);
and then:
PHP Code:
public function changeArc( arc, mod) {
obj = new TStaticVar();
obj.loadVars( "bladiebla/blabla/file.arc");
temp.a_index = obj.arcnames.index( arc);
temp.a_current = obj[ temp.a_index].ammounts;
temp.a_new = ( mod.substring( 0, 1) == "-") ? temp.a_current - mod.substring( 1) : temp.a_current + mod;
obj[ temp.a_index].ammounts = temp.a_new;
obj.saveVars( "bladiebla/blabla/file.arc", 0);
}
Oh and add 'sendToRC( "/refreshfilelist");' after every function by the way, so it updates the file browser also.