Author Topic: Reload script with keybind?  (Read 1141 times)

Because my in-game console is broken I need something else to reload my script. What would I need to type in the console to bind the key "G" to reload a specified script?

Is this client or server sided?

Server sided but I am developing it in single player of course.

oh wait so this can't be a script?

you can use the winconsole instead.

Or if you still want to...
Code: [Select]
$scriptPath = "Config/Script.cs";

$remapDivision[$remapCount] = "Script Reload";
$remapName[$remapCount] = "Reload";
$remapCmd[$remapCount] = "reloadScript";
$remapCount++;

function reloadScript()
{
      exec($scriptPath);
}

Code: [Select]
===Client===
$remapDivision[$remapCount] = "Reloading";
$remapName[$remapCount] = "Reload";
$remapCmd[$remapCount] = "Reloadcommand";
$remapCount++;

function Reloadcommand(%val)
{
if(%val)
{
commandtoserver('Reload',"");
}
}
===Server===
function servercmdreload(%client)
{
<stuff here>
}
Something like this?

i'd suggest making it be a server command, like /light, that way people don't need a client sided addon to use it

i'd suggest making it be a server command, like /light, that way people don't need a client sided addon to use it
You could use my way if they don't have the client addon they can type /reload

true, but it's probably easier to just use an already existing keybind

I'll test those scripts when I have time. It's for my own personal use only.

If you want it sweet and simple you could just do this:
Code: [Select]
MoveMap.bindCmd("Keyboard", "G", "discoverFile(\"Add-Ons/YourZipFile.zip\"); exec(\"Add-Ons/YourZipFile/server.cs\");", "");

Shameless self advertising

http://forum.returntoblockland.com/dlm/viewFile.php?id=3499

This mod lets you paste your script into it and it executes it automatically for you.

If you edit it, it will reload the script when you click save.

If you want it sweet and simple you could just do this:
Code: [Select]
MoveMap.bindCmd("Keyboard", "G", "discoverFile(\"Add-Ons/YourZipFile.zip\"); exec(\"Add-Ons/YourZipFile/server.cs\");", "");
Amade saves the day! It works just like I want it to. Thank you. This helps me a lot. I just jammed it to the end of config.cs in the config folder.