Quote:
Originally Posted by Chandler
Any reason why it isn't storing the array correctly? it should just save the "temp.newData" part as an array, however it refuses to do so! Any suggestions?
HTML Code:
function onCreated()
{
this.itemName = "Black Sword";
this.itemDescription = "This great sword, once held by the almighty Chandler!";
this.itemImage = "block.png";
this.itemPrice = 300000;
this.weaponName = "+Sword";
this.causeEffect = {{"Poison", "Ice", "Fire"}, {100, 75, 75}};
for (temp.itemData: getstringkeys("this."))
temp.itemData.add(temp.itemData @"="@ makevar(@"this."@ temp.itemData));
temp.newData = new TGraalVar();
makevar(@"temp.newData.item-"@ this.itemName) = temp.itemData;
temp.newData.savevars("itemData/newItem.arc", 0);
}
|
Right here:
HTML Code:
for (temp.itemData: getstringkeys("this."))
temp.itemData.add(temp.itemData @"="@ makevar(@"this."@ temp.itemData));
You might want to change this to something like:
HTML Code:
for (temp.data: getstringkeys("this."))
temp.itemData.add(temp.data @"="@ makevar(@"this."@ temp.data));
Using the same name as the variable in the foreach and as the variable you're adding too will not work as expected.
Changing to that makes this file on the server for me:
HTML Code:
item-Black Sword="causeEffect=""Poison,Ice,Fire"",""100,75,75""","itemDescription=This great sword, once held by the almighty Chandler!",itemImage=block.png,"itemName=Black Sword",itemPrice=300000,weaponName=+Sword
joinedclasses=
scriptlogmissingfunctions=false
timeout=0