if process and readInteger(process) ~= 0 then
print("正在加载Mono,请耐心等待")
mono_initialize()
LaunchMonoDataCollector()
local timer = createTimer(nil, false)
timer.Interval = 1000
timer.OnTimer = function()
local method = mono_findMethod('', 'System.String', 'Equals')
if method then
timer.destroy()
print("Mono已成功加载,可以启用修改功能\n本窗口在1s后自动关闭")
local closeTimer = createTimer(nil, false)
closeTimer.Interval = 1000
closeTimer.OnTimer = function()
closeTimer.destroy()
local luaEngine = getLuaEngine()
if luaEngine then
luaEngine.hide()
end
end
closeTimer.Enabled = true
else
print("Mono加载中,请稍候...")
end
end
timer.Enabled = true
else
print('未检测到进程,请启动游戏')
error('未检测到进程,请启动游戏')
end
I thought it worked at first, but the funny thing is that when I manually load other processes, it still says Mono loaded
I really don't know how to proceed. I didn't find anything related in the CE forum(or maybe it's my oversight). If anyone can help me, I will be very grateful:)
PS: I only know a little bit about Lua
if process and readInteger(process) ~= 0 then
print("正在加载Mono,请耐心等待")
mono_initialize()
LaunchMonoDataCollector()
local timer = createTimer(nil, false)
timer.Interval = 1000
timer.OnTimer = function()
local method = mono_findMethod('', 'System.String', 'Equals')
if method then
timer.destroy()
print("Mono已成功加载,可以启用修改功能\n本窗口在1s后自动关闭")
local closeTimer = createTimer(nil, false)
closeTimer.Interval = 1000
closeTimer.OnTimer = function()
closeTimer.destroy()
local luaEngine = getLuaEngine()
if luaEngine then
luaEngine.hide()
end
end
closeTimer.Enabled = true
else
print("Mono加载中,请稍候...")
end
end
timer.Enabled = true
else
print('未检测到进程,请启动游戏')
error('未检测到进程,请启动游戏')
end
I thought it worked at first, but the funny thing is that when I manually load other processes, it still says Mono loaded
I really don't know how to proceed. I didn't find anything related in the CE forum(or maybe it's my oversight). If anyone can help me, I will be very grateful:)
PS: I only know a little bit about Lua
if process and readInteger(process) ~= 0 then
print("正在加载Mono,请耐心等待")
mono_initialize()
LaunchMonoDataCollector()
local timer = createTimer(nil, false)
timer.Interval = 1000
timer.OnTimer = function()
local method = mono_findMethod('', 'System.String', 'Equals')
if method then
timer.destroy()
print("Mono已成功加载,可以启用修改功能\n本窗口在1s后自动关闭")
local closeTimer = createTimer(nil, false)
closeTimer.Interval = 1000
closeTimer.OnTimer = function()
closeTimer.destroy()
local luaEngine = getLuaEngine()
if luaEngine then
luaEngine.hide()
end
end
closeTimer.Enabled = true
else
print("Mono加载中,请稍候...")
end
end
timer.Enabled = true
else
print('未检测到进程,请启动游戏')
error('未检测到进程,请启动游戏')
end
I thought it worked at first, but the funny thing is that when I manually load other processes, it still says Mono loaded
I really don't know how to proceed. I didn't find anything related in the CE forum(or maybe it's my oversight). If anyone can help me, I will be very grateful:)
PS: I only know a little bit about Lua
if process and readInteger(process) ~= 0 then
print("正在加载Mono,请耐心等待")
mono_initialize()
LaunchMonoDataCollector()
local timer = createTimer(nil, false)
timer.Interval = 1000
timer.OnTimer = function()
local method = mono_findMethod('', 'System.String', 'Equals')
if method then
timer.destroy()
print("Mono已成功加载,可以启用修改功能\n本窗口在1s后自动关闭")
local closeTimer = createTimer(nil, false)
closeTimer.Interval = 1000
closeTimer.OnTimer = function()
closeTimer.destroy()
local luaEngine = getLuaEngine()
if luaEngine then
luaEngine.hide()
end
end
closeTimer.Enabled = true
else
print("Mono加载中,请稍候...")
end
end
timer.Enabled = true
else
print('未检测到进程,请启动游戏')
error('未检测到进程,请启动游戏')
end
I thought it worked at first, but the funny thing is that when I manually load other processes, it still says Mono loaded
I really don't know how to proceed. I didn't find anything related in the CE forum(or maybe it's my oversight). If anyone can help me, I will be very grateful:)
PS: I only know a little bit about Lua
print("正在加载Mono,请耐心等待")
mono_initialize()
LaunchMonoDataCollector()
local timer = createTimer(nil, false)
timer.Interval = 1000
timer.OnTimer = function()
if monopipe == nil then
timer.destroy()
print("Mono加载失败,请检查进程")
return
end
if monopipe ~= nil then
timer.destroy()
print("Mono已成功加载,可以启用修改功能\n本窗口在1s后自动关闭")
local closeTimer = createTimer(nil, false)
closeTimer.Interval = 1000
closeTimer.OnTimer = function()
closeTimer.destroy()
local luaEngine = getLuaEngine()
if luaEngine then
luaEngine.hide()
end
end
closeTimer.Enabled = true
else
print("Mono加载中,请稍候...")
end
end
timer.Enabled = true
But it still cannot work correctly
it will always show print("Mono已成功加载,可以启用修改功能\n本窗口在1s后自动关闭")
if process and readInteger(process) ~= 0 then
print("正在加载Mono,请耐心等待")
mono_initialize()
LaunchMonoDataCollector()
local maxRetries = 10 -- 最大重试次数
local retries = 0
local timer = createTimer(nil, false)
timer.Interval = 1000
timer.OnTimer = function()
-- 尝试调用一个简单的 Mono 函数来检测 Mono 是否可用
local success, result = pcall(function()
return mono_enumDomains()
end)
if success and result and #result > 0 then
timer.destroy()
print("Mono已成功加载,可以启用修改功能\n本窗口在1s后自动关闭")
local closeTimer = createTimer(nil, false)
closeTimer.Interval = 1000
closeTimer.OnTimer = function()
closeTimer.destroy()
local luaEngine = getLuaEngine()
if luaEngine then
luaEngine.hide()
end
end
closeTimer.Enabled = true
elseif success then
print("Mono加载中,请稍候...")
retries = retries + 1
if retries >= maxRetries then
timer.destroy()
print("尝试启用Mono功能已超过10s,请确保进程是正确的")
end
else
timer.destroy()
print("尝试启用Mono功能已超过10s,请确保进程是正确的")
end
end
timer.Enabled = true
if monopipe then
print('Mono is on')
else
print('Mono is off')
end
What are you trying to do ?
Some functions require to use Mono
I usually write a script that automatically loads the program and add Usemono().
But it takes time to turn on Mono
Some people rush to turn on functions, which will cause CE to report an error, so I want to check whether Mono is turned on or not.
These scripts of mine seem to meet my needs (including yours). I'm just confused why it still shows that I have loaded Mono when I manually load other processes (Which is impossible to turn on the Mono function).
My latest script solves the problem (even though it may not be a good solution), anyway, thanku very much