Author Topic: Coding Help - Addon Not Working  (Read 1646 times)

I do edit it in a regular folder then compress it. I don't understand because the ActivatePackage(AutoRank); is there so I dont know why it cant read it.

Blockland doesn't realize the file size changed inside the zip, you added 4 new characters so it missed the last 4 instead.

If you really want to work with the files in a zip, you'll need to run setModPaths(getModPaths()); every time before you execute it again.

The package is activated but its still not working for some reason

Remove these 2 lines:

      if(!isObject(%cl = %this.client)) //Don't do this without a client, kind of silly
         return;


%this is already the client.

Then change all the %cl to %this.

Just a friendly tip if you decide to release this when you're done developing it. Adding chat messages to clients when they join announcing that the server is running a particular mod tends to make the perceived quality of the server lower, so I suggest not doing that.

If you want to have accessible credit to your work in the code, perhaps consider doing what I did for TotalRPG. Make a non-interfering package for a /credits command. The way this is structured allows for multiple running mods to have a spot in the /credits command without overwriting each other.


// Modifying or removing this package voids your warranty.
package TotalRPGCreditsPackage
{
   function serverCmdCredits(%client)
   {
      %client.chatMessage("\c6The TotalRPG Events mod was coded entirely by \c4Pecon7 \c6(9643)");
      parent::serverCmdCredits(%client);
   }
};
activatePackage(TotalRPGCreditsPackage);

if(isFunction(serverCmdCredits))
   return;

function serverCmdCredits(%client){}


This has to be done at the end of the file or else things after it could potentially not be executed. It has to be structured this way because torque will throw a fit if you put a function declaration into an if statement, so instead I terminate the execution before the declaration if the declaration shouldn't be made.

Oops, I forgot to mention that if you change the condition to "$=" then you'll need to change the value you're checking it against should be "1" instead of 1. Still not sure if this will fully fix your problem though.

I figured out why it wasn't working. The path to the txt file was config/sever/....... and I changed it to server and it worked. silly mistake on my part.