IPB


Welcome Guest ( Log In | Register )

 Forum Rules ArmedAssault.info Forum Rules
 
Reply to this topicStart new topic
> Script at a specific time
Lustmolch45
post Jan 18 2013, 13:45
Post #1


New Member
*

Group: Members
Posts: 2
Joined: 16-January 13
Member No.: 9,993



Hey,

I would like to run a script at a specific time (let's say at 6PM). I tried this:

QUOTE
_hour = date select 3;

if (_hour == 18) then {
//stuff
};


Bit it doesn't work. Can anyone help?

This post has been edited by Lustmolch45: Jan 18 2013, 13:46
 
Quote Post
D@V£
post Jan 18 2013, 14:31
Post #2


Gee, I wish we had one of them doomsday machines.
Group Icon

Group: Moderators
Posts: 2,037
Joined: 13-November 06
From: Wales
Member No.: 155



Your script is just checking to see what time it is, then if it's 1800, doing stuff. The problem is, it'll only work if your script is executed at 1800.

Checking the time of day like that is a bit iffy, you can fix it by doing a loop that'll keep checking the time of day, but since you know the exact time your mission is going to start it's a lot better to just have your script like this, and run it at the start of the mission:
CODE
sleep 3600
//stuff

(Assuming your mission starts at 1700, otherwise just adjust the sleep command to the right number of seconds)


--------------------
The Rules - Nothing too complicated, follow these and we'll have no problems.
Moderation Feedback Thread - Tell everyone how much you hate me love me secretly fear that Mark is watching you while you sleep. secretly wish that Mark is watching you while you sleep.
Site Issues Thread - Complain about site issues here. We might even fix them!
Community Chatter Thread - Furthest Mud-sling gets a free subscription to "JdB Monthly".

QUOTE(Major Mike Shearer)
We can categorically state that we have not released man-eating badgers into the area.
QUOTE(Brace Belden)
A machine gun is like a woman, I donít understand it, Iím afraid of it, and one day Iíll accidentally be killed by one.
 
Quote Post
Lustmolch45
post Jan 18 2013, 20:03
Post #3


New Member
*

Group: Members
Posts: 2
Joined: 16-January 13
Member No.: 9,993



Ok I have done it with a while loop and it works now. Thanks for your help. thumbsup.gif
 
Quote Post

Reply to this topicStart new topic
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 21st April 2018 - 09:58