Mirror of eathena's sourceforge SVN repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

111 lines
4.6 KiB

//| ~~~~~ How to set WoE times, by erKURITA: ~~~~~
//|
//| Basically, there are 2 commands that affects the WoE times,
//| OnClock<time>: and gettime(<type).
//|
//| OnClock<time> runs when the said time where <time> is has been reached.
//| The format of time is hhmm, being h = hour, m = minute.
//| OnClock2350: would run at 23:50 on Computer's time.
//|
//| gettime(<type) is a function which is used to make a check
//| for a desired amount of information regarding time. The types are:
//| 1 - Seconds (of a minute)
//| 2 - Minutes (of an hour)
//| 3 - Hour (of a day). Hour goes from 0 to 23.
//| 4 - Week day (0 for Sunday, 6 is Saturday)
//| 5 - Day of the month.
//| 6 - Number of the month.
//| 7 - Year.
//| 8 - Day of the year.
//|
//| Days (explained later) :
//| Monday = 1
//| Tuesday = 2
//| Wednesday = 3
//| Thursday = 4
//| Friday = 5
//| Saturday = 6
//| Sunday = 0
//|
//| This way, we can check for a desired minute, hour, day, month, etc.
//|
//| Now the structure:
//|
//| OnClock2100: //start time for Tues(2), Thurs(4)
//| OnClock2300: //end time for Tues(2), Thurs(4)
//| OnClock1600: //start time for Sat(6)
//| OnClock1800: //end time for Sat(6)
//|
//| These 4 labels will run one after the other. It's acomodated so,
//| The Tuesday at 21:00 and 23:00 they will run, and go to the next
//| part of the script:
//|
//| if((gettime(4)==2) && (gettime(3)>=21 && gettime(3)<23)) goto L_Start;
//| if((gettime(4)==4) && (gettime(3)>=21 && gettime(3)<23)) goto L_Start;
//| if((gettime(4)==6) && (gettime(3)>=16 && gettime(3)<18)) goto L_Start;
//|
//| This part will check for the times. Since both Starting and Ending times
//| run through the same chain of commands, there are necesary checks to ensure
//| it's the right time. Let's take the following example:
//|
//| if((gettime(4)==2) && (gettime(3)>=21 && gettime(3)<23))
//|
//| The first gettime is checking for a type 4, the day of the week, and it's
//| comparing it to the one desired, which is 2, that's Tuesday. If the comparation
//| is true and both sides are equal, it will return 1. 1 means true, 0 means false
//| in comparations and conditions.
//|
//| The second gettime is checking for a type 3, which is the hour, and it's
//| comparing it to 21, and if the first part is greater or equal (>=) than the second,
//| the comparation will return 1.
//|
//| The third and last gettime is checking again for the hour, but the time has to be less
//| than the said time, in this case, 23.
//|
//| Now, look at the parentheses. Parentheses are very important when making comparations
//| and conditions. Check the order of these. I'll place dummy characters for this example:
//|
//| if ((X && (Y && Z)) goto L_Start;
//|
//| It's saying, if Y and Z are true, the condition meets. Now let's replace that comparation
//| with another dummy character. We're doing (Y && Z) = G:
//|
//| if (X && G) goto L_Start;
//|
//| It's saying, if X and G are true, the condition meets, thus it has to go to L_Start.
//|
//| Now, the last part of the script, regarding the end of WoE time:
//|
//| if((gettime(4)==2) && (gettime(3)==23)) goto L_End;
//| if((gettime(4)==4) && (gettime(3)==23)) goto L_End;
//| if((gettime(4)==6) && (gettime(3)==18)) goto L_End;
//| end;
//|
//| This is the same as before, but it's checking for the day in the first gettime, and
//| the hour on the second. If both conditions are true, the WoE will end. We're checking
//| here for the end time, not the start.
//|
//| Another important thing is OnAgitInit: . This special label will be run as soon as the
//| castle data is loaded from the char data. So it will check for the above start and end time
//| to see if it's in WoE time, hence why the hours has to be checked.
//|
//| Now a example of how to set the WoE so it starts on Monday, at 4 pm and ends up at 10 pm:
//|
//| OnClock1600: //| 16:00 = 4 pm
//| OnClock2200: //| 22:00 = 10 pm
//|
//| OnAgitInit: //| there has to be ONLY ONE of these labels, so put the OnClock above this
//| //| and the checks below.
//|
//| if ((gettime(4)==1) && (gettime(3)>=16 && gettime(3)<22)) goto L_Start;
//|
//| if ((gettime(4)==1) && (gettime(3)==22) goto L_End;
//| end;//| VERY IMPORTANT TO PLACE AND END AFTER THE LAST END CHECK. You don't want to
//| //| start the WoE w/o being on the right times/day
//|
//| I hope this has been clear enough. Remember to put the checks in a logical way, e.g:
//| Monday checks first, then Thursday, etc.
//| Any questions Pm me (erKURITA) or go to irc channel on irc.deltaanime.net in #athena
//| channel. Do not PM on IRC w/o asking please.
//|
//| ~ erKURITA