Author Topic: Everything Being Executed Twice [Solved]  (Read 1108 times)

So. I made a game mode, but when I start a server with it. Everything in GameMode.txt is being executed twice. I can't find out why.
« Last Edit: September 28, 2013, 03:06:20 PM by jes00 »

Does something in  "GameMode_DRPG" use local values in global scope?

Does something in  "GameMode_DRPG" use local values in global scope?
Here:
Code: [Select]
for(%file = findFirstFile("Add-Ons/GameMode_DRPG/content/*.cs"); isFile(%file); %file = findNextFile("Add-Ons/GameMode_DRPG/content/*.cs"))
{
exec(%file);
}
Here:
Code: [Select]
%e = forceRequiredAddOn("Brick_Large_Cubes");

if(%e == $Error::AddOn_NotFound)
{
return;
}
And here:
Code: [Select]
%price = (10 * $DRPG::Prefs::PriceMultiplier["tools"]) / 4;
drpgAddItem("BROKEN_BRONZE_AXE", "Broken Bronze Axe", "A broken bronze axe.\nCost" SPC %price SPC "plastic to fix.", 10 * $DRPG::Prefs::PriceMultiplier["tools"], "axe", bronzeAxeItem.colorShiftColor, "if(%client.hasPlastic(" @ %price @ ")){%client.removePlastic(" @ %price @ ");%client.removeItem(BROKEN_BRONZE_AXE);%client.addItem(BRONZE_AXE);}");

%price = (40 * $DRPG::Prefs::PriceMultiplier["tools"]) / 4;
drpgAddItem("DERMITE_AXE", "Dermite Axe", "A semi-weak tool for cutting down trees.", 40 * $DRPG::Prefs::PriceMultiplier["tools"], "axe", dermiteAxeItem);

%price = (160 * $DRPG::Prefs::PriceMultiplier["tools"]) / 4;
drpgAddItem("IRON_AXE", "Iron Axe", "A tool for cutting down trees.", 160 * $DRPG::Prefs::PriceMultiplier["tools"], "axe", ironAxeItem);

%price = (160 * $DRPG::Prefs::PriceMultiplier["tools"]) / 4;
drpgAddItem("STEEL_AXE", "Steel Axe", "A sharp tool for cutting down trees.", 160 * $DRPG::Prefs::PriceMultiplier["tools"], "axe", steelAxeItem);

%price = (220 * $DRPG::Prefs::PriceMultiplier["tools"]) / 4;
drpgAddItem("DESTINITE_AXE", "Destinite Axe", "A very sharp tool for cutting down trees.", 220 * $DRPG::Prefs::PriceMultiplier["tools"], "axe", destiniteAxeItem);

%price = (250 * $DRPG::Prefs::PriceMultiplier["tools"]) / 4;
drpgAddItem("BIRON_AXE", "Black Iron Axe", "An extremely sharp tool for cutting down trees.", 250 * $DRPG::Prefs::PriceMultiplier["tools"], "axe", bironAxeItem);

You should literally never do that, no matter what the use case of it might be.
Move that to a function and call it.

You should literally never do that, no matter what the use case of it might be.
Move that to a function and call it.
I'll just use global variables instead. Thanks.

Hmm. I did that. But everything still executes twice.
« Last Edit: September 26, 2013, 10:53:51 AM by jes00 »

Post your console log. Do you have Client_SaveEnvironment?

Post your console log. Do you have Client_SaveEnvironment?
Nope. I don't have that mod.

The Loading Add Ons bar even fills up twice when I start the server.

Yes, you have a mod that is modifying the %i variable in the global scope.

Yes, you have a mod that is modifying the %i variable in the global scope.
After a while of tracking down I finally found it and fixed it :)

Just posting this here to not make too many Coding Help topics.

What does this mean?

ShapeBaseImageData:: Could not resolve state "StopFire" for image "oakBowImage"
ShapeBaseImageData:: Could not resolve state "fire" for image "oakBowImage"
ShapeBaseImageData:: Could not resolve state "StopFire" for image "willowBowImage"
ShapeBaseImageData:: Could not resolve state "fire" for image "willowBowImage"
ShapeBaseImageData:: Could not resolve state "StopFire" for image "mapleBowImage"
ShapeBaseImageData:: Could not resolve state "fire" for image "mapleBowImage"
ShapeBaseImageData:: Could not resolve state "StopFire" for image "yewBowImage"
ShapeBaseImageData:: Could not resolve state "fire" for image "yewBowImage"
ShapeBaseImageData:: Could not resolve state "StopFire" for image "moonwellBowImage"
ShapeBaseImageData:: Could not resolve state "fire" for image "moonwellBowImage"
ShapeBaseImageData:: Could not resolve state "activate" for image "bronzeBlunderbussImage"
ShapeBaseImageData:: Could not resolve state "activate" for image "dermiteBlunderbussImage"
ShapeBaseImageData:: Could not resolve state "activate" for image "ironBlunderbussImage"
ShapeBaseImageData:: Could not resolve state "activate" for image "steelBlunderbussImage"
ShapeBaseImageData:: Could not resolve state "activate" for image "destiniteBlunderbussImage"