About this mod
SCreenSignCommands allows mod makers to register custom commands that can be triggered based on the text written on in-game signs. This mod is a framework that other mods can use and so does not contain any commands itself. To have an effect in-game you must also install a mod that uses this framework, such as SCreen Sign Colors.
- Requirements
- Permissions and credits
- Changelogs
- Donations
SCreenSignCommands allows mod makers to register custom commands that can be triggered based on the text written on in-game signs. This mod is a framework that other mods can use and so does not contain any commands itself. To have an effect in-game you must also install a mod that uses this framework, such as SCreen Sign Colors.
How to Register a New Command:
To register a new command, you can use the register_command method provided by this mod. This method allows you to define a command name, description, and the logic to execute when the command is triggered.
Example:
using System.Collections;
using Il2CppScheduleOne.EntityFramework;
using SCreenSignCommandsIL2CPP;
public class MyMod : MelonMod
{
public override void OnInitializeMelon()
{
// Register a new command
Melon<SCreenSignCommandsIL2CPP.Core>.Instance.register_command(
"/exampleCommand",
"This is an example command.",
ExampleCommandLogic
);
}
private IEnumerator ExampleCommandLogic(LabelledSurfaceItem instance)
{
yield return null;
instance.Label.text = $"Command executed on sign with message: {instance.Message}";
}
}
Parameters for register_command:
1. name: The unique name of the command (e.g., "/exampleCommand").
2. description: A brief description of what the command does.
3. command_method: A function that defines the logic to execute. It must accept a LabelledSurfaceItem instance and return an IEnumerator.
Alternatively, you can create a SignCommand object and register it directly:
var customCommand = new SignCommand(
"customCommand",
"A custom command example.",
CustomCommandLogic
);
Melon<SCreenSignCommandsIL2CPP.Core>.Instance.register_command(customCommand);
Additional Notes:
- Commands are executed using coroutines.
- Use the SignCommand.getArgs method to parse arguments from the sign's message.
- Ensure your command logic handles edge cases and invalid input gracefully.
Dependencies:
- This mod requires MelonLoader. This version currently only supports IL2CPP (main branch). Mono (Alternate) version is being worked on.
GitHub Source