Author Topic: What command activates addons in a dedicated server?  (Read 1130 times)

Yeah, what command activates a specific addon in a dedicated server

You mean to execute an add-on?

This step if you just added or updated the add-on:
Code: [Select]
discoverFile("add-ons/addon_name/server.cs");
Then:
Code: [Select]
exec("add-ons/addon_name/server.cs");

sorry, not working.
Its a weapon. Its musket,
so what commands?
I tried
Quote
weapon_musket
Quote
musket
Quote
weapon_musket.zip
Quote
musket.zip

weapon_musket would be its name, however for anything that has datablocks -- weapons, vehicles, items, projectiles and particles -- you need to do this last:

Code: [Select]
transmitDatablocks();This updates datablocks for clients; sorry for forgetting that.

Let me be clearer with the need for "discoverFile": if the file was there when the server was started, or if it wasn't changed since the server started, you don't need to use "discoverFile".

Could you post the commands that it would need?
Like so I could copy/paste 'em

Could you post the commands that it would need?
Like so I could copy/paste 'em
Situational (read above):
Code: [Select]
discoverFile("add-ons/weapon_musket.zip");
Always needed:
Code: [Select]
exec("add-ons/weapon_musket/server.cs");
transmitDatablocks();



I made a mistake with discoverFile a few posts up, excuse me for that. "Discovering" the file tells Blockland to treat the files of the ZIP as if it were a folder, and also to update them if the ZIP if they were changed.

Thanks Kalphiter!

This will make fine tuning addons alot easier.

Thanks Kalphiter!

This will make fine tuning addons alot easier.
Another trick you should know is the "journal" argument for execution. It's done by adding a 1 in the "exec" function. By using it, you can update functions and variables without any functions in the script actually running. I'll also demonstrate how it works with code.

Code: [Select]
$lolvariable = 9001;
function lolfunction()
{
    echo("noodles");
}

lolfunction();



Code: [Select]
exec("thefile.cs");
$lolvariables is set to 9001
The function "lolfunction" will be changed if it's different
"noodles" is printed



Code: [Select]
exec("thefile.cs", 1);$lolvariables is set to 9001
The function "lolfunction" will be changed if it's different
"noodles" is not printed

You mean to execute an add-on?
This step if you just added or updated the add-on:
Code: [Select]
discoverFile("add-ons/addon_name/server.cs");

dammit thanks, Kalph, I didn't even know that existed.

dammit thanks, Kalph, I didn't even know that existed.
there's also
Code: [Select]
setModPaths(getModPaths();which will essentially do discoverFile for every add-on it can find

useful if you're enabling/changing a lot of add-ons at once (or are just lazy)


I tried doing this on some bricks, in the console it said they executed but I didn't see them in the brick menu!
It did enable though.

I tried doing this on some bricks, in the console it said they executed but I didn't see them in the brick menu!
It did enable though.
Some add-ons don't work when exec'd manually like that.

Some add-ons don't work when exec'd manually like that.
It was Brick_InvertedCorners im guessing that doesnt work :/