Files
REM-Mod/EXE/REM/Lua/luastart.lua
2025-06-09 08:32:20 +02:00

91 lines
2.7 KiB
Lua

print("Lua started!")
-- Example Timer after Delay
-- rem.StartTimer(2000, function()
-- rem.ShowNNMessage(9000)
-- print("Console open after 2 seconds.")
-- end)
rem.ConfigureWeaponFire({
{1, 70}, -- Weapon 1: 70ms Cooldown
{2, 100}, -- Weapon 2: 100ms Cooldown
{3, 150} -- Weapon 3: 150ms Cooldown
})
-- Dynamic Enviroments and Characters
-- Function to modify the config.lua file
function modifyLuaConfig(filePath)
-- Read the file
local file, err = io.open(filePath, "r")
if not file then
print("Error opening file: ".. err)
return
end
-- Read all lines from the file into a table
local lines = {}
for line in file:lines() do
table.insert(lines, line)
end
file:close()
-- Get the current day and month
local currentDay = os.date("%d")
local currentMonth = os.date("%B")
-- Modify the lines as needed
for i, line in ipairs(lines) do
-- Change day_gen to the current day
if line:find("setglobal%('day_gen',") then
lines[i] = "setglobal('day_gen', \"".. currentDay.. "\")"
-- Change months_gen to the current month
elseif line:find("setglobal%('months_gen',") then
lines[i] = "setglobal('months_gen', \"".. currentMonth.. "\")"
-- Change gcs_state to "off"
elseif line:find("setglobal%('gcs_state',") then
lines[i] = "setglobal('gcs_state', \"off\")"
-- Change char_gen to "trent"
elseif line:find("setglobal%('char_gen',") then
lines[i] = "setglobal('char_gen', \"trent\")"
-- Change gcs_voice to "trent"
elseif line:find("setglobal%('gcs_voice',") then
lines[i] = "setglobal('gcs_voice', \"trent\")"
-- Change anm_gen to "stand"
elseif line:find("setglobal%('anm_gen',") then
lines[i] = "setglobal('anm_gen', \"stand\")"
-- Change manhattan_gen, lismallstation_gen, toledo_gen to "origin"
elseif line:find("setglobal%('manhattan_gen',") then
lines[i] = "setglobal('manhattan_gen', \"origin\")"
elseif line:find("setglobal%('lismallstation_gen',") then
lines[i] = "setglobal('lismallstation_gen', \"origin\")"
elseif line:find("setglobal%('toledo_gen',") then
lines[i] = "setglobal('toledo_gen', \"origin\")"
end
end
-- Write the modified lines back to the file
file, err = io.open(filePath, "w")
if not file then
print("Error writing to file: ".. err)
return
end
for _, line in ipairs(lines) do
file:write(line.. "\n")
end
file:close()
print("File modified successfully.")
end
-- Execute modify function
modifyLuaConfig(".\\REM\\LUA\\DYNAMIC\\config.lua")