Files
REM-Mod/EXE/REM/Lua/luastart.lua
2025-07-27 16:02:21 +02:00

115 lines
4.1 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, rochester_gen, westpoint_gen and toledo_gen to "origin"
elseif line:find("setglobal%('manhattan_gen',") then
lines[i] = "setglobal('manhattan_gen', \"origin\")"
elseif line:find("setglobal%('rochester_gen',") then
lines[i] = "setglobal('rochester_gen', \"origin\")"
elseif line:find("setglobal%('westpoint_gen',") then
lines[i] = "setglobal('westpoint_gen', \"origin\")"
elseif line:find("setglobal%('buffalo_gen',") then
lines[i] = "setglobal('buffalo_gen', \"origin\")"
elseif line:find("setglobal%('kyoto_gen',") then
lines[i] = "setglobal('kyoto_gen', \"origin\")"
elseif line:find("setglobal%('toledo_gen',") then
lines[i] = "setglobal('toledo_gen', \"origin\")"
-- Change Li01 City Camera_0 to origin values
elseif line:find("setglobal%('li01_city_posX_gen',") then
lines[i] = "setglobal('li01_city_posX_gen', \"59.65879\")"
elseif line:find("setglobal%('li01_city_posY_gen',") then
lines[i] = "setglobal('li01_city_posY_gen', \"46.31464\")"
elseif line:find("setglobal%('li01_city_posZ_gen',") then
lines[i] = "setglobal('li01_city_posZ_gen', \"97.57275\")"
elseif line:find("setglobal%('li01_city_fovh_gen',") then
lines[i] = "setglobal('li01_city_fovh_gen', \"29.5\")"
elseif line:find("setglobal%('li01_city_hvaspect_gen',") then
lines[i] = "setglobal('li01_city_hvaspect_gen', \"1.31\")"
elseif line:find("setglobal%('li01_city_nearplane_gen',") then
lines[i] = "setglobal('li01_city_nearplane_gen', \"20\")"
elseif line:find("setglobal%('li01_city_farplane_gen',") then
lines[i] = "setglobal('li01_city_farplane_gen', \"7000\")"
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")