so I found out recently that mudlet doesn't actually turn off scripts even if you click em off our use an alias/trigger via disableScript("Blahblah") and I know it's not turning off the script because several others stop functioning properly when I have it on or off..so does anyone know how to actually fix this or a work around? Because it breaking my offense stuff really sucks
Comments
An easy workaround is to create a boolean variable that's set to false to disable the scripts. At the beginning of each script you want to disable do the following check:
if turnOffScript then
return
end
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
I've never tried but disabling it might be enough if it's an event handler. The function would still exist but probably wouldn't be called.
Results of disembowel testing | Knight limb counter | GMCP AB files
Whereas 2 functions/variables (functions are saved in variables in lua as well) with the same name (or saving a script with unchanged function and variables) overwrite each other.
You could also delete the script with the unneeded function, if there are no other things in it.
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
insert real function stuff here
end
Create a new function below it that has a blank script.
function functionName()
end
Or disable and restart.
A function definition in a script isn't the function itself. Think of it like a recipe - if you've already cooked the meal, throwing away the recipe doesn't get rid of the dish.
What a script does is just run a bunch of code whenever you start Mudlet or save the script. That's it.
So if you have a script that defines a function, you save it or start Mudlet and it runs the script, creating the function. That function is now a thing - it lives somewhat invisibly in Mudlet. Disabling the script won't disable the function because the script doesn't contain the function, only the instructions for how to create the function, which has already happened.
If you restart Mudlet with the script disabled, the function won't get created in the first place. Alternatively, if you do functionName = nil and save the script again, it'll also get rid of it (at which point you can just remove all references of it from the script and resave).
You can use a boolean (a true/false) if you really want to use the same name for your functions, but the sensible solution is probably just to give them different names and then restart Mudlet.