Prevent GetEvent Error in LuaLog

Post new mods and scenarios here.

Moderator: MOD_Command

Post Reply
User avatar
blu3s
Posts: 977
Joined: Fri Jul 08, 2022 9:45 am

Prevent GetEvent Error in LuaLog

Post 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 :)
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

Re: Prevent GetEvent Error in LuaLog

Post 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
Michael
User avatar
blu3s
Posts: 977
Joined: Fri Jul 08, 2022 9:45 am

Re: Prevent GetEvent Error in LuaLog

Post 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 1 time
Thank you
Post Reply

Return to “Mods and Scenarios”