summaryrefslogtreecommitdiff
path: root/doc/script_commands.txt
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-11-15 00:54:33 +0100
committerHaru <haru@dotalux.com>2015-11-15 00:57:00 +0100
commit34037c40d28c9fe179d930949320090448b249e9 (patch)
tree3fe4d79c6185df4f165beae47cc3e7a286ce5af8 /doc/script_commands.txt
parent8ee5eafc741d581579efd696765fb0646b72a553 (diff)
downloadhercules-34037c40d28c9fe179d930949320090448b249e9.tar.gz
hercules-34037c40d28c9fe179d930949320090448b249e9.tar.bz2
hercules-34037c40d28c9fe179d930949320090448b249e9.tar.xz
hercules-34037c40d28c9fe179d930949320090448b249e9.zip
Fixed too-generic constant names of gettime() types
- Follow-up to 3bd77ffc0daca508352834add828766490075aee - The names were too generic (not namespaced), and were easily clashing with custom (and potential future official) constants or variables. - Constants are now prefixed with a 'GETTIME_' namespace: - GETTIME_SECOND - GETTIME_MINUTE - GETTIME_HOUR - GETTIME_WEEKDAY - GETTIME_DAYOFMONTH - GETTIME_MONTH - GETTIME_YEAR - GETTIME_DAYOFYEAR - Fixed some excessive (and some times incorrect) parentheses in various scripts using gettime(). - Updated documentation. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'doc/script_commands.txt')
-rw-r--r--doc/script_commands.txt38
1 files changed, 18 insertions, 20 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 5219eed47..dff4461af 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -3181,30 +3181,28 @@ Valid types are :
This function returns specified information about the current system time.
-Valid types are listed in const.txt:
- 1 - SECOND - Seconds (of a minute)
- 2 - MINUTE - Minutes (of an hour)
- 3 - HOUR - Hour (of a day)
- 4 - WEEKDAY - Week day (0 for Sunday, 6 is Saturday)
- - Additional: (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
- 5 - DAYOFMONTH - Day of the month.
- 6 - MONTH - Number of the month.
- - Additional: ( JANUARY,FEBRUARY,MARCH,APRIL,MAY,JUNE,JULY,AUGUST,SEPTEMBER,OCTOBER,NOVEMBER,DECEMBER)
- 7 - YEAR - Year.
- 8 - DAYOFYEAR - Day of the year.
+Valid types:
+ 1 - GETTIME_SECOND - Seconds (of a minute)
+ 2 - GETTIME_MINUTE - Minutes (of an hour)
+ 3 - GETTIME_HOUR - Hour (of a day)
+ 4 - GETTIME_WEEKDAY - Week day (0 for Sunday, 6 is Saturday)
+ - Additional: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
+ 5 - GETTIME_DAYOFMONTH - Day of the month.
+ 6 - GETTIME_MONTH - Number of the month.
+ - Additional: JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER
+ 7 - GETTIME_YEAR - Year
+ 8 - GETTIME_DAYOFYEAR - Day of the year.
It will only return numbers based on types.
Example :
- if ( gettime(WEEKDAY) == SATURDAY ) {
+ if (gettime(GETTIME_WEEKDAY) == SATURDAY) {
mes "It's a Saturday. I don't work on Saturdays.";
+ } else if (gettime(GETTIME_MONTH) == JANUARY) {
+ mes "It's January. I don't work on January.";
+ } else if (gettime(GETTIME_MONTH) == OCTOBER && gettime(GETTIME_DAYOFMONTH) == 31) {
+ mes "It's Halloween.";
}
- else if ( gettime(MONTH) == JANUARY ) {
- mes "It's a January. I don't work on January.";
- }
- else if ( gettime(MONTH) == OCTOBER && gettime(DAYOFMONTH) == 31 ) {
- mes "It's a Halloween.";
- }
-
+
---------------------------------------
*gettimestr(<format string>,<max length>)
@@ -7578,7 +7576,7 @@ OnClock0600:
end;
OnInit:
// setting correct mode upon server start-up
- if(gettime(3)>=6 && gettime(3)<18) end;
+ if (gettime(GETTIME_HOUR) >= 6 && gettime(GETTIME_HOUR) < 18) end;
OnClock1800:
night;
end;