Jump to content
  • 0

event time script


donkeyg

Question


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

if(gettime(4) != 0 && gettime(4) != 6) end;
<<< this is for saturday and sunday

how do i set this time to monday, webnesday and friday only?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   30
  • Joined:  02/22/12
  • Last Seen:  

// If Monday, Wednesday, or Friday perform an action.
if(gettime(4) == 1 || gettime(4) == 3 || gettime(4) == 5)
{
  // Do Whatever
}

*gettime(<type>)

This function will return specified information about the current system time.

1 = Seconds (of a minute)
2 = Minutes (of an hour)
3 = Hour (of a day)
4 = Day of the Week (0 = Sun, 1 = Mon, 2 = Tues, 3 = Wed, 4 = Thurs, 5 = Fri, 6 = Sat)
5 = Day of the month.
6 = Number of the month.
7 = Year.
8 = Day of the year.

The example code I gave does the following:

- gettime(4) returns the current day of the week as a digit between 0 (Sun) and 6 (Sat).

- Using the if statement with || ("or"), I checked to see if the returned digit was either 1 (Mon), 3 (Wed), or 5 (Fri).

- If the returned digit was 1, 3, or 5 it will then perform the task.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

// If Monday, Wednesday, or Friday perform an action.
if(gettime(4) == 1 || gettime(4) == 3 || gettime(4) == 5)
{
  // Do Whatever
}

*gettime(<type>)

This function will return specified information about the current system time.

1 = Seconds (of a minute)
2 = Minutes (of an hour)
3 = Hour (of a day)
4 = Day of the Week (0 = Sun, 1 = Mon, 2 = Tues, 3 = Wed, 4 = Thurs, 5 = Fri, 6 = Sat)
5 = Day of the month.
6 = Number of the month.
7 = Year.
8 = Day of the year.

The example code I gave does the following:

- gettime(4) returns the current day of the week as a digit between 0 (Sun) and 6 (Sat).

- Using the if statement with || ("or"), I checked to see if the returned digit was either 1 (Mon), 3 (Wed), or 5 (Fri).

- If the returned digit was 1, 3, or 5 it will then perform the task.

how if i make it 1 week have 3 days the event is open for everyone

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   30
  • Joined:  02/22/12
  • Last Seen:  

how if i make it 1 week have 3 days the event is open for everyone

Not entirely sure what you mean... can you re-phrase the question please?

The script I posted should perform whatever code you put in it every Monday, Wednesday, & Friday on every week.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

sorry my fault, didnt see clearly, thank you!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...