Eddcapone 0 Posted July 2, 2017 I have a trigger which is activated if someone is inside. However, it should only get activated if someone is inside AND if time is between 11:45 o'clock and 11:59 o'clock. How would I do this? My attempt (checkTime.sqf) _dateNow = date; // _now = [2017,7,2,14,05] (Jule. 2nd, 14:05pm) _hour = _dateNow select 3; _minute = _dateNow select 4; _condA = 0; while { _condA == 0 } do { hint format[ " Hour: %1\n Minute: %2\n " , _hour , _minute ]; //only true if time is between 11:45 o'clock and 11:59 o'clock if ((_hour >= 11 && _minute >= 45) && ((_hour < 12)) then { _condA = 1; hint "condA is true"; //return this this } else { sleep 5; } }; Share this post Link to post Share on other sites
Eddcapone 0 Posted July 2, 2017 I cant edit my post, I dont pass the captcha check for whatever reason... Im not sure If I have to return this, but it is the default value of the "Condition" section. And also the condition should be "if ((_hour >= 11 && _minute >= 45) && _hour < 12) then {" Share this post Link to post Share on other sites
mrcurry 470 Posted July 3, 2017 Ditch the file and put this in condition field: this && (((date select 3) >= 11 && (date select 4) >= 45) && (date select 3) < 12) 1 Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted July 3, 2017 28 minutes ago, mrcurry said: Ditch the file and put this in condition field: this && (((date select 3) >= 11 && (date select 4) >= 45) && (date select 3) < 12) Alternatively (for readability): this AND daytime >= 11.75 AND daytime < 12 Cheers 1 Share this post Link to post Share on other sites
Eddcapone 0 Posted July 5, 2017 On 3.7.2017 at 8:58 AM, Grumpy Old Man said: Alternatively (for readability): this AND daytime >= 11.75 AND daytime < 12 Cheers Thanks, that worked. But actually I really try to solve it by using a script for learning purposes, does this work by any chance or is it not supposed to work like this? I changed my code to this, note that I had to change "_condA" to "condA" to make it global. _pThis = _this select 0; _dateNow = date; // _now = [2017,7,2,14,05] (Jule. 2nd, 14:05pm) _hour = _dateNow select 3; _minute = _dateNow select 4; condA = 0; while { condA == 0 } do { hint format[ " Hour: %1\n Minute: %2\n " , _hour , _minute ]; //only true if time is between 11:45 o'clock and 11:59 o'clock if (_pThis AND daytime >= 11.75 AND daytime < 12) then { condA = 1; hint "condA is 1"; //return 1 so that the condition is evaluating to true 1 } else { sleep 5; } }; And this is how the condition part looks now: _ret = [this] execVM "checkTime.sqf" Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted July 6, 2017 What's your question exactly? Do you want to do the check from a script and activate the trigger from within the script? What's _pThis? The trigger? Cheers Share this post Link to post Share on other sites
Eddcapone 0 Posted July 8, 2017 Yes I want to check the condition of the trigger in the script, so I can add more complex code. Im not sure If I even need _pThis it is the argument which I pass to the script in the Condition section of the trigger via _ret = [this] execVM "checkTime.sqf" Share this post Link to post Share on other sites