Commit graph

44 commits

Author SHA1 Message Date
Ibrahim Zidan
f00c0f910e
Update copyrights for year 2026
Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
2026-06-28 21:05:37 +03:00
Haru
2c181a6d4a
Update copyrights for year 2025
Signed-off-by: Haru <haru@dotalux.com>
2025-02-01 00:44:18 +00:00
Guilherme G. Menaldo
2ca5601f3e
Add mestipbox script command 2024-06-08 15:26:23 -03:00
Guilherme G. Menaldo
524df5d5cd
Add mesurl script command 2024-06-08 15:26:22 -03:00
Guilherme G. Menaldo
f26053064c
Add mesmobspawn script command 2024-06-08 15:26:21 -03:00
Guilherme G. Menaldo
18ecdb1098
Add mesnavigation script command
basic command to generate navi tags following client-specific format
2024-06-08 15:26:17 -03:00
Haru
daca5167ed
Welcome to 2024, Hercules
(update copyright year in headers)

Signed-off-by: Haru <haru@dotalux.com>
2024-02-04 02:26:34 +01:00
Guilherme G. Menaldo
601e52ee5c
fix itemlink tests for pre-re
one of the cards used in the test is not available for pre-re, changing
to a card that is available in both
2023-10-19 00:13:56 -03:00
Guilherme G. Menaldo
06ed027da3
add getitemlink script command
this command creates a client-specific formatted tag with item info
2023-10-15 18:52:24 -03:00
Haru
59ff49cfbb
Replace the magic numbers in gettimetick() calls with the appropriate constants
Signed-off-by: Haru <haru@dotalux.com>
2023-08-12 23:56:42 +02:00
Haru
b9419153c8
Extend the F_TestCalendarNextTime test to include both the local and the UTC cases
Signed-off-by: Haru <haru@dotalux.com>
2023-08-12 23:56:40 +02:00
Haru
0453dfe61e
Happy 2023 Hercules
(Update copyright headers)

Signed-off-by: Haru <haru@dotalux.com>
2023-01-13 01:28:09 +01:00
Haru
2b4fec0deb
Update copyright headers for 2022
Happy 2022

Signed-off-by: Haru <haru@dotalux.com>
2022-01-05 20:25:22 +01:00
Haru
8a2c7563ca
Merge pull request #3072 from guilherme-gm/fix-getcalendartime
Fix getcalendartime when using current time
2021-11-03 13:17:35 +01:00
Haru
35e20e3237
Add support for conditional comments in the script engine
Conditional comments are similar to #ifdef directives in the C
preprocessor, allowing to exclude parts of a script depending on whether
a certain flag is enabled or not.

The feature is designed to offer backward compatibility to scripts that
use it, letting older engines seamlessly ignore the conditional part as
if it was a comment.

The structure of a conditional comment is the following:

// The following block is only parsed if FLAG is defined. If not
// defined, or when loaded by an older engine, the block is treated as a
// block comment.

/*@FLAG
.@x = 1;
//@*/

// The following block is only parsed if FLAG is not defined. If
// defined, or when loaded by an older engine, the block is treated as a
// block comment.

/*@!FLAG
.@x = 1;
//@*/

// The following block is only parsed if FLAG is defined. If not
// defined, the block is treated as a block comment. When loaded by an
older engine, the block is also parsed.

/*@FLAG*/
.@x = 1;
//@*/

// The following block is only parsed if FLAG is not defined. If
// defined, the block is treated as a block comment. When loaded by an
// older engine, the block is also parsed.

/*@!FLAG*/
.@x = 1;
//@*/

The following flags are currently always defined:

- TRUE
- HERCULES

The following flag is currently never defined and can be used to
temporarily disable blocks of code:

- FALSE

The following flags are currently conditionally defined, based on the
renewal/pre-renewal compile time toggle:

- RENEWAL
- PRERENEWAL

Plugins can define conditional flags at runtime by calling
script->declare_conditional_feature("FLAG_NAME"), allowing scripts to
behave differently when a plugin is loaded.

Signed-off-by: Haru <haru@dotalux.com>
2021-10-30 16:19:36 +02:00
Haru
34f34994f2
Enable test case for the lazy evaluation of the ternary conditional operator
Signed-off-by: Haru <haru@dotalux.com>
2021-10-27 20:47:38 +02:00
Haru
d2d5a9d6da
Add test cases with strings in the ternary operator condition
Signed-off-by: Haru <haru@dotalux.com>
2021-10-27 20:37:43 +02:00
Guilherme G. Menaldo
148976c37b Fix getcalendartime when using current time
When supplied with the current time, it had an inconsistent and
unexpected behavior of using the same day/time in some cases.
Now it will always point for the next day.

Also added a CI test and improved documentation to clarify this
2021-10-24 20:33:27 -03:00
Haru
830cea642e Happy 2021
Signed-off-by: Haru <haru@dotalux.com>
2021-01-12 04:00:33 +01:00
Haru
36aff97b92
Merge pull request #2671 from Helianthella/binliteral
add support for binary and octal number literals
2020-06-01 04:08:28 +02:00
gumi
01dd499bca
add unit tests for number separators 2020-05-07 16:05:25 -04:00
gumi
48849a0e2a
add unit tests for octal and binary literals 2020-05-07 16:05:25 -04:00
gumi
6aed6b4f7c
add more unit tests for local functions 2020-05-03 11:54:44 -04:00
Haru
da14478a8c
Update copyright headers for year 2020
Signed-off-by: Haru <haru@dotalux.com>
2020-01-13 03:24:07 +01:00
Emistry Haoyan
9f6ffd2f9a
Added *consolemes script command
- deprecated `*debugmes` script command.
- added `*consolemes` script command which display the console message based on `type`.
- allow map-server console to auto logging into text file depend on type of message.
2019-04-29 00:44:32 +08:00
gumi
5219e2e3d0
add unit tests for data_to_string 2018-10-22 15:26:36 -04:00
gumi
55f6666026
add more unit tests for getd 2018-10-01 21:57:34 -04:00
gumi
4118b1135e
push constants as C_NAME in the script buffer 2018-07-30 14:47:16 -04:00
AnnieRuru
4146cf9207 Fix pre-increment / pre-decrement operator error
eg: if (1) ++.@i;
2018-06-14 01:38:03 +08:00
Haru
2623a35e45 Add tests for getdatatype
Signed-off-by: Haru <haru@dotalux.com>
2017-07-11 11:23:15 +02:00
Haru
392c4b225d
Add tests for the exponentiation operator
Signed-off-by: Haru <haru@dotalux.com>
2017-06-03 17:03:26 +02:00
Haru
e384a7f216
Replaced some unsupported symbols in AegisNames (step 2)
This removes the remaining unsupported symbols (despite they being
official names) in AegisNames: The apostrophe (`'`) sign is suppressed.

The full replacement rules (cumulative with the step 1 commit) are thus:

- Any apostrophe is suppressed.
- Any non-`[A-Za-z0-9_]` character is replaced with an underscore (`_`).
- If the replaced symbol is at a word boundary (beginning or end of the
  string, or next to another underscore), it is suppressed instead.
- If the replacement causes an AegisName conflict, underscores are
  appended appropriately.

Signed-off-by: Haru <haru@dotalux.com>
2016-11-20 18:10:45 +01:00
Haru
ba035696cf
Re-implemented BUILDIN(sprintf)
- The function now checks its arguments, rather than passing them to
  the system implementation (safer against arbitrary memory access or
  wrong variable type)
- Implemented positional ('%1$d') specifiers (POSIX style)
- See script_commands.txt for details about the supported format
  specifiers.

Signed-off-by: Haru <haru@dotalux.com>
2016-06-25 17:29:42 +02:00
AnnieRuru
efaaf842dc Replace -1,{ with FAKE_NPC,{
replace using Notepad++
2015-12-31 23:39:22 +01:00
Haru
d4832df692 Standardized header in scripts (part 14)
- Now including GPL-compliant license/copyright info
- Restored some missing copyrights
- Other scripts folders

Signed-off-by: Haru <haru@dotalux.com>
2015-12-15 20:53:53 +01:00
Haru
1dd61c6732 Added script_mapquit plugin (moved from the StaffPlugins repository)
The plugin is used by the Travis CI build, and it makes more sense to be
present here, so that it can be kept up to date when the HPM is
updated, to avoid build failures.

Signed-off-by: Haru <haru@dotalux.com>
2015-08-13 16:20:52 +02:00
Haru
948be86481 Added getvariableofnpc checks to the test suite
Signed-off-by: Haru <haru@dotalux.com>
2015-04-25 19:34:33 +02:00
Haruna
0f7a7933f8 Merge pull request #502 from k-py/bugfix-return-getvariableofnpc
Fix script function return always removing references from NPC variables.
2015-04-25 19:32:45 +02:00
Haru
5968552a39 Added set reference testcase to the script test suite
Signed-off-by: Haru <haru@dotalux.com>
2015-04-25 19:11:14 +02:00
Kpy!
79aa56c704 Fix script function return always removing references from NPC variables.
Bugreport:8642 http://hercules.ws/board/tracker/issue-8642-script-engine-issue-quo/
2015-04-21 21:24:47 +02:00
Haru
6b20c5b698 Added min() and max() script commands
- Special thanks to Streusel, Xgear

Signed-off-by: Haru <haru@dotalux.com>
2014-11-02 01:34:58 +01:00
Haru
23f7856488 Travis improvements
- Parallelized pre-re and re tests
- Added mapserver and script engine tests: this means that travis will
  detect parse errors in scripts as well as the source now)

Signed-off-by: Haru <haru@dotalux.com>
2014-05-10 22:53:03 +02:00
Haru
84c1d0dd15 Improved the self-test script
- Moved tests into a function, so that they can be easily called by
  external scripts. Ensured that the tests are only executed once.

Signed-off-by: Haru <haru@dotalux.com>
2014-05-09 07:40:42 +02:00
Haru
21aeb5aa1d Created npc/dev/ folder for scripts with development or testing purposes.
- Moved npc/custom/test.txt to npc/dev/test.txt
- Special thanks to AnnieRuru for the idea.

Signed-off-by: Haru <haru@dotalux.com>
2014-03-18 02:07:01 +01:00