Heres a brain buster for you peeps..When ScriptObjects Attack
by Brandon Beauchene · in Technical Issues · 04/19/2006 (8:11 pm) · 1 replies
Ok heres my dilema, i had something working, added to it without messing with original code, and now nothing works.
Basically Im creating a series of nested scriptObjects like so
$Player = new ScriptObject()
{
Name = " ";
totalClasses = 0;
...
Stats = new ScriptObject()
{
strScore = 0;
dexScore = 0;
....
};
ClassList = new ScriptObject()
{
ClassName =" ";
ClassLevel = 0;
...
};
....
};
now it is alot bigger than this but plz humor me.
Ok so i have a gui that has a series of GuiTextCtrl objects that show various stats and im using
strScore.setText($Player.Stats.strScore);
to show the stats. the stats are randomly rolled and you can assign 6/7 rolls to the 6 stats.
all this was working
now that i added ClassList to the $Player object the stats no longer assign
was using
$Roll1-$Roll7 are the random rolls
i have the7 rolls placed in 7 checkboxes in group 1, and the 6 stats on 6 checkboxes in group 2 (using radiobutton type)
so only 1 of each list can be selected andwhen you have 1 of each selected and click assign it does this
...
..
eventually %Roll is the roll NUMBER (1-7) of the selected box (not the actual roll value)
and eventually %Stat is a 3 letter abrev. for the stat selected (str, dex, etc)
and i do this
eval("$Player.Stats."@%Stat@"Score = $Roll"@%Roll@";");
which breaks down to eval("$Player.Stats.strScore = $Roll2;"); if second roll selected and str is selected
this all worked fine until i added the additional ScriptObjects into my $Player now even if I type in
$Player.Stats.strScore = 1;
into the console, the value of the variable doesnt change
echoing it just shows an empty line.
any ideas?
Basically Im creating a series of nested scriptObjects like so
$Player = new ScriptObject()
{
Name = " ";
totalClasses = 0;
...
Stats = new ScriptObject()
{
strScore = 0;
dexScore = 0;
....
};
ClassList = new ScriptObject()
{
ClassName =" ";
ClassLevel = 0;
...
};
....
};
now it is alot bigger than this but plz humor me.
Ok so i have a gui that has a series of GuiTextCtrl objects that show various stats and im using
strScore.setText($Player.Stats.strScore);
to show the stats. the stats are randomly rolled and you can assign 6/7 rolls to the 6 stats.
all this was working
now that i added ClassList to the $Player object the stats no longer assign
was using
$Roll1-$Roll7 are the random rolls
i have the7 rolls placed in 7 checkboxes in group 1, and the 6 stats on 6 checkboxes in group 2 (using radiobutton type)
so only 1 of each list can be selected andwhen you have 1 of each selected and click assign it does this
...
..
eventually %Roll is the roll NUMBER (1-7) of the selected box (not the actual roll value)
and eventually %Stat is a 3 letter abrev. for the stat selected (str, dex, etc)
and i do this
eval("$Player.Stats."@%Stat@"Score = $Roll"@%Roll@";");
which breaks down to eval("$Player.Stats.strScore = $Roll2;"); if second roll selected and str is selected
this all worked fine until i added the additional ScriptObjects into my $Player now even if I type in
$Player.Stats.strScore = 1;
into the console, the value of the variable doesnt change
echoing it just shows an empty line.
any ideas?
About the author
Torque Owner Cinder Games
Sounds like somewhere a variable is getting nulled.
Right before the eval, have it echo all the local and global variables you're working with.