summaryrefslogtreecommitdiff
path: root/server/scripts/woe_time_explanation.txt
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-29 22:09:19 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-29 22:09:19 +0300
commit39fa4991f1ce803da04fae342d5ab64111a3df5e (patch)
tree585dbfb0d6800a8a3bc4d3bec3eb8d41e23894e1 /server/scripts/woe_time_explanation.txt
parent61d35617036a2170160e91fdc8f93410ae7d0e3e (diff)
downloaddocs-39fa4991f1ce803da04fae342d5ab64111a3df5e.tar.gz
docs-39fa4991f1ce803da04fae342d5ab64111a3df5e.tar.bz2
docs-39fa4991f1ce803da04fae342d5ab64111a3df5e.tar.xz
docs-39fa4991f1ce803da04fae342d5ab64111a3df5e.zip
Add all existing server docs.
Diffstat (limited to 'server/scripts/woe_time_explanation.txt')
-rw-r--r--server/scripts/woe_time_explanation.txt97
1 files changed, 97 insertions, 0 deletions
diff --git a/server/scripts/woe_time_explanation.txt b/server/scripts/woe_time_explanation.txt
new file mode 100644
index 0000000..d030355
--- /dev/null
+++ b/server/scripts/woe_time_explanation.txt
@@ -0,0 +1,97 @@
+//===== Hercules Documentation ===============================
+//= WoE Time Explanation
+//===== By: ==================================================
+//= erKURITA
+//===== Current Version: =====================================
+//= 20151115
+//===== 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. For more information about it, see script_commands.txt.
+
+-------------------------------------------------------------------------------
+
+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(GETTIME_WEEKDAY) == TUESDAY && gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23) ||
+ (gettime(GETTIME_WEEKDAY) == THURSDAY && gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23) ||
+ (gettime(GETTIME_WEEKDAY) == SATURDAY && gettime(GETTIME_HOUR) >= 16 && gettime(GETTIME_HOUR) < 18)) {
+ agitstart();
+ }
+
+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(GETTIME_WEEKDAY) == TUESDAY && gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23)
+
+The first gettime() is checking for type GETTIME_WEEKDAY, the day of the week,
+and it's comparing it to the one desired, which is TUESDAY. The function will
+return either 1 (true) or 0 (false).
+
+The second gettime is checking type GETTIME_HOUR, 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, the last part of the script, regarding the end of WoE time:
+
+ if ((gettime(GETTIME_WEEKDAY) == TUESDAY && gettime(GETTIME_HOUR) == 23) ||
+ (gettime(GETTIME_WEEKDAY) == THURSDAY && gettime(GETTIME_HOUR) == 23) ||
+ (gettime(GETTIME_WEEKDAY) == SATURDAY && gettime(GETTIME_HOUR) == 18)) {
+ agitend();
+ }
+
+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 label should appear once and only once in the script
+
+ // starting time checks
+ if (gettime(GETTIME_WEEKDAY) == MONDAY && gettime(GETTIME_HOUR) >= 16 && gettime(GETTIME_HOUR) < 22) {
+ if (!agitcheck()) {
+ agitstart;
+ callsub S_DisplayOwners;
+ }
+ end;
+ }
+
+ // end time checks
+ if (gettime(GETTIME_WEEKDAY) == MONDAY && gettime(GETTIME_HOUR) == 22) {
+ if (agitcheck()) {
+ agitend;
+ callsub S_DisplayOwners;
+ }
+ end;
+ }
+ end; // Don't forget this!