summaryrefslogtreecommitdiff
path: root/doc/woe_time_explanation.txt
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-04 20:23:22 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-04 22:56:41 +0300
commitd6b5551bff867250edcdc36455ef32844ee2b935 (patch)
tree16acaf1c9a81b58ceb21bc4524a087c14f23735f /doc/woe_time_explanation.txt
parent905dada713af49bb610177c4842685628a1c0a97 (diff)
downloadserverdata-d6b5551bff867250edcdc36455ef32844ee2b935.tar.gz
serverdata-d6b5551bff867250edcdc36455ef32844ee2b935.tar.bz2
serverdata-d6b5551bff867250edcdc36455ef32844ee2b935.tar.xz
serverdata-d6b5551bff867250edcdc36455ef32844ee2b935.zip
convert server data for using with hercules.
Diffstat (limited to 'doc/woe_time_explanation.txt')
-rw-r--r--doc/woe_time_explanation.txt102
1 files changed, 102 insertions, 0 deletions
diff --git a/doc/woe_time_explanation.txt b/doc/woe_time_explanation.txt
new file mode 100644
index 00000000..9f288eae
--- /dev/null
+++ b/doc/woe_time_explanation.txt
@@ -0,0 +1,102 @@
+//===== Hercules Documentation ===============================
+//= WoE Time Explanation
+//===== By: ==================================================
+//= erKURITA
+//===== Current Version: =====================================
+//= 20120717
+//===== Description: =========================================
+//= Details on the behavior of the default WoE controller.
+//============================================================
+
+There are 2 main commands that determine WoE times:
+OnClock<time>: and gettime(<type>).
+
+OnClock<time> triggers when <time> is reached.
+The format is HHMM, where H = hour, M = minute.
+OnClock2350: would run at 23:50, server time.
+
+gettime(<type>) is a function that checks for certain
+information regarding time. The types are:
+
+ 1 - Seconds (of a minute)
+ 2 - Minutes (of an hour)
+ 3 - Hour (of a day), ranging from 0 to 23
+ 4 - Weekday, ranging from 0 (Sunday) to 6 (Saturday)
+ 5 - Day of the month
+ 6 - Number of the month
+ 7 - Year
+ 8 - Day of the year
+
+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, reaching the next check:
+
+ 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 Start and End times run
+through the same chain of commands, these are important 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 (Tuesday). The function will
+return either 1 (true) or 0 (false).
+
+The second gettime is checking type 3, the hour, and it's comparing
+it to 21. If the first part is greater than or equal to (>=) the second part,
+the comparison will return 1.
+
+The third and last gettime is checking again for the hour, but the time has to be less
+than the specified time (in this case, 23).
+
+Now, look at the parentheses. Parentheses are very important when making comparisons
+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 is met. Now let's use another set
+of dummy characters. We're checking if (Y && Z) = G:
+
+ if (X && G) goto L_Start;
+
+It's saying that if X and G are true, the condition is met, thus proceeding 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, 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. It will check for the above start and end times
+to see if it's in WoE time, hence why the hours have to be checked.
+
+-------------------------------------------------------------------------------
+
+An 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: // This can only be written once: put OnClock above 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; // Don't forget this!