0 of 0

File information

Last updated

Original upload

Created by

IfBars

Uploaded by

IfBars

Virus scan

Safe to use

Tags for this mod

About this mod

A work-in-progress Lua modding framework for Schedule 1

Requirements
Permissions and credits
Mirrors
Changelogs

Mono Only (alternate & alternate-beta)

Overview

ScheduleLua is a Lua modding framework for Schedule I that aims to expose the game's functionality to Lua scripts, enabling custom gameplay mechanics, automation, and new features. The framework is built on MelonLoader and uses MoonSharp to integrate Lua with the game.

Important Note: ScheduleLua by itself does not add any gameplay features or content to Schedule I. It is a framework that allows you to run Lua scripts created by yourself or others. Without any scripts installed, this mod will not change your gameplay experience. Its purpose is to provide an easier way for modders to create custom gameplay modifications using Lua instead of requiring C# development knowledge.

Features

  • Robust Lua Environment: Built on MoonSharp for .NET integration
  • Hot Reloading: Edit scripts while the game is running for rapid development
  • Event System: Subscribe to game events like day changes, player status updates, etc.
  • Schedule I API: Access to player, NPCs, inventory, time, and more
  • Error Handling: Detailed error reporting and script isolation
  • Console Commands: Create custom console commands with the built-in command system

Installation
  • Install MelonLoader for Schedule I
  • Download the latest ScheduleLua release from the Files tab
  • Extract the zip file and drag the `Mods` and `UserLibs` folders into your Schedule I game directory
  • Launch the game

    Getting Started

    Documentation
    Visit the Documentation Site for a full scripting guide and API reference.

    Creating Your First Script
  • Navigate to the `Mods/ScheduleLua/Scripts` directory
  • Create a new `.lua` file (e.g., `my_first_script.lua`)
  • Use the example script below as a template, or check the Examples section

    Quick Start Guide
  • Basic Structure: All scripts should return `true` to indicate successful loading
  • Core Functions:
    • `Initialize()`: Called when script is first loaded
         
    • `Update()`: Called every frame
         
    • `OnConsoleReady()`: Called when console is available
         
    • `OnPlayerReady()`: Called when player is fully loaded
         
    • `Shutdown()`: Called when script is unloaded
         
    Script Lifecycle
    • Loading: Scripts are loaded when the game starts or when modified (hot reload)
    • Initialization: The `Initialize()` function is called if it exists
    • Update: The `Update()` function is called every frame if it exists
    • Events: Event handlers are called when corresponding game events occur

    Configuration

    Edit settings in `UserData/MelonPreferences.cfg`:

    [ScheduleLua]
    EnableHotReload = true
    LogScriptErrors = true

    API Features

    • Player System: Get/set player stats, position, money, health, energy
    • NPC System: Access NPC information, positions, and regions
    • Inventory System: Manage player inventory
    • Time System: Access game time, days, and events
    • Map/World System: Access region information
    • Console Command System: Create custom in-game commands

    Example Script

    Check out this example script that demonstrates how to modify ATM limits in the game using ScheduleLua:

    -- ATM Limit Example Script

    -- Track ATM limit changes
    local originalLimit = 10000.0
    local presetLimits = {
        ["Default"] = 10000.0,
        ["Medium"] = 25000.0,
        ["High"] = 50000.0,
        ["Very High"] = 100000.0,
        ["Unlimited"] = 999999.0
    }

    -- Initialize function called when script is first loaded
    function Initialize()
        Log("ATM Limit Example script initialized!")
    end

    -- Called when the console is fully loaded and ready
    function OnConsoleReady()
        -- Register console commands for ATM limits
        RegisterCommand(
            "atmlimit",
            "Shows or sets the ATM deposit limit using Harmony patching",
            "atmlimit [amount/preset]",
            function(args)
                if #args == 0 then
                    -- No args, show current limit
                    local currentLimit = GetATMDepositLimit()
                    Log("Current ATM deposit limit: " .. FormatMoney(currentLimit))
                    Log("Available presets: default, medium, high, veryhigh, unlimited")
                    for name, limit in pairs(presetLimits) do
                        Log("  - " .. name .. ": " .. FormatMoney(limit))
                    end
                else
                    -- Try to set the limit
                    local newLimit
                    local presetName = string.lower(args[1])
                   
                    -- Check if it's a preset name
                    if presetName == "default" then
                        newLimit = presetLimits["Default"]
                    elseif presetName == "medium" then
                        newLimit = presetLimits["Medium"]
                    elseif presetName == "high" then
                        newLimit = presetLimits["High"]
                    elseif presetName == "veryhigh" then
                        newLimit = presetLimits["Very High"]
                    elseif presetName == "unlimited" then
                        newLimit = presetLimits["Unlimited"]
                    else
                        -- Try to parse as a number
                        newLimit = tonumber(args[1])
                        if not newLimit then
                            LogError("Invalid limit. Please specify a number or preset (default, medium, high, veryhigh, unlimited)")
                            return
                        end
                    end
                   
                    -- Set the new limit
                    Log("Applying Harmony patches for ATM deposit limit: " .. FormatMoney(newLimit))
                    if SetATMDepositLimit(newLimit) then
                        Log("Successfully applied patches for ATM deposit limit: " .. FormatMoney(newLimit))
                        Log("Try visiting an ATM to see the new limit in action.")
                        Log("Note: This change affects all ATMs in the game!")
                    else
                        LogError("Failed to apply patches for ATM deposit limit")
                    end
                end
            end
        )
       
        RegisterCommand(
            "resetatmlimit",
            "Resets the ATM deposit limit to the default value",
            "resetatmlimit",
            function(args)
                if SetATMDepositLimit(originalLimit) then
                    Log("Applied Harmony patches to reset ATM deposit limit to default: " .. FormatMoney(originalLimit))
                else
                    LogError("Failed to reset ATM deposit limit")
                end
            end
        )
       
        RegisterCommand(
            "findatms",
            "Shows information about ATMs in the game world",
            "findatms",
            function(args)
                Log("Checking for ATM objects in the game...")
                local currentLimit = GetATMDepositLimit()
                Log("Current ATM deposit limit: " .. FormatMoney(currentLimit))
                Log("ATM patching status: Active")
                Log("Note: Changes made via the atmlimit command will apply to ALL ATMs in the game!")
                Log("Use 'atmlimit' command to change the limit value")
            end
        )
       
        Log("ATM Limit commands registered: 'atmlimit', 'resetatmlimit', 'findatms'")
    end

    -- Called when the player is fully loaded and ready
    function OnPlayerReady()
        Log("ATM Limit Example: Player is ready!")
       
        -- Store the original limit when we start
        originalLimit = GetATMDepositLimit()
        Log("Current ATM deposit limit: " .. FormatMoney(originalLimit))
       
        -- Display available presets
        Log("Available ATM limit presets:")
        for name, limit in pairs(presetLimits) do
            Log("  - " .. name .. ": " .. FormatMoney(limit))
        end
       
        Log("Use the 'atmlimit' command to view or change the limit.")
    end

    -- Cleanup function called when script is unloaded
    function Shutdown()
        -- Unregister all commands
        UnregisterCommand("atmlimit")
        UnregisterCommand("resetatmlimit")
        UnregisterCommand("findatms")
       
        Log("ATM Limit Example script shutdown, all commands unregistered")
    end

    Status

    ScheduleLua is currently in beta development. Only most of the features in the example scripts are guaranteed to work properly, especially after game updates.

    Links


    Contributing

    Contributions to ScheduleLua are welcome! Check out the GitHub repository for more information on how to contribute.

    License

    This project is licensed under the GPL-3.0 License.