Blockland Forums > Modification Help
Weird syntax errors
(1/3) > >>
DYLANzzz:
Whenever I try to execute an addon from the game (I updated it and want to reload it without restarting the server) I do an exec(add-ons/bleh/server.cs);

It tells me I have a syntax error in the weirdest of places.
It would say something like

--- Code: --- Executing Add-Ons/Gamemode_Deathrun/Gamemode_Deathrun.cs.
% Add-Ons/Gamemode_Deathrun/Gamemode_Deathrun.cs Line: 503 - Syntax error.
% >>> Some error context, with ## on sides of error halt:
% ^^if(%client.tdmteam==1 && isObject(%client.minigame) && !%client.minigame.tdmModeRule[5])
^^{
^^^messageClient(%client, '', "\c0You can't Self Delete as a death.");
^^^return;
^^}
^^else if(%client.tdmteam==0 && isObject(%client.minigame) && !%client.minigame.tdmModeRule[6])
^^{
^^^messageClient(%client, '', "\c0You can't s##
% >>> Error report complete.
--- End code ---
Greek2me:
When that happens I just restart.

But the proper way to reload something in a zip file would be
--- Code: ---discoverFile("add-ons/your_addon.zip"); exec("add-ons/your_addon/server.cs");
--- End code ---
MegaScientifical:
Just to clarify, I believe this has to do with the game keeping record of how the .zip is composed. Since you changed it a bunch, it no longer recognizes the file, so it gives an error where it's trying to stop reading. That's why discover works: it re-records the file.
Greek2me:

--- Quote from: MegaScientifical on July 10, 2011, 08:34:38 PM ---Just to clarify, I believe this has to do with the game keeping record of how the .zip is composed. Since you changed it a bunch, it no longer recognizes the file, so it gives an error where it's trying to stop reading. That's why discover works: it re-records the file.

--- End quote ---
Yep

Also, it's best to not zip your addons when you're working on them. I put all my WIP scripts in base, then I put a server.cs in Add-ons that loads the files in base.
MegaScientifical:

--- Quote from: Greek2me on July 10, 2011, 09:59:37 PM ---Yep

Also, it's best to not zip your addons when you're working on them. I put all my WIP scripts in base, then I put a server.cs in Add-ons that loads the files in base.

--- End quote ---


--- Code: ---function addDefaultDirectory(%dir) {
if(isDefaultDirectory(%dir))
return;
setModPaths(getModPaths() @ ";" @ %dir);
}

function isDefaultDirectory(%dir) {
%path = strReplace(getModPaths(),";","\t");
for(%i = 0; %i < getFieldCount(%path); %i++)
if(getField(%path, %i) $= %dir)
return true;
return false;
}
--- End code ---

addDefaultDirectory("Personal");

Make a folder named Personal in the main Blockland directory, and then you aren't risking doing anything stupid in base. :o
Navigation
Message Index
Next page

Go to full version