Author Topic: Testing Add-On in-game  (Read 2329 times)

First of all, I wasn't sure whether to put this in Coding Help, or the normal Help section, so I went with my first decision.

Now on to my question. I know there is a way to test your Add-Ons in-game, and I know that you use this:

function reexecGun(){exec("Add-Ons/Weapon_Gun/server.cs");}

to do it. But, what I'm wondering is, what in that line of code do I change? I have a general idea of what to change, I just want to be sure. I already tried entering this in my console (modified to fit my Add-On, of course), but when I pressed Enter, it said "Syntax error in input." I know what that means, I'm just wondering what I did wrong and how I can fix it. Thanks.

It may not be an actual Syntax error, but the resource manager is unable to read the updated file properly due to the zip add-on system.
Solution (in the way you want it):
Code: [Select]
function reexecGun(){discoverFile("Add-ons/Weapon_Gun.zip");e(Weapon_Gun);}Or even better:
Code: [Select]
function reExec(%mod){discoverFile("Add-ons/"@ %mod @ ".zip");e(%mod);}
Of course you don't put these in script files, this is meant for console use.

Okay, sweet, and:
Code: [Select]
function reExec(%mod){discoverFile("Add-ons/"@ %mod @ ".zip");e(%mod);}

For that one (trying not to be a total idiot here), do I need to insert my Add-On anywhere in there? (i.e. Weapon_[my Add-On], does that need to be inserted anywhere in the second one?)

reExec(Weapon_Gun);
You do that after defining the function.
Example:

function reExec(%mod){discoverFile("Add-ons/"@ %mod @ ".zip");e(%mod);}
Change the gun and stuff...
reExec(Weapon_Gun);
Ding gun is executed normally.

Aha, I see. Cool, thanks so much, Chrono.

(Hopefully said Add-On will be posted soon... *crosses fingers*)

Don't you only need that if you're trying to put your Add-On in a zip file? You can just put your files in a folder named "Weapon_Gun" (or similar to yours, removing the zip file if there is one) and that will be treated as your Add-On's directory.

I did not know this... Now I do. *note to self...*
Thanks Space Guy.

EDIT: Didn't want to double-post, but I have another question. When I packaged the Add-On, placed it in Program Files/Blockland/Add-Ons, and started the game, it didn't appear in the Add-On list when I went to enable it. This puzzled me, so I investigated, and looked at the console.log to find that the Add-On was not executing because it failed to contain a description.txt file... But, it does contain a description.txt file. I know it does, I made it, and saved it to the folder before compressing it... So, why does it like to think that I don't have one?
« Last Edit: August 08, 2009, 03:23:30 AM by Kyzor »

Disable "hide known file extensions" in the Folder Options if it's on. Does your description.txt rename to "description.txt.txt"?

Disable "hide known file extensions" in the Folder Options if it's on. Does your description.txt rename to "description.txt.txt"?

I'll check to see if "hide known file extensions" is enabled, and no, I saved the file as "description" with the file path as .txt, but I didn't name it "description.txt", I named it "description".

Extremely sorry for the bump, but this is kinda important...

Turn "hide known file extensions" on.
Tell us the filename afterwards.

I did so, and it's still the same. .txt

And when I re-packaged the add-on, enabled it in the game, and launched the game, it still said the same thing about it not executing because of a missing description.txt file. Ugh.

Delete the description.txt file.
Copy one from one of the default Add-Ons into your own.
Edit that one.

Delete the description.txt file.
Copy one from one of the default Add-Ons into your own.
Edit that one.
Too lazy to make your own txt file!
COPY IT FROM OTHER stuff :D

I always do that :(

Infact, i start with the default gun on ALL of my addons.
I copy the zip, rename all the stuff... Then i start mah work.

I never copied an actual file for making a script. I just read and rip apart other scripts then put them in mine. :D