derpy's script loader
derpy's script loader (DSL) is a script loader for Bully: Scholarship Edition (PC).
It can be downloaded here, and installation is covered by the included readme.txt.
Here are a few of the things that DSL excels at doing, and how they help the overall modding process.
- Load scripts directly from a folder with the simple loading system, or even from a zip archive.
- Skip compiling as Lua's parser is now patched in, letting scripts run from source.
- Unlimited amount of scripts thanks to a custom script manager that still emulates game script objects.
- Access the full Lua standard library, but stay safe with optional system security settings.
- Group scripts together into script collections that can be started, stopped, and restarted on the fly while playing.
- Save and load an arbitrary amount of lua data in actual save game files for any large projects.
- Stop guessing what went wrong with your script, and just see it in a nice convenient console with detailed error reporting.
- Register scriptable commands that can be used with the console to do anything you want... on command!
- Use the custom per-frame renderer that gives you a huge amount of powerful lower-level drawing functions.
- Run scripts earlier than normally possible with conventional STimeCycle.lur replacements, or even on the main menu.
- Replace and register new localized text entries, letting you print any text you want anywhere you want.
- Hook into base game scripts with ease using events that callback your code as soon as a native script loads.
- Use a large majority of new DSL functionality from base game scripts if you need to replace normal scripts.
- Take advantage of more new functions that are too numerous to list here!
Getting Started
Use the navigation bar on the left if you are looking for DSL functions.
All mods that you make or install with DSL are put in the _derpy_script_loader/scripts folder,
and are technically called script collections.
If you don't know much about script modding yet but want to get started, check out the tutorial.
If you already know how to script mod but are new to DSL, the quickest way to learn is to just make a new file in DSL's scripts folder and call it something like mymod.lua. Open it in your favorite editor, and make a script like you normally would with a MissionSetup, main, and MissionCleanup function. Unlike replacing a built-in script like ArcRace1.lur, your script will run as soon as the game starts. It is for this reason that you will need to wait for SystemIsReady to return true before doing most things to avoid any crashes. For the most part, it should be just like making a STimeCycle.lur mod. Unlike normal scripting you will not need to compile your script, just start the game! Open the console (using ~ by default) to see if you got any errors, and type /restart mymod.lua to restart your script.
Version History
DSL versions are designated by a single number that goes up every time there is an update. This is so there is no disparity between the version numbers used for naming and used for version checking. Before version 4, the versions were called "alpha" because the naming scheme was not very well thought out. Just because the word alpha has been dropped for version names, doesn't mean this mod isn't still extremely experimental. It just means the naming scheme is going to be simpler moving forward.
pre-alpha (0)
- Pre-alpha versions were only shared between a tight group of testers, and are only listed here for the sake of completeness.
alpha 1
- 82 total functions.
- The first public release.
alpha 2
- 87 total functions.
- Temporarily added allow_mouse to loader config, so that mouse-related issues can be narrowed down and reported by those who have problems.
- Added SetTextBold, SetTextItalic, SetTextClipping, PopTextFormatting, and DrawTextInline.
alpha 3
- 90 total functions.
- Scripts do not shutdown when main returns anymore, as this design seems better.
- There is a package system now so anyone can neatly add C functions to use in lua if system access is on.
- Config is generated instead of released with updates so that updating is a simple drag/drop/replace.
- The loadlib function is now allowed when system access is turned on in config.
- DrawTextInline can now draw "directly" instead of only allowing one text at a time per-style.
- DrawTextInline doesn't round down duration and the texture alpha has been fixed.
- DrawTextInline preserves formatting on new lines.
- DrawTexture2 can draw a centered texture with optional rotation.
- IsGamePaused returns true if the game is paused.
- GetPackageFilePath returns a file name relative to the "packages" directory.
- SetTextFormatting can take a style number like the ones given to DrawTextInline.
- Other small fixes too minor to list.
version 4
- 130 total functions.
- Added an event system, providing scripts with a way to influence game behavior and trigger their own events.
- Argument checking is a little more strict to help the debugging process rather than just taking bad values.
- Collections can now be installed as a zip archive by simply putting a zip with the mod files into the scripts folder.
- Collections have their own config files where custom settings, requirements, or script names can be specified.
- Commands can now have help text associated with them.
- Console output has been improved, such as now showing the collection and thread names in errors.
- Countless major under-the-hood changes to generally improve DSL.
- Direct input keyboard scan codes are now used instead of virtual key codes.
- Dynamic textures were introduced, allowing you to do things like draw the game's current back buffer onto a texture to draw later.
- ImportScript is now supported in a way that mimics the base game, allowing you to import scripts from Scripts.img into your script.
- Improved the way normal script objects are emulated to be more accurate.
- Inline text now has an optional width argument that goes before the text.
- Localized text can now be replaced with new text, and new text entries can be registered.
- More thread types were made for improved control with rendering functions.
- Patched the custom save data system heavily, as it was pretty broken before.
- Persistent data tables have been added as a way for scripts to store information in between DSL resets.
- Pre-init scripts are now a thing, allowing you to run scripts much earlier than normal even if in a limited way.
- Render cache functions now draw before camera fade is applied, but this can be scripted using the new draw layer system.
- Significant additions to the library of script functions, and many improvements to already existing ones.
- Standard file input / output functions have been added for a safer alternative to allowing full system access.
- Smaller things that are too numerous to list fully here.
version 5
- 183 total functions.
- The server version has been released, allowing players to connect to it and communicate through scripted events.
- More local events have been added that offer scripts greater control over the game.
- A new global function hook and replacement system has been created.
- More input functions have been added to modify controller state.
- A significant amount of small changes and patches.