Accessing InterfaceModeTypes from GameplayScripts?

sp00n

Prince
Joined
Jan 4, 2007
Messages
371
// Edit
Ok, I don't really need this anymore, I can move the entire initialization to the UI lua just as well. Should have thought of that earlier. I'll still leave the original text in, maybe someone can use the functionality.





Is there any way to access the InterfaceModeTypes variable from lua scripts in the <GameplayScripts> context?

In the game code I see them only being used in UI scripts, so instead of using the provided variables, I have to use the integer numbers right now. And I suspect these values may change with any patch.
Example:

Code:
function OnInterfaceModeChanged(oldMode:number, newMode:number)
    -- InterfaceModeTypes doesn't seem to be defined outside of UserInterface context, so we need to use the integer value (which may change with a patch)
    -- if ( newMode == InterfaceModeTypes.SPY_CHOOSE_MISSION ) then
    if ( newMode == 1070742220 ) then
        -- Create custom event accessible in UI context
        LuaEvents.EspionageChooserOpened();
    end
end


function Initialize()
    Events.InterfaceModeChanged.Add(OnInterfaceModeChanged);
end

Initialize();
 
Last edited:
Top Bottom