Habu_69 Posted July 6, 2019 Posted July 6, 2019 functon trigger.action.setUserFlag(string flagNum/FlagName, boolean/number userFlagValue ) boolean does not work, or at least appears to have no function. for example: [/url][url="https://wiki.hoggitworld.com/view/DCS_singleton_trigger"]trigger.action[/url].setUserFlag( '100', true ) if [url="https://wiki.hoggitworld.com/view/DCS_singleton_trigger"]trigger.misc[/url].getUserFlag( '100' ) == true then do stuff end will not execute do stuff. Only numeric parameters are properly recognized.
TOViper Posted August 6, 2019 Posted August 6, 2019 (edited) Hi! Just to make sure, you mean this one should work? trigger.action.setUserFlag( '100', 1 ) if trigger.misc.getUserFlag( '100' ) == 1 then do stuff end I did the following "do script" in a waypoint, all of them work: trigger.action.setUserFlag("1", 1); trigger.action.setUserFlag(2, true); trigger.action.setUserFlag("3", true); trigger.action.setUserFlag('4', 1); Edited August 6, 2019 by TOViper Visit https://www.viggen.training ...Viggen... what more can you ask for? my computer: AMD Ryzen 5600G 4.4 GHz | NVIDIA RTX 3080 10GB | 32 GB 3.2 GHz DDR4 DUAL | SSD 980 256 GB SYS + SSD 2TB DCS | TM Warthog Stick + Throttle + TRP | Rift CV1
Hardcard Posted August 6, 2019 Posted August 6, 2019 (edited) When you do... trigger.action.setUserFlag( '100', true ) what's actually happening is that flag 100 is set to 1, so the following condition won't be met: if trigger.misc.getUserFlag( '100' ) == true then When you do... trigger.action.setUserFlag( '100', false ) what's actually happening is that flag 100 is set to 0, so the following condition won't be met: if trigger.misc.getUserFlag( '100' ) == false then Looks like boolean just sets the flag to either 1 or 0, it does have a function (albeit, not the one people would assume) Edited August 6, 2019 by Hardcard [sIGPIC][/sIGPIC]
TOViper Posted August 7, 2019 Posted August 7, 2019 (edited) Thanks for you post, but unfortunately my confusion about this one rises totally ... :noexpression: After reading your post 20 times, I assume you dont' want to state that my lines don't work, cause I can state that they DO work, and I tested them yesterday. I think what you want to say is that comparisons like "== true" or "== false" don't work, and respectively "== 1" or "== 0" do work? Do you? Edited August 7, 2019 by TOViper Visit https://www.viggen.training ...Viggen... what more can you ask for? my computer: AMD Ryzen 5600G 4.4 GHz | NVIDIA RTX 3080 10GB | 32 GB 3.2 GHz DDR4 DUAL | SSD 980 256 GB SYS + SSD 2TB DCS | TM Warthog Stick + Throttle + TRP | Rift CV1
Hardcard Posted August 7, 2019 Posted August 7, 2019 (edited) After reading your post 20 times, I assume you dont' want to state that my lines don't work, cause I can state that they DO work, and I tested them yesterday. I think what you want to say is that comparisons like "== true" or "== false" don't work, and respectively "== 1" or "== 0" do work? Do you? I just felt like sharing my findings, that's all, it wasn't a personal attack to anybody ;) But yes, that's essentially what I wanted to say, don't think in terms of true or false, think in terms of 1 and 0 As for your snippet, it looks fine, except for the flag number in the second line: trigger.action.setUserFlag("1", 1); trigger.action.setUserFlag([color="Red"]2[/color], true); trigger.action.setUserFlag("3", true); trigger.action.setUserFlag('4', 1); I sincerely doubt flag 2 is being set to 1 by that particular trigger in line 2, since the flag parameter needs to be a string, not a number. You don't have to take my word for it, just check the Hoggit Wiki: https://wiki.hoggitworld.com/view/DCS_func_setUserFlag As it's written in the snippet, the second trigger shouldn't be working... Test it again, are you sure that flag 2 isn't being set to 1 by some other trigger in ME? As for the rest of triggers in the snippet, they all set their respective flags to 1, so they shouldn't cause problems. Edited August 7, 2019 by Hardcard [sIGPIC][/sIGPIC]
TOViper Posted August 7, 2019 Posted August 7, 2019 (edited) I just felt like sharing my findings, that's all, it wasn't a personal attack to anybody ;) This wasn't my idea writing my answer before! :smilewink: Just a try to clarify the whole thing for me. I will do the test again for the red one ... it was a mission consisting of 5 triggers and one aircraft with 1 waypoint ... :huh: Here is what I tested, and ALL of them work when "Run script" at a waypoint: trigger.action.setUserFlag("1", 1); trigger.action.setUserFlag("2", true); trigger.action.setUserFlag(3, 1); trigger.action.setUserFlag(4, true); trigger.action.setUserFlag('5', 1); trigger.action.setUserFlag('6', true); Here is the mission: start it, and wait 10 seconds until the F-5 overflies the TACAN station at Batumi. Test_setUserFlag_at_waypoints.miz Edited August 7, 2019 by TOViper Visit https://www.viggen.training ...Viggen... what more can you ask for? my computer: AMD Ryzen 5600G 4.4 GHz | NVIDIA RTX 3080 10GB | 32 GB 3.2 GHz DDR4 DUAL | SSD 980 256 GB SYS + SSD 2TB DCS | TM Warthog Stick + Throttle + TRP | Rift CV1
Hardcard Posted August 7, 2019 Posted August 7, 2019 Yup, looks like the flag parameter also accepts numbers... this is weird, I seem to recall it didn't accept numbers before, only strings. Anyway, the conclusion is the same: true = 1 false = 0 [sIGPIC][/sIGPIC]
Habu_69 Posted August 7, 2019 Author Posted August 7, 2019 From my testing, IIRC, conditional boolean statements like: if trigger.misc.getUserFlag( "2" ) == true then do not function as expected.
Hardcard Posted August 7, 2019 Posted August 7, 2019 (edited) From my testing, IIRC, conditional boolean statements like: if trigger.misc.getUserFlag( "2" ) == true then do not function as expected. Like I said, if you do this... trigger.action.setUserFlag( "2", true ) flag 2 isn't set to true, but to 1 So, if you then check it using... if trigger.misc.getUserFlag( "2" ) == true then I wouldn't expect that condition to be met... however, the following should work if trigger.misc.getUserFlag( "2" ) == 1 then Edited August 7, 2019 by Hardcard [sIGPIC][/sIGPIC]
TOViper Posted August 8, 2019 Posted August 8, 2019 Yep, now we are were we wanted to be :) Thanks for clarification! Visit https://www.viggen.training ...Viggen... what more can you ask for? my computer: AMD Ryzen 5600G 4.4 GHz | NVIDIA RTX 3080 10GB | 32 GB 3.2 GHz DDR4 DUAL | SSD 980 256 GB SYS + SSD 2TB DCS | TM Warthog Stick + Throttle + TRP | Rift CV1
Recommended Posts