Forum Mod Bakery Docs

SHAR Script Helper - v1.4 (Released 2021-02-27)

Please login to contribute to the conversation.
@Yzma approached me with this idea on the SHAR Crash Analyzer thread, so here it is.

What is it?

This is a text editor built specifically for MFK/CON scripts. The aim is to make modifying scripts a less-daunting task, as well as provide useful features that a standard text editor wouldn't.

Features

  • Syntax Highlighting - Using a Lexer based off of the game's code itself, the editor applies Syntax Highlighting in real-time. This makes it easier to edit, and is nicer to look at than black on white.
  • Functions Toolbox - Built into the application, but modifiable after first launch, is a list of every valid function from MFK and CON scripts, including Additional Script Functionality.
    • Sorted into categories. These can be refined after first launch by editing the settings.
    • Double clicking a function name will bring up a dialogue window with all the parameters (with names if known), as well as if they're required or not.
    • If a parameter has set/common values, there will be a drop-down box in the dialogue window.
    • Clicking OK in the dialogue window will insert the chosen function, with the entered parameters, into the current position in the current file.
  • Script Validator - Runs the current file through the aforementioned Lexer, and returns and invalid tokens and their position if found. Will also return a warning if any function names are unknown.
  • Templates - A template folder is created next to the settings file. Any files inside that folder will be loaded into a Template node in the Functions Toolbox. Double click a template to insert it into the current position in the current file.

How do I use it?

Download the below ZIP file, extract to a folder, and then double click the executable.
Screenshots

First Run


Add Function


Validate Script


Templates


Download

Changelog
  • v1.1 (Released 2021-02-12)
    • Fixed a bug when not running as admin and opening a file.
    • Fixed a bug where double clicking a drop down arrow in the functions toolbox could cause a function dialogue.
    • Added a right click menu, as well as Ctrl + W shortcut to close current tab.
  • v1.2 (Released 2021-02-18)
    • Added the Close MFK functions. To load these you need to do Tools > Reset Functions Toolbox.
    • Added a UI to manage functions.
    • Added an additional Tool Strip with the commonly used menu items.
    • Added Comment and Uncomment.
    • Added the following symbols to the Syntax Highlighter: "(", ")", "{", "}", "," and ";".
    • Added an Export As Game.Lua button to the File menu.
    • Added Go To Line option to Go To.
    • Made the text editor respect tab indentation.
    • Removed New Line After Insert in place of it being a permanent addition.
    • Added a prompt to update the function toolbox on the first launch of a new version.
    • Edit Undo to work on a delay system, rather than on every character.
  • v1.3 (Released 2021-02-18)
    • Fixed a bug where the text editor's right click menu never enabled the Cut/Copy/Delete buttons.
    • Fixed a bug where previously opened files loaded after a file opened with the application.
    • Fixed a bug where a directory was locked if application launched via a file.
    • Fixed a bug where the line numbers didn't respect wrapped lines.
    • Fixed a bug where inserting a function at the start of the file caused an unhandled exception.
    • Fixed a bug where Redo didn't work since the Undo delay system change.
    • Added block tab indentation.
    • Added Shift + Tab support.
    • Added global error handling.
    • Improved Syntax Highlighting.
  • v1.4 (Released 2021-02-27)
    • Added a check for argument length to the script validator. Now gives a warning if an argument is over 63 characters. If this is triggered, make sure to increase the argument in Custom Limits.
    • Added a Validate Scripts in Directory button. Will run every .mfk and .con file through the verifier, and throw back any errors.
    • Added the Filepath Helper. The aim of this is to assist with functions like LoadP3DFile.
      • Right click the Filepath Helper tab in order to add additional directories.
      • Your SHAR install will be included by default, pulled from the Mod Launcher.
      • For your mod, you should select the CustomFiles folder.
    • Made the Function Manager Editor accept tabs and new lines in the text editor.
    • Added Import/Export Functions.
    • Added the new SetWheelieOffsetX ASF function.
  • v1.5 (Unreleased)
    • Added a named IPC pipe to load newly opened files in the currently open process.
    • Fixed a bug where Export As Game.Lua did literally nothing.

EXE Virus Scan

Credits


Notes

  • All functions are saved locally at %appdata%\SHARScriptHelper\Settings.xml, so you can modify them if you wish. (App must be closed to edit).
  • Validate Script doesn't match things like AddObjective to a CloseObjective, only validates the formatting and known function names.
  • Currently doesn't support Lua scripts written with game.lua.
  • Any issues, questions or suggestions, let me know and I'll help where I can.

Thanks,
Josh
If anyone would like to build a template pack of useful snippets, I'm more than happy to link them in the main post.

Thanks,
Josh
v1.2 (Released 2021-02-18)
  • Added the Close MFK functions. To load these you need to do Tools > Reset Functions Toolbox.
  • Added a UI to manage functions.
  • Added an additional Tool Strip with the commonly used menu items.
  • Added Comment and Uncomment.
  • Added the following symbols to the Syntax Highlighter: "(", ")", "{", "}", "," and ";".
  • Added an Export As Game.Lua button to the File menu.
  • Added Go To Line option to Go To.
  • Made the text editor respect tab indentation.
  • Removed New Line After Insert in place of it being a permanent addition.
  • Added a prompt to update the function toolbox on the first launch of a new version.
  • Edit Undo to work on a delay system, rather than on every character.
Apologies for the double release - too many bugs fixed to delay it though:
v1.3 (Released 2021-02-18)
  • Fixed a bug where the text editor's right click menu never enabled the Cut/Copy/Delete buttons.
  • Fixed a bug where previously opened files loaded after a file opened with the application.
  • Fixed a bug where a directory was locked if application launched via a file.
  • Fixed a bug where the line numbers didn't respect wrapped lines.
  • Fixed a bug where inserting a function at the start of the file caused an unhandled exception.
  • Fixed a bug where Redo didn't work since the Undo delay system change.
  • Added block tab indentation.
  • Added Shift + Tab support.
  • Added global error handling.
  • Improved Syntax Highlighting.
v1.4 (Released 2021-02-27)
  • Added a check for argument length to the script validator. Now gives a warning if an argument is over 63 characters. If this is triggered, make sure to increase the argument in Custom Limits.
  • Added a Validate Scripts in Directory button. Will run every .mfk and .con file through the verifier, and throw back any errors.
  • Added the Filepath Helper. The aim of this is to assist with functions like LoadP3DFile.
    • Right click the Filepath Helper tab in order to add additional directories.
    • Your SHAR install will be included by default, pulled from the Mod Launcher.
    • For your mod, you should select the CustomFiles folder.
  • Made the Function Manager Editor accept tabs and new lines in the text editor.
  • Added Import/Export Functions.
  • Added the new SetWheelieOffsetX ASF function.