strikers_blade Posted September 2, 2021 Share Posted September 2, 2021 Another newbie question from me; I am trying to transfer the ME triggers into script. One of those trigger is the trigger.action.setUserFlag and also it's trigger.misc.getUserFlag counterpart. So for a flag I make true in ME (example flag 700), I would get something like trigger.action.setUserFlag (700, true ) in the .lua file. To be able to read it now, I would just use trigger.misc.getUserFlag(700) to read the same flag. So to put this into context, here is a little example; function easy_mission() trigger.action.setUserFlag (700, true ) end So here is the question; What is the proper way to retrieve the flag #700 information? I looked at MIST, MOOSE, CTLD and all other major source and none of them are as simple as just doing a trigger.misc.getUserFlag(700). Can I just do a IF trigger.misc.getUserFlag(700) == true, then XYZ end or do I absolutely need to handle it more like a local mission1 = trigger.misc.getUserFlag(700) IF mission1 == 1, then XYZ end My systems: Windows 10 64 bits I7-8700k 32.0 GB RAM 500Gb SSD Asus ROG 2080ti HP Reverb Windows 10 64 bits I7-6820HQ CPU @ 2.70Ghz 32.0 GB RAM 500Gb SSD Nvidia Quadro M4000M TrackIR 5 Link to comment Share on other sites More sharing options...
toutenglisse Posted September 2, 2021 Share Posted September 2, 2021 (edited) 20 minutes ago, strikers_blade said: ... So here is the question; What is the proper way to retrieve the flag #700 information? ... Write "700" instead of 700. You can use : IF trigger.misc.getUserFlag("700") == true then XYZ end (I usually use if trigger.misc.getUserFlag("700") > 0 then ) Edited September 2, 2021 by toutenglisse 1 Link to comment Share on other sites More sharing options...
Grimes Posted September 2, 2021 Share Posted September 2, 2021 2 hours ago, strikers_blade said: So here is the question; What is the proper way to retrieve the flag #700 information? I looked at MIST, MOOSE, CTLD and all other major source and none of them are as simple as just doing a trigger.misc.getUserFlag(700). Every script that would use flags would ultimately also use trigger.misc.getUserFlag. They might have something that would check values or store which flags were used in a lookup table, but there is no way for them to get around using the functions to set and get a flag. IMO there are only two reasons to use flags with scripting. 1. Setting flag via script and using the same flag with a defined trigger or waypoint action. Its more of a hybrid where you use scripting to do what the editor can't easily do, but still use flags to do some basic stuff. 2. Setting flag via script and only checking that flag via script. The main advantage is that you could name the flag rather than using a number value. For instance: trigger.action.setUserFlag("easyMission", true). Eliminates the need to remember which flag does what. But frankly you could also just define global or local values within a self contained script to accomplish the same thing. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Recommended Posts