summaryrefslogtreecommitdiff
path: root/src/map/script.h
AgeCommit message (Collapse)AuthorFilesLines
2015-12-15Added GPL-compliant header to all sources and build scriptsHaru1-4/+20
Signed-off-by: Haru <haru@dotalux.com>
2015-12-15Added const qualifier to the w1~w4 arguments of npc_parse_scriptHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-11-14Changed struct script_queue_iterator::item into a VECTOR and Renamed to ↵Haru1-3/+3
::entries Signed-off-by: Haru <haru@dotalux.com>
2015-11-14Changed struct script_queue::item into a VECTOR and Renamed to ::entriesHaru1-5/+4
Signed-off-by: Haru <haru@dotalux.com>
2015-11-14Renamed hQueue/hQueueIterator/hQueueOpt to latest standardsHaru1-23/+30
Signed-off-by: Haru <haru@dotalux.com>
2015-11-14Changed script->hq and script->hqi into VECTOR typeHaru1-3/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-10-01Split function set_reg and get_val into functions based on variable types.Andrei Karas1-0/+16
2015-08-15HPM compatibility improvementsHaru1-3/+3
Improved compatibility, portability and standards conformance. - Since it is not possible to portably and reliably re-use the core's symbols in plugins, symbols are no longer exported unless explicitly required, in the UNIX builds. This mimics the Windows behavior and adds HPM compatibility to OSes such as FreeBSD. Credits to Andrei Karas for making this possible. - For convenience, it is no longer necessary to call GET_SYMBOL, since the plugin will automatically import all the available symbols when it's loaded, depending on the included headers. - Plugins are now supposed to include the "common/hercules.h" header before including anything else. Incluing common/HPMi.h, common/cbasetypes.h or conf/core.h is no longer necessary, as those are guaranteed to be automatically included by hercules.h. - HPM API version bumped to 1.1. Signed-off-by: Haru <haru@dotalux.com>
2015-08-10Add script interface function run_pet. It do same thing as run.Andrei Karas1-0/+1
2015-08-10Add script interface function run_npc. It do same thing as run.Andrei Karas1-1/+2
2015-08-10Move unequip item script function call into function ↵Andrei Karas1-0/+1
script_run_item_unequip_script.
2015-08-10Move equip item script function call into function script_run_item_equip_script.Andrei Karas1-0/+2
2015-08-10Move use item script function call into function script_run_use_script.Andrei Karas1-0/+1
2015-06-19Removed ".." from include directivesHaru1-7/+7
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
2015-03-15Follow up 330e31cc71ece055908acb1eb967b4009ebc9c46shennetsind1-0/+1
Fixed an issue caused by unescaped characters being written and read out of the .pot unproperly. This commit also causes map server to print the file it wrote to when terminating Signed-off-by: shennetsind <ind@henn.et>
2015-02-23Hercules Ultimate Localization Designshennetsind1-0/+52
Servers can now run on any number of languages, without editing npc files. Designed by Haruna and Ind http://hercules.ws/board/topic/8687-hercules-ultimate-localization-design/ Signed-off-by: shennetsind <ind@henn.et>
2015-01-12Blocked compilation of plugins that use unavailable functionsHaru1-0/+2
- Rather than failing at runtime, plugins that try to access non-interfaced, unavailable functions or variables, will now show an error at compile-time. Signed-off-by: Haru <haru@dotalux.com>
2014-12-16Add function what call OnUntouch event.Andrei Karas1-0/+1
2014-11-16Whitespace cleanup (no code changes)Haru1-9/+9
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
2014-11-14Add ability to add deprecated command from scripts and plugins.Andrei Karas1-1/+1
2014-10-28Removed some temporary case-check error messages.Haru1-2/+1
- Control flow statements (break, case, continue, default, do, for, if, switch, whilei, else) and sub-function declarations (function) will no longer show a custom error message when they are incorrectly capitalized. - Note: This does not mean that they are no longer case-sensitive. This only means that no special message will be shown in case such an error is detected. The script engine will throw a normal error, as it would with any other kind of typo, rather than treating this as a special case. Enough time was given to update third party scripts, and it is now time to clean up our parsing code and get rid of these special warnings. - Variables, labels and commands will still show a warning for the time being, since the side-effects of silently ignoring it could be quite dangerous. An alternative approach to the case-check will be presented in future. For now, those who want to disable it (and save a bit on execution time and memory use), can simply comment out the #define ENABLE_CASE_CHECK line in script.h, as usual. Signed-off-by: Haru <haru@dotalux.com>
2014-10-28Removed some temporary case-check error messages.Haru1-1/+0
- Top level commands (function, warp, shop, cashshop, script, trader, duplicate, monster, boss_monster, mapflag) will no longer show a custom error message when they are incorrectly capitalized. - Note: This does not mean that the commands are no longer case-sensitive. This only means that no special message will be shown in case such an error is detected. The script engine will throw a normal error, as it would with any other kind of typo, rather than treating this as a special case. Enough time was given to update third party scripts, and it is now time to clean up our parsing code and get rid of these special warnings. Signed-off-by: Haru <haru@dotalux.com>
2014-10-27Added source support to mark script commands as deprecatedHaru1-0/+4
- Commands marked as deprecated will trigger a warning when the script is loaded. (there are currently no commands marked as such, but some will come soon) Signed-off-by: Haru <haru@dotalux.com>
2014-10-18Renamed DeprecationWarning to DeprecationCaseWarning, since that's what it ↵Haru1-3/+3
is about. Signed-off-by: Haru <haru@dotalux.com>
2014-07-11Fixed reserved __identifier violationsHaru1-3/+3
- Complies with CERT DCL37-C - Fixes issue #293 (special thanks to elfring) Signed-off-by: Haru <haru@dotalux.com>
2014-05-16Follow-up to b6b3f58795288701d0e162d43fa6f0a47af913b3Haru1-1/+1
- Includes in some files weren't sorted alphabetically. Special thanks to KeiKun. Signed-off-by: Haru <haru@dotalux.com>
2014-05-10Re-commit of "Fixed order of includes in all source files"Haru1-5/+7
This reverts commit 94657284973f4037596bae468ebfbee5c217e02b.
2014-05-10Revert "Fixed order of includes in all source files"panikon1-7/+5
This reverts commit b6b3f58795288701d0e162d43fa6f0a47af913b3. Fixes issue 8184 http://hercules.ws/board/tracker/issue-8184-cart-related/
2014-05-09Fixed order of includes in all source filesHaru1-5/+7
- Changed order according to the (upcoming) code style guidelines. - Fixes several issues caused by missing headers when their include order is changed or in plugins. Signed-off-by: Haru <haru@dotalux.com>
2014-05-09Return EXIT_FAILURE if a script parse error occurred.Haru1-1/+1
- This affects normal execution as well as ./script-checker runs. Signed-off-by: Haru <haru@dotalux.com>
2014-03-17Added regular expression matching script commands and operatorsHaru1-0/+4
- The script command pcre_match and the operator ~= will return the number of regular expression matches in a given string (roughly equivalent to the php function preg_match or the perl operator =~) - The operator ~! is the opposite of ~= (roughly equivalent to the perl operator !~) - See script_commands and npc/custom/test.txt for more information. Signed-off-by: Haru <haru@dotalux.com>
2014-03-14Added internal awareness of active script instancesshennetsind1-1/+2
Fixes the following issues: - donpcevent could cause a crash when used to a event of the same npc - input/other-dialog-interactions could cause a crash when sending data to a disabled-fakenpc-id'd. Special Thanks to Haruna, ossi0110. Signed-off-by: shennetsind <ind@henn.et>
2014-03-10Fixed a crash caused by NPC variable references in callfuncHaru1-0/+3
- Fixes bugreport:8074, thanks to ahmadshidqi http://hercules.ws/board/tracker/issue-8074-help-crash/ - Also fixed some DBMap allocation mistakes introduced in 4f3156b. - Added testcases to the self-test script. - Made possible thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2014-03-05Corrected same-reference check to work on vars with the same name in ↵Haru1-0/+7
different scopes - Fixes bugreport:8008, special thanks to KeyWorld http://hercules.ws/board/tracker/issue-8008-copyarray-fail-on-a-referenced-array-argument/ Signed-off-by: Haru <haru@dotalux.com>
2014-03-05Ref redesign, part 3Haru1-13/+13
- Updated several functions to properly use the data structures defined in parts 1 and 2. - Special thanks to Ind for his help on this, as well as the previous two parts. - Fixes some crashes related to variable references passed back and forth between nested callfunc/callsub scopes (related: 2669e9a, 3259f89, 4f2de07) Signed-off-by: Haru <haru@dotalux.com>
2014-03-05Ref redesign, part 2Haru1-12/+18
- Reorganized regs var/array DBMaps into a specific reg_db structure Signed-off-by: Haru <haru@dotalux.com>
2014-03-05Ref redesign, part 1Haru1-11/+0
- Moved string and numeric mapregs into the same DBMap (for consistency with the other reg types.) Signed-off-by: Haru <haru@dotalux.com>
2014-02-26Improved mapindex_name2id errors for scriptsshennetsind1-0/+1
NPC Error is now printed as well as the original message as proposed by Emistry in http://hercules.ws/board/topic/1864-mapindex-name2id-display-which-npc-caused-this/ Special Thanks to Haru! Signed-off-by: shennetsind <ind@henn.et>
2014-02-26Removed Option_ constants from const.txt, now input directly from the sourceshennetsind1-0/+2
a benefit, for example, would be that the compounds are always up to date regardless if new members are added, also added a new compound OPTION_COSTUME Special Thanks to Haruna, and AnnieRuru for pointing out constdb's outdatedness. Signed-off-by: shennetsind <ind@henn.et>
2014-02-11Fixed issue with referenced array operationsshennetsind1-3/+3
Did not affect write/read, except getarraysize and deletearray. Special Thanks to Haru! Signed-off-by: shennetsind <ind@henn.et>
2014-02-09Follow-up to 7b19f964b88dffcfdc8c12648d5e4ee8a26a9504Haru1-1/+0
- Fixes bugreport:8015, thanks to N e s s http://hercules.ws/board/tracker/issue-8015-error-in-compiling-in-debian-linux-latest-rev/ Signed-off-by: Haru <haru@dotalux.com>
2014-02-09Improved script case check reports to include more accurate source info.Haru1-2/+4
- Fixes bugreport:8013, thanks to Dastgir Pojee http://hercules.ws/board/tracker/issue-8013-script-add-str-problem/ Signed-off-by: Haru <haru@dotalux.com>
2014-02-08Improvements on the script commands sscanf, axtoi. Added strtol.Haru1-1/+0
- Added script command strtol (conforming to the ISO C90 function) - Modified script command axtoi to internally use strtol instead of an unnecessary own implementation. - Fixed sscanf behavior to conform to the C specifications in case the input string is empty. It now correctly returns -1, or 0 if the format string is also empty. Fixes bugreport:8009, thanks to AnnieRuru - http://hercules.ws/board/tracker/issue-8009-sscanf-should-return-1-if-the-string-field-is-an-empty-string/ Signed-off-by: Haru <haru@dotalux.com>
2014-02-02Introducing HPM Datacheckshennetsind1-3/+3
http://hercules.ws/board/topic/4283-introducing-hpm-datacheck/ Signed-off-by: shennetsind <ind@henn.et>
2014-01-13Improved overwriting priority of variables/constants/parametersHaru1-1/+0
- Fixes issue 7968, thanks to Moguri http://hercules.ws/board/tracker/issue-7968-trader-npc-not-working/ - Corrected sprite name for KO_KAGE to match latest kRO info (previouly KO_ZANZOU, conflicting with a Kagerou/Oboro skill identifier) - Updated self-test script to include checks for constants and for setd and getd. - Made possible thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2014-01-12Adjusted indexing of vars with index 0shennetsind1-0/+1
Special Thanks to Haruna. Also fixed a compiler warning, thanks to ossi0110 Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Hercules 1st 2014 MegaPatchshennetsind1-20/+53
http://hercules.ws/board/topic/3886-hercules-1st-2014-megapatch/ Signed-off-by: shennetsind <ind@henn.et>
2013-12-30Added support for string vars on commands that require a stringHaru1-1/+3
- Fixes bugreport:7901, thanks to Angelmelody http://hercules.ws/board/tracker/issue-7901-about-pass-variable-type-as-function-parameter - Bonus: debugmes can now take both strings and numbers (i.e. to print a number variable you no longer need to do 'debugmes "" + .@num;') Signed-off-by: Haru <haru@dotalux.com>
2013-12-17Fixed several compiler warningsHaru1-3/+2
- Warnings detected thanks to Xcode's compiler settings (more strict by default) and clang, warnings mostly but not only related to data sizes on 64 bit systems, that were silenced until now by very lax compiler settings. - This also decreases by a great deal the amount of warnings produced by MSVC in x64 mode (for the adventurous ones who tried that) - Also fixed (or silenced in case of false positives) the potential issues pointed out by the (awesome) clang static analyzer. - Patch co-produced with Ind, I'm merging and committing in his place! Signed-off-by: Haru <haru@dotalux.com>
2013-12-05Improved script builtin function parserHaru1-0/+1
- Removed duplicate code shared between script_hp_add and script_parse_builtin. - Improved error handling in script_hp_add to be on par with the script_parse_builtin version. - Added script->add_builtin function, providing a hooking point for plugins (i.e. text editor syntax definition generators) to obtain the builtin commands list. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>