Please sign in to comment.
[Script System] Support parsing errors better; fix observer error; ot…
…her fixes - The script system should now more efficiently and correctly deal with the Script dictionary for every script. * The Script dictionary for each script is kept available to the bot in all cases by keeping a reference to it. * The reference should provide faster access to Script dictionary values. * IsScriptEnabled() and the ability to track script enabled is now stored in Script("Enabled"). This should keep the state of the bot more in sync. It now requires a reload script to re-read the "Enabled" value from Scripts.ini. Before it was possible to set the INI and have the bot start/stop sending loaded scripts event calls without the UI updating or the load/close events firing. * IsScriptModuleEnabled() is used in some cases instead of IsScriptEnabled(). It does the same thing but takes a script module directly, rather than finding the module by name in many cases where it was unnecessary to do so multiple times. * IsScriptEnabledSetting() is used when loading scripts (during parsing and SC_Error during load) to check the setting in the INI. - Fix error when using commands with script observers present. - The script system is now more robust when dealing with enabled scripts with parsing errors. If a parsing error occurs: * The Script dictionary is still available to the bot. See "is enabled" talk above. * Script("Name") is set to a temporary name created from the file name. * Script("LoadError") is set to True. * The error message is displayed to screen if the cleaned file name is not set to Enabled=False in Scripts.ini. * Commands and the rest of the bot will react to it in different ways: /enable and /disable list the script as it is in the settings Script menus list the script as it is in the settings /enable will warn that a parsing error occurred and that it won't function until that is fixed /scripts lists the script as disabled /scriptdetail lists the script with the text "(parse error)" if enabled in settings /initperf, further script events, and other interactions treat the script as disabled This design is so that reloading scripts after fixing the error leads to intuitive behavior of the script still being on. It also fixes an issue where enabled scripts may have not been showing their parsing errors at any time since SC_Error considered it disabled before. - Loading scripts and the /scripts command now list an enabled and total count. - /exec should now be given access to objects such as SSC and BotVars when DisableScripts is set. - AllowUI should now be disabled properly if it changes to be on reload script. - RunInAll() uses the module metadata to check if an event exists before calling it. - Fix oversight where script form menus weren't being disposed in .DestroyObjs(). - Fix issue where script form RichTextBoxes would have DisableURLDetect() called on them on .ClearObjs() instead of .DestroyObjs().
- Loading branch information...
Showing with 275 additions and 173 deletions.
Oops, something went wrong.