📗Creating Basic Ruleset
This page will help you create your very basic ruleset!
Rulesets are pretty important since they define how a received event should be handled by the mod. But before creating our own ruleset, we need to understand TwitchSpawn's inner workings of loading the rules.
Ruleset Files
Ruleset files are TSL files which are named like rules.xxx.tsl
. Unless it is default
, xxx
defines associated streamer's Minecraft nickname (which is case insensitive unlike credentials.toml
).
TSL files named not like rules.xxx.tsl
are considered as malformed and are not loaded by the mod. However, they do not crash the loading process.
Default ruleset is used to handle incoming events, if and only if there were no ruleset loaded associated with the relevant streamer. Also default ruleset file is always generated by the mod, if it is not there. However, it is discouraged to use default ruleset mainly unless there is only one streamer in the credentials.toml
Ditching Default Ruleset
Now that you know how the mod loads in the rulesets, you are now ready to define your own rules! Start by creating a TSL file with your Minecraft nickname in it. (E.g if your Minecraft nickname is iGoodie
, create a TSL file named rules.igoodie.tsl
)
TSL files are nothing more than text files, so creating a text file with .tsl
extension is enough. Or you can copy default ruleset file and rename it.
"Hello World" TSL
TSL Structure
The TSL Language provides a readable rule defining interface to users. Its general structure for defining single rule is like following:
ACTION_NAME arguments seperated by space or %grouped to contain spaces% ON Event Name WITH some > predicate
TSL files (the ruleset files) are consisted of multiple rules seperated by blank lines.
Basics about TSL can be found on following page:
Basic Examples
Lets start by implementing our very first rules.
We want the mod to drop a stick on donation between [0,10]
We want the mod to drop an apple on donation between [11,20]
And finally we want the mod to drop a diamond between [21,30]
It is easy as following:
Last updated