woe_time_explanation.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //| ~~~~~ How to set WoE times, by erKURITA: ~~~~~
  2. //|
  3. //| Basically, there are 2 commands that affects the WoE times,
  4. //| OnClock<time>: and gettime(<type).
  5. //|
  6. //| OnClock<time> runs when the said time where <time> is has been reached.
  7. //| The format of time is hhmm, being h = hour, m = minute.
  8. //| OnClock2350: would run at 23:50 on Computer's time.
  9. //|
  10. //| gettime(<type) is a function which is used to make a check
  11. //| for a desired amount of information regarding time. The types are:
  12. //| 1 - Seconds (of a minute)
  13. //| 2 - Minutes (of an hour)
  14. //| 3 - Hour (of a day). Hour goes from 0 to 23.
  15. //| 4 - Week day (0 for Sunday, 6 is Saturday)
  16. //| 5 - Day of the month.
  17. //| 6 - Number of the month.
  18. //| 7 - Year.
  19. //| 8 - Day of the year.
  20. //|
  21. //| Days (explained later) :
  22. //| Monday = 1
  23. //| Tuesday = 2
  24. //| Wednesday = 3
  25. //| Thursday = 4
  26. //| Friday = 5
  27. //| Saturday = 6
  28. //| Sunday = 0
  29. //|
  30. //| This way, we can check for a desired minute, hour, day, month, etc.
  31. //|
  32. //| Now the structure:
  33. //|
  34. //| OnClock2100: //start time for Tues(2), Thurs(4)
  35. //| OnClock2300: //end time for Tues(2), Thurs(4)
  36. //| OnClock1600: //start time for Sat(6)
  37. //| OnClock1800: //end time for Sat(6)
  38. //|
  39. //| These 4 labels will run one after the other. It's acomodated so,
  40. //| The Tuesday at 21:00 and 23:00 they will run, and go to the next
  41. //| part of the script:
  42. //|
  43. //| if((gettime(4)==2) && (gettime(3)>=21 && gettime(3)<23)) goto L_Start;
  44. //| if((gettime(4)==4) && (gettime(3)>=21 && gettime(3)<23)) goto L_Start;
  45. //| if((gettime(4)==6) && (gettime(3)>=16 && gettime(3)<18)) goto L_Start;
  46. //|
  47. //| This part will check for the times. Since both Starting and Ending times
  48. //| run through the same chain of commands, there are necesary checks to ensure
  49. //| it's the right time. Let's take the following example:
  50. //|
  51. //| if((gettime(4)==2) && (gettime(3)>=21 && gettime(3)<23))
  52. //|
  53. //| The first gettime is checking for a type 4, the day of the week, and it's
  54. //| comparing it to the one desired, which is 2, that's Tuesday. If the comparation
  55. //| is true and both sides are equal, it will return 1. 1 means true, 0 means false
  56. //| in comparations and conditions.
  57. //|
  58. //| The second gettime is checking for a type 3, which is the hour, and it's
  59. //| comparing it to 21, and if the first part is greater or equal (>=) than the second,
  60. //| the comparation will return 1.
  61. //|
  62. //| The third and last gettime is checking again for the hour, but the time has to be less
  63. //| than the said time, in this case, 23.
  64. //|
  65. //| Now, look at the parentheses. Parentheses are very important when making comparations
  66. //| and conditions. Check the order of these. I'll place dummy characters for this example:
  67. //|
  68. //| if ((X && (Y && Z)) goto L_Start;
  69. //|
  70. //| It's saying, if Y and Z are true, the condition meets. Now let's replace that comparation
  71. //| with another dummy character. We're doing (Y && Z) = G:
  72. //|
  73. //| if (X && G) goto L_Start;
  74. //|
  75. //| It's saying, if X and G are true, the condition meets, thus it has to go to L_Start.
  76. //|
  77. //| Now, the last part of the script, regarding the end of WoE time:
  78. //|
  79. //| if((gettime(4)==2) && (gettime(3)==23)) goto L_End;
  80. //| if((gettime(4)==4) && (gettime(3)==23)) goto L_End;
  81. //| if((gettime(4)==6) && (gettime(3)==18)) goto L_End;
  82. //| end;
  83. //|
  84. //| This is the same as before, but it's checking for the day in the first gettime, and
  85. //| the hour on the second. If both conditions are true, the WoE will end. We're checking
  86. //| here for the end time, not the start.
  87. //|
  88. //| Another important thing is OnAgitInit: . This special label will be run as soon as the
  89. //| castle data is loaded from the char data. So it will check for the above start and end time
  90. //| to see if it's in WoE time, hence why the hours has to be checked.
  91. //|
  92. //| Now a example of how to set the WoE so it starts on Monday, at 4 pm and ends up at 10 pm:
  93. //|
  94. //| OnClock1600: //| 16:00 = 4 pm
  95. //| OnClock2200: //| 22:00 = 10 pm
  96. //|
  97. //| OnAgitInit: //| there has to be ONLY ONE of these labels, so put the OnClock above this
  98. //| //| and the checks below.
  99. //|
  100. //| if ((gettime(4)==1) && (gettime(3)>=16 && gettime(3)<22)) goto L_Start;
  101. //|
  102. //| if ((gettime(4)==1) && (gettime(3)==22) goto L_End;
  103. //| end;//| VERY IMPORTANT TO PLACE AND END AFTER THE LAST END CHECK. You don't want to
  104. //| //| start the WoE w/o being on the right times/day
  105. //|
  106. //| I hope this has been clear enough. Remember to put the checks in a logical way, e.g:
  107. //| Monday checks first, then Thursday, etc.
  108. //| Any questions Pm me (erKURITA) or go to irc channel on irc.deltaanime.net in #athena
  109. //| channel. Do not PM on IRC w/o asking please.
  110. //|
  111. //| ~ erKURITA