I've made a bunch of custom macros and systems for SugarCube for my own games and for practice, and figured I might as well throw them up on the internet for others to use. The hardest part of doing that was painstakingly documenting and testing everything, but now that that's finished, I think I've whipped up a pretty nice set of scripts here.
Custom Macro Collection
A pretty large collection of macros and systems. Includes:
- Simple Inventory: Just a real basic array-based inventory. Nothing crazy, but I tried to make is easy to understand and implement/extend.
- Cycles System: My pride and joy. Allows you to define 'cycles,' which can be anything from day/night, to days of the week, to turns in a strategy game. You define a cycle, give it a number of values, and tell it how often you want it to change, and you can use a large collection of macros, functions, and passage tags to fine-tune everything. You can have any number of cycles running simultaneously, but I did notice a performance hit when I stress-tested it with around 50 going at once, so be reasonable.
- Play Time: Just a simple little script and associated macro for tracking play time in hours:minutes:seconds, like in a video game.
- Fading Macros: Macros for fading text or other elements in and out. A bit easier to implement than CSS or jQuery if you're only after a simple fade. You can set the length of the animation and an optional delay.
- Dialog API Macros: I got sick of writing it all out with the script macros and such, so I wrote two macros to automate the process.
- First Macro: A macro I wrote in response to a question over on the Q&A that works as a replacement for <<if visited()>> and <<switch visited()>>, and kind of works like Leon's <<once>> macro. Not necessary, but I started using it myself and figured I'd include it.
- Message Macro: One of my first macros; I needed assistance from TME to complete it, which he graciously gave. Creates a link that shows and hides it's content on the next line; basically a toggle-able <<linkappend>>.
I also made a volume control slider macro, which controls SugarCube's audio macro volume in real-time. It can be found here
. And I made a script for activating links and buttons on key press, an updated version of something I posted a few months ago--it can be found here
Anyway, I went back and forth on whether I should post this stuff, but ultimately, with this forum closing down in a few weeks, I just went for it. I am not a great programmer--there are almost certainly bugs, head-scratching decisions, and other issues, and I'm grateful for feedback on any weirdness you see.