Page 1 of 1

Prevent GetEvent Error in LuaLog

Posted: Fri Mar 17, 2023 10:53 am
by blu3s
I want to know if an event exists or not, I use:

Code: Select all

local event = pcall(ScenEdit_GetEvent,'Event1')
But it does not prevent it from writing in the log:

Code: Select all

Function:ScenEdit_GetEvent (0)  Error:Unable to identify the desired Event!
How can I avoid this error in the log?


Edit: I have notice that I post under mods and scenarios and not in Lua Legion, if a moderator could move the thread to lua legion I'll be grateful :)

Re: Prevent GetEvent Error in LuaLog

Posted: Sat Mar 18, 2023 10:20 am
by michaelm75au
Run this in the Console
Tool_EmulateNoConsole(true)

This simulates the non-interactive session that runs in the sim. Any errors returned would be how a script sees them in an event

Re: Prevent GetEvent Error in LuaLog

Posted: Sat Mar 18, 2023 10:37 am
by blu3s
michaelm75au wrote: Sat Mar 18, 2023 10:20 am Run this in the Console
Tool_EmulateNoConsole(true)

This simulates the non-interactive session that runs in the sim. Any errors returned would be how a script sees them in an event
Hi Michael, thank you for your reply.

My problem in fact is with the script mode. I have that in a LuaInit function to check that the first time there is a call to a function that creates some units, the associated event with the logic of this units is created.

I pass you a scenario with a Regular Time 15s Event, where it checks if an event exists. And every 15 seconds in my log I get the error.

GetEvent Error.zip
(4.19 KiB) Downloaded 2 times
Thank you