summaryrefslogtreecommitdiff
path: root/src/map/script.h
AgeCommit message (Collapse)AuthorFilesLines
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>
2013-12-02Fixed an uninitialized variable / broken code.Haru1-1/+1
- Follow up to c6c2ad187c386d8d27d3336dcbdd5a92555493d2 - Special thanks to Ind Signed-off-by: Haru <haru@dotalux.com>
2013-12-01Changed variables, labels, functions, commands to case sensitive.Haru1-12/+18
- Fixes bugreport:7810, thanks to Wend, kyeme, evilpuncker, jaBote, and various other people I may be forgetting to mention http://hercules.ws/board/tracker/issue-7810-disguise-script-command - Due to the nature of this change, I'm leaving the deprecation messages lingering around for a while more (as errors rather than warnings), to make sure they won't pass unnoticed, in case you haven't yet updated your custom scripts to comply with this. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-12-01Changed builtin keywords in the script engine to case sensitive.Haru1-2/+2
- Any scripts using the wrong case, that were throwing deprecation warnings until now, will become invalid. - Related to bugreport:7810. Signed-off-by: Haru <haru@dotalux.com>
2013-11-28Added pre de/increment operators. Fixed post de/increment operators.Haru1-2/+4
- [ This commit is part of a larger script engine related update ] - Suffix ++ and -- operators now behave like in other languages (updating the variable *after* its value is returned.) - Prefix ++ and -- operators are added for parity with other scripting/programming languages. They update the variable they're applied to *before* returning its value. - Please note that the implementation of the prefix form of those operators (like it happens in most languages) is more efficient than the suffix form. '++.@i' is (slightly) faster than '.@i++', or at least not slower. - Fixed some outdated script debug functions. - Follow-up to c18f438. Signed-off-by: Haru <haru@dotalux.com>
2013-11-22Minor HPMi Sub Modificationsshennetsind1-1/+0
- HPMi->addCommand is now addAtcommand, dropped usage of ACMD_A() - HPMi->addScript is now addScriptCommand, dropped usage of BUILDIN_A() - HPMi->addCPCommand is now addCPCommand, dropped necessity of CPCMD_A() - HPMi->addPacket is now addPacket, 5th param (HPMi->pid) is now automatically filled by the macro, therefore param count drops to 4 (packetID,packetLength,packetFunction,packetIncomingPoint). There is no longer necessity to check for the availability of the commands, the macros will do it on their own and drop a warning about it upon failure. These changes won't affect pre-compiled plugins. Signed-off-by: shennetsind <ind@henn.et>
2013-11-19Sanitized and improved several macros through the codeHaru1-17/+20
- Sanitized all potentially unsafe macros (related eA:15259) - Improved some function-like macros to evaluate their argument only once and keep it in a temporary variable. This improves performance in the damage calculation related code. Signed-off-by: Haru <haru@dotalux.com>
2013-11-11Follow-up to dd05ae388d69e7df1dffcd393cea5e4cdc605e75Haru1-0/+12
- Reduced number of false positives when parsing .@scope variables. - Added correct error source information where it previously said 'source not found'. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-11-10Added deprecation messages for incorrect capitalization in scriptsHaru1-0/+6
- These messages are temporary, only meant to help those with custom scripts to transition them to the correct case-sensitive syntax. If you ignore the deprecation messages you encounter, your scripts may continue to work just as they did until now, but this will no longer be true in the near future, and they may stop working at any time. If you ignore this, and your scripts break, you'll get to keep the pieces :) Signed-off-by: Haru <haru@dotalux.com>
2013-11-09Consolidated commands called in scripts to their lowercase versionHaru1-2/+2
- Added a note about variables and command scripts case sensitivity. Even though the engine still accepts variable, function and command names in a case insensitive way, it is discouraged to rely on such behavior. Please update your custom scripts as soon as possible. Signed-off-by: Haru <haru@dotalux.com>
2013-11-07Item Bound Fixes/Adjustments/Improvementsshennetsind1-0/+1
Special Thanks to Haruna Signed-off-by: shennetsind <ind@henn.et>
2013-11-05Introducing the Hercules Standalone Script Syntax CheckerHaru1-1/+1
- Added a command line argument '--script-check' to check a script's syntax without running the server (and without requiring a SQL connection). Usage: ./map-server --script-check /path/to/the/script.txt - For convenience, a script-checker bash script is provided, to set the path correctly when called from a different directory. Usage: /path/to/Hercules/script-checker /path/to/the/script/to/check.txt - While the script checker will supposedly work under windows as well, no convenience scripts are currently provided for platforms other than UNIX (feel free to open a pull request with a .bat launcher or whatever you like) - Integration with IDEs or text editors is possible. In fact, I already have a fully functional plugin for vim (through vim-syntastic), and if there's enough interest, I'll publish it. - screenshot: http://d.pr/i/NOBD - If you want an online checker, http://haru.ws/scriptchecker/ is running this code, without modifications and will be kept up to date (without any warranty though.) - Special thanks to Ind, Yommy, Streusel, who helped making this possible, in a way or another.
2013-11-02Fixed Shadow System Bonusesshennetsind1-1/+1
Item in shadow slots are now able to give bonuses properly, thanks to rosfus for pointing it out! Also added the missing constants for script handling. Signed-off-by: shennetsind <ind@henn.et>
2013-10-26Changed 'tick' variables to 64 bitHaru1-1/+1
- This fixes an issue with timers that stop working after about 24-49 days when the tick overflows (note that this may happen much earlier than that, and at hard to predict times, on some systems) - Updated the RDTSC help message in the configure script to also warn users about issues with SpeedStep enabled systems. - On Windows, tick() still has a resolution of 10~15ms (or even as low as 100ms on some systems). A TODO comment (thanks, Ai4rei) was added for a follow-up patch, as I want this one to be as small as possible) - Note: on Windows versions earlier than 6.x (Vista, Server 2008), the tick overflow issue is NOT fixed, since they don't support the function used to retrieve a 64 bit tick. This isn't a big issue, since those platforms are already - or going soon to be - out of their extended support period, and it's already advisable to upgrade, for other reasons. If you're the unfortunate user of such a system, it is recommended that you reboot your machine at least once every 49 days for Hercules to work reliably. - Note: To clear some doubts, since I've already been asked, this has absolutely NOTHING to do with 32/64 bit CPUs or OSes. It's all about a variable's size, not the size of registers of your CPU, and your 32bit CPU will be able to handle this just fine. Signed-off-by: Haru <haru@dotalux.com>
2013-10-25nocashshop mapflagshennetsind1-1/+2
As requested by the community in http://hercules.ws/board/topic/1477-mapflag-for-cash-shop/ and http://hercules.ws/board/topic/1476-disable-cashshop-in-pvp-woe/ 'nocashshop' mapflag disables the usage of the cashshop button as well as any attempts to purchase (in case the flag is turned on after someone gets the shop open). Signed-off-by: shennetsind <ind@henn.et>
2013-09-29HPM: Script.c Completedshennetsind1-101/+325
Fully Interfaced. Moved missing vars and declarations of interest into the interface, removed duplicate mentions of script within calls to shorten wherever it made sense to. Signed-off-by: shennetsind <ind@henn.et>
2013-09-25Renamed more forgotten variables during interface conversionsHaru1-1/+1
(related: b9c8f57) Most renames are trivial (just to avoid shadowing global variables, even if they currently did no harm), but there were some cases of partly renamed variables that caused some NULL checks to always pass and who knows what could have been happened when they were too subtle to make the application crash. Also corrected some potentially unsafe macro definitions Signed-off-by: Haru <haru@dotalux.com>
2013-08-26Added support for non-fatal error messages from the script parserHaru1-0/+1
- Changed overflow errors to be non-fatal. The value will now be capped to INT_MAX or INT_MIN. - Follow-up to 8351881 Signed-off-by: Haru <haru@dotalux.com>
2013-07-29BG Queue Fixesshennetsind1-1/+2
Cleared 3 out of 5, #69 Support for the cancel button, for pre-game position to return afterwards and fix to the queue position problem after first game. Signed-off-by: shennetsind <ind@henn.et>
2013-07-25Expanding script.c interfaceshennetsind1-79/+88
Hercules Renewal Phase One. Signed-off-by: shennetsind <ind@henn.et>
2013-07-18Fixed Bug #7525shennetsind1-0/+1
Item name constants conflicting with script var names will now result in a map server warning/notice and in the background map server will prioritise the script variable over the item name constant. http://hercules.ws/board/tracker/issue-7525-set-variable-is-not-recognized-causing-freezing/ --- Also followup 586c0f7983f81e97ca70c57712e25d4d51453d6b sc_config.txt update Signed-off-by: shennetsind <ind@henn.et>
2013-07-01Fixed Bug #7216shennetsind1-1/+1
Special Thanks to Shikazu, wouldn't have been able to identify this issue without his help! http://hercules.ws/board/index.php?app=tracker&showissue=7216 Signed-off-by: shennetsind <ind@henn.et>
2013-06-30Fixed script timer problemshennetsind1-2/+10
Special Thanks to Igniz for bringing it to my attention, ALSO: over 10% script parsing speed boost!<3. Signed-off-by: shennetsind <ind@henn.et>
2013-06-28BG Queue Testingshennetsind1-0/+2
http://hercules.ws/board/topic/1302-bg-queue-debug/ Signed-off-by: shennetsind <ind@henn.et>
2013-06-23Official Item Group/Package/Chainshennetsind1-4/+6
http://hercules.ws/board/topic/1244-official-item-grouppackagechain/ Also Further implemented itemdb.c/storage.c interfaces, and a minor update to db2sql plugin. Signed-off-by: shennetsind <ind@henn.et>
2013-06-15Fixed Bug #7367shennetsind1-2/+10
http://hercules.ws/board/tracker/issue-7367-error-vdb-destroy-during-shutting-down-of-server/ Signed-off-by: shennetsind <ind@henn.et>
2013-06-13Script.c Interface : detach ridshennetsind1-0/+1
Special Thanks to Shizaku for pointing it out! Signed-off-by: shennetsind <ind@henn.et>
2013-06-13Performance Update: Script Parsershennetsind1-0/+3
Now 7% faster, at the expense of (at most 11kb) Signed-off-by: shennetsind <ind@henn.et>
2013-06-08HPM: Update script.cshennetsind1-20/+46
Further implemented the interface Signed-off-by: shennetsind <ind@henn.et>
2013-06-02Follow up 86e9900db60e06738880a57820125ca169c37520shennetsind1-2/+1
Forgot about the Interface. Signed-off-by: shennetsind <ind@henn.et>
2013-06-01Fixed script_rid2sd not being available to HPMshennetsind1-0/+2
Special Thanks to Shikazu Signed-off-by: shennetsind <ind@henn.et>
2013-05-30Memory Slasher - May 30 Patchshennetsind1-0/+38
http://hercules.ws/board/topic/928-memory-slasher-may-30-patch/ Signed-off-by: shennetsind <ind@henn.et>
2013-05-02Introducing Hercules Plugin Manangershennetsind1-5/+124
http://hercules.ws/board/topic/549-introducing-hercules-plugin-manager/ Signed-off-by: shennetsind <ind@henn.et>
2013-04-22Hercules April 22 MEGA-ULTRA-LONG Patch~!shennetsind1-4/+0
http://hercules.ws/board/topic/470-hercules-april-22-patch/ Signed-off-by: shennetsind <ind@henn.et>
2013-02-27Fixed Bug #6527malufett1-0/+1
-Where all NPC don't allow changing of equipments by default and now can be set in 'items.conf'.
2013-02-24Fixed Bug #7092malufett1-1/+1
-Follow up adda8d74c3280ae1e3745591caafd9ce6e81ded7 where 'close2' is not working properly. Signed-off-by: malufett <malufett.eat.my.binaries@gmail.com>
2012-12-05- Undid r16968: SVN Replaced with source:/trunk/src/@16966 (tid:74924).brianluau1-119/+119
[16969:16991/trunk/src/] will be re-committed in the next 24 hours. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16992 54d463be-8e91-2dee-dedb-b68131a5f0ec