ScheduleLua

版本 v0.1.5·更新於 2025-04-19

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

截圖 共 1 張

模組介紹 作者原文

ScheduleLua

A Lua modding framework for Schedule I that exposes the game's functionality to Lua scripts, enabling custom gameplay mechanics, automation, and new features.

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
  • Extract the zip file and drag the Mods and UserLibs folders into your Schedule I game directory
  • Launch the game on the alternate or alternate-beta branch

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 simple script to get started:

-- 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

newL

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

LavaGang-MelonLoader

檔案與校驗

檔案名稱
ScheduleLua-0.1.5.zip
檔案大小
256.4 KiB