SCriPt v0.2.0
Pre-release
Pre-release
New Custom Commands
- Added a way to create custom commands through Lua scripts.
- Works with RemoteAdmin and client console commands
- Commands are registered with the server, and work with auto-complete and help command.
- See docs for information on making your first command
- Commands are created as separate scripts in the
Scripts/Commands/directory
New Custom Config
- Lua scripts can now call the 'Config' global to save and load values to a json config file to allow for script customization without modifying the original code.
- Example:
-
spawn_chance = Config:Load("BaseSpawnChance", 25)
- Will return the default value of 25 if the value is not saved already and add it to the file, subsequent calls to the load function will return the value saved to disk
-
- Config values saved to
Scripts/Data/config.jsonin 1 file.
New Persistent Storage
- Lua scripts can now store and recall data between loads
- Similar to Config system but with read and write, and more complex data types.
- Example:
-
stored = Store:Load('my_data',${ default=0 })
- Loads a table "my_data" from storage.
- If the table does not exist, it will populate with the provided second argument, if no argument is provided an empty table is created.
- Table must follow "Prime Table" requirements
- Can only contain: Numbers, Strings, Booleans, and other Prime Tables
-
- Tables are stored in
Scripts/Data/store.json, but are meant to be accessed in code only.
Improved Coroutines
Timingglobal object is now context aware of what script it is running in.- When a script is unloaded, all MEC coroutines that it created are automatically killed.
Improved Logging
- Using the
print()function in Lua will now include the script's name in the console output, so you know which script is talking. - Old
[Lua] Message - New
[Lua-Scripts/Folder/Name.lua] Message
Testing Pastebin Scripts
- Added a
Pastebinglobal function to scripts - Calling with the the parameter of a script file saved to pastebin, the last part of the url, it will load and run the script.
- Pastebin scripts cannot be ran if configs are set more permissive than the default. Limited|SoftSandbox
- "allow_pastebin" config option must also be set to true, leaving false by default.
- In an empty lua file just call
Pastebin('xxxxxxxx')directly and it will execute the code located there on load. - The location of this file will determine when it is executed.
- Scripts on Pastebin will also not be executed if they attempt to call another pastebin script.
New
- Patched to EXILED OFFICIAL 8.11.0
- Added Scp939 event PlayingFootstep
- New properties on existing events automatically apply to scripts
- New command
script reload- Will unload all scripts, then load AutoLoad scripts again.
- Added globals to create structs such as Color, Vector3, and Quaternions inside Lua directly.
- Updated API to allow access to Scripts' Config and Store data objects through their PluginConnector
- Updated Docs to reference new features above