Jump to content

meko

Core Developers
  • Content Count

    318
  • Joined

  • Last visited

  • Days Won

    42

meko last won the day on December 17 2019

meko had the most liked content!

About meko

  • Rank
    Advanced Member

Contact Methods

  • IRC Nickname
    meko

Profile Information

  • Gender
    Not Telling
  • Github
    Helianthella

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. meko

    Functions

    The documentation resides in the /doc folder of your cloned git repository and the scripting engine documentation is in /doc/script_commands.txt The version you have locally may not be the version that is currently on GitHub so always use the documentation in the /doc subfolder of the emulator root folder since its version is always the same as the version of your Hercules emulator (when properly cloning and pulling with git) Please be aware that some commands have been deprecated over the years and replaced with other commands. The documentation will tell you when a command is deprecated and you can find more details in the Deprecation thread.
  2. meko

    get npc name

    use strnpcinfo() like strnpcinfo(NPC_NAME_UNIQUE, "", npc id)
  3. // set the unit ID of the target [email protected]_id = XXXXX; // get the location of the target (change TYPE to PC/MOB/...) getmapxy([email protected]$, [email protected], [email protected], UNITTYPE_{{TYPE}}, [email protected]_id); // get all mobs within a 3 cell radius around the target [email protected] = getunits(BL_MOB, [email protected][0], false, [email protected]$, max(0, [email protected] - 3), max(0, [email protected] - 3), [email protected] + 3, [email protected] + 3); // iterate over the mob units for ([email protected] = 0; [email protected] < [email protected]; [email protected]) { [email protected] = [email protected][[email protected]]; // ... do something with your [email protected] }
  4. 10 to the power of 10 is 10,000,000,000 but the scripting engine uses signed 32-bit integers and the maximum value that can be held by such integers is 2,147,483,647 (2^31 − 1). Any value above this will cause the integer to overflow so you have to be aware of this and manually check the boundaries. In your case this would mean checking that getarg(0) is shorter than 10 characters long so if ( [email protected] == 0 || [email protected] >= 10 ** 9 ) return getarg(0); instead of if ( [email protected] == 0 || [email protected] >= 2147483647 ) return getarg(0); to avoid the case where getstrlen is above 10
  5. the exponentiation operator (**) has higher precedence than the addition operator (+) so this means A ** B+C is interpreted as (A ** B) + C because the exponentiation operation has priority over the addition operation also worth noting that exponentiation has higher precedence than multiplication/division so a more complex formula like A + B * C ** D would be interpreted as A + (B * (C ** D)) so you have to manually reorder the operations with explicit parentheses if you want to change the precedence, like (A + (B * C)) ** D
  6. no need for SQL nor a timer: just store the date instead of a true/false boolean // check whether the last reward was given today or another day if (gettime(GETTIME_DAYOFYEAR) == #LAST_REWARD) { mes("you already got a reward today"); } else { mes("here's your reward"); ... // give reward #LAST_REWARD = gettime(GETTIME_DAYOFYEAR); // set it to today }
  7. there's a few different ways: [email protected] = charat("Test3", 4); sscanf("Test3", "Test%d", [email protected]); [email protected] = substr("Test3", 4, 4); pcre_match("Test3", "^[^0-9]*([0-9]+)$"); [email protected] = [email protected]$[1];
  8. map server by itself does not auto-restart, what you are using is a wrapper script (map-server.bat) if you do not want it to restart you should use map-server.exe directly or make your own wrapper script
  9. You do know screenshots are a thing, right? and for text you can use a paste service... Anyway, you'll want to install libmariadb-client-lgpl-dev (on older Ubuntu versions you might also need libmariadbclient-dev-compat) or libmysqlclient-dev
  10. if you want double quotes to be part of a string you have to escape them "foo \"bar\" baz"
  11. the errors here are quite explicit: you are using variables that are not declared (ep, char_id); you will have to declare them in the parameters of the function or inside the function before they can be used
  12. This is a bug and is fixed in https://github.com/HerculesWS/Hercules/pull/2247 This patch should land in the next release but meanwhile you can manually apply it
  13. Thank you! Hercules would like to thank everyone who contributed for hukktoberfest 2018 linton-dawson (newcomer) (first-time contributor) akshat157 (newcomer) (first-time contributor) @Emistry (staff) @KirieZ @Dastgir (staff) IpshitaC (newcomer) (first-time contributor) @Asheraf (staff) @Kubix (first-time contributor) @Habilis (first-time contributor) 🦄 shouxian92 (first-time contributor) jvastbinder (first-time contributor) @4144 (staff) @Myriad j-chad (newcomer) (first-time contributor) MohanSha (newcomer) (first-time contributor) BinaryCrochet (newcomer) (first-time contributor) @kisuka (staff) 🐺 VictoriaLa (newcomer) (first-time contributor) List of pull requests: https://git.io/fxpL5 We hope to see you again next year! ✨🎉
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.