Jump to content

meko

Core Developers
  • Content Count

    363
  • Joined

  • Days Won

    46

Reputation Activity

  1. Like
    meko got a reaction from Tio Akima in search for nearby targets   
    // set the unit ID of the target .@target_id = XXXXX; // get the location of the target (change TYPE to PC/MOB/...) getmapxy(.@map$, .@x, .@y, UNITTYPE_{{TYPE}}, .@target_id); // get all mobs within a 3 cell radius around the target .@count = getunits(BL_MOB, .@units[0], false, .@map$, max(0, .@x - 3), max(0, .@y - 3), .@x + 3, .@y + 3); // iterate over the mob units for (.@i = 0; .@i < .@count; ++.@i) { .@unit = .@units[.@i]; // ... do something with your .@unit }  
  2. Like
    meko got a reaction from brunosc in Error in changer coin   
    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 ( .@num == 0 || .@num >= 10 ** 9 ) return getarg(0); instead of if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0); to avoid the case where getstrlen is above 10
  3. Like
    meko got a reaction from brunosc in Error in changer coin   
    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
  4. Like
    meko got a reaction from brunosc in Error in changer coin   
    .@num$ = .@num % 10 ** (.@i + 1) / 10 ** .@i + .@num$;  
  5. Upvote
    meko got a reaction from schmosby in reset player variable daily   
    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 }  
  6. Upvote
    meko got a reaction from botka4aet in String -> Number   
    there's a few different ways:
     
    .@num = charat("Test3", 4); sscanf("Test3", "Test%d", .@num); .@num = substr("Test3", 4, 4); pcre_match("Test3", "^[^0-9]*([0-9]+)$"); .@num = $@regexmatch$[1];  
  7. Upvote
    meko got a reaction from AnnieRuru in Put a stop on not found plugin so server dont loop restarting ?   
    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
  8. Upvote
    meko reacted to AnnieRuru in Help Removing duplicates value from array   
    Let me show you 3 different methods
     
    1.  loop the value back in another array, almost similar to meko did
    prontera,155,185,5 script kjdshfsk 1_F_MARIA,{ getinventorylist; for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) { .@j = 0; while ( .@j < .@itemtotal && .@itemid[.@j] != @inventorylist_id[.@i] ) ++.@j; if ( .@j == .@itemtotal ) .@itemid[.@itemtotal++] = @inventorylist_id[.@i]; } for ( .@i = 0; .@i < .@itemtotal; ++.@i ) dispbottom getitemname( .@itemid[.@i] ) +" -> "+ countitem( .@itemid[.@i] ) +"x"; end; } most people will show you this method, and this method is usable in almost all programming language
    BUT ... in my opinion this method use lots of loops ...
     
    2. store the value in a string, then compare them later
    prontera,158,185,5 script dskjfhsdfk 1_F_MARIA,{ getinventorylist; .@compare$ = "#"; for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) { if ( !compare( .@compare$, "#"+ @inventorylist_id[.@i] +"#" ) ) { .@compare$ += @inventorylist_id[.@i] +"#"; .@itemid[.@itemtotal++] = @inventorylist_id[.@i]; } } for ( .@i = 0; .@i < .@itemtotal; ++.@i ) dispbottom getitemname( .@itemid[.@i] ) +" -> "+ countitem( .@itemid[.@i] ) +"x"; end; } I have used this method in
    https://rathena.org/board/topic/91826-special-party-warper/#comment-241434
    https://rathena.org/board/topic/91723-please-help-this-script-about-mac_address/?do=findComment&amp;comment=240887
    I used this method a lot before Ind upgrade our scripting engine,
    but search using strings is quite slow in C language, hercules script language included
    and comes the recommended method below
     
    3. abuse hercules script engine, array is store in a pointer.
    prontera,161,185,5 script zcxvsfer 1_F_MARIA,{ getinventorylist; for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) { if ( !.@compare[ @inventorylist_id[.@i] ] ) { .@compare[ @inventorylist_id[.@i] ] = true; .@itemid[.@itemtotal++] = @inventorylist_id[.@i]; } } for ( .@i = 0; .@i < .@itemtotal; ++.@i ) dispbottom getitemname( .@itemid[.@i] ) +" -> "+ countitem( .@itemid[.@i] ) +"x"; end; } ever since Ind upgrade our scripting engine, this is my latest method, and I think this is the fastest way -> compare to all 3 methods
    I have used in
    getitemname2 function
    soul linker spirit
    As you can see, I used Method 2 while still on rAthena forum, and switch to Method 3 after switch to Hercules
    And for your 2nd question, you can solve it yourself after you learn any of these techniques
     
  9. Upvote
    meko got a reaction from utofaery in Help Removing duplicates value from array   
    see array_unique() in
     
  10. Upvote
    meko reacted to 4144 in Some upcoming hercules features   
    Futures already added to hercules:
    Inventory expanding
     http://imgc1.gnjoy.com/ufile/ro/2018/11/21/QK3O60RA1MGOMU301NUO.gif
    Supported from clients: 2018-10-31 ragexe/ragexeRE, 2018-11-14 zero.
    For expand inventory need to have in inventory item Inventory_Extension_Coupon (25793)
     
    Barter shop
     
    Supported from  clients: 2019-01-16 ragexe/ragexeRE, 2018-12-26 zero.
    For shop barter shop need uncomment line
    "npc/custom/bartershop.txt", in npc/scripts_custom.conf. Barter shop demo npc will be added in prontera at (159, 284).
     
    Most client exes can be downloaded here: http://nemo.herc.ws/downloads/
  11. Upvote
    meko got a reaction from Caspian in How can I fix this?   
    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. Upvote
    meko reacted to Habilis in Hacktoberfest 2018   
    HukktoberFest This year was a BLAST, I've learned alotta things about GIT & GitHub!
  13. Upvote
    meko got a reaction from Habilis in Hacktoberfest 2018   
    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! ✨🎉
  14. Upvote
    meko got a reaction from bWolfie in Hacktoberfest 2018   
    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! ✨🎉
  15. Upvote
    meko got a reaction from KirieZ in Hacktoberfest 2018   
    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! ✨🎉
  16. Upvote
    meko got a reaction from Kubix in Hacktoberfest 2018   
    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! ✨🎉
  17. Upvote
    meko got a reaction from OmarAcero in How do I install mysql in cygwin?   
    Just run it natively on windows:
    https://downloads.mariadb.org/interstitial/mariadb-10.3.10/winx64-packages/mariadb-10.3.10-winx64.msi/from/http%3A//mariadb.mirror.iweb.com/?serve
    Otherwise, you might want to consider WSL
  18. Upvote
    meko reacted to 4144 in Git not updating anymore   
    you using stable branch. this branch updated only on release time. this is mostly once per month.
    also you have two custom commits in local branch.
    you can switch to master branch by command git checkout master
     
  19. Upvote
    meko got a reaction from JulioCF in Hacktoberfest 2018   
    Contribute to open source and get a free limited-edition T-shirt
     
    What's Hacktoberfest?
    Hacktoberfest — brought to you by DigitalOcean in partnership with GitHub and Twilio — is a month-long celebration of open source software. Maintainers are invited to guide would-be contributors towards issues that will help move the project forward, and contributors get the opportunity to give back to both projects they like, and ones they've just discovered. No contribution is too small—bug fixes and documentation updates are valid ways of participating.
     
    From October 1 to October 31, contribute to any open source project (Hercules included) on GitHub to get a free T-shirt!
    5 pull requests are required. (Pull requests do not have to be merged and accepted; as long as they've been opened between the very start of October 1 and the very end of October 31, they count towards a free T-shirt.)
    We will be marking easy-to-tackle issues with the Hacktoberfest tag so that first time contributors can more easily find them.
     
    >> Register on hacktoberfest.digitalocean.com

    Resources
    GitHub Learning Lab How to create a Pull Request on GitHub Understanding the GitHub Flow Open source 101 Hercules documentation Hercules wiki  
     
    FAQ
    It is free to participate? Yes!  
    Is shipping included? Yes. DigitalOcean offers free worldwide shipping.  
    What shirt sizes are available for Hacktoberfest 2018? DigitalOcean have not yet made public the size chart for 2018, but we know they at least offer S to 4XL sizes, for both male and female.  
    What's included in the package? A thank you letter. A T-Shirt. A bunch of cool stickers.  
    Do I need to register for Hacktoberfest before starting to open Pull Requests? No. You may register at any time during the month of October and DigitalOcean will count your pull requests retroactively from October 1 onwards.  
    Do all of my Pull Requests have to be sent to the same repository? No. You may send PRs to any number of repositories you like, and as long as they are public and have an OSI-approved license they will count towards the 5+ PRs objective.  
    Do I have to wait for the start of October to open Pull Requests? You may contribute all year long, but only PRs that are opened during the month of October will be counted.
  20. Upvote
    meko reacted to bWolfie in Hacktoberfest 2018   
    I will up my efforts try to get to 15 PR for October
  21. Upvote
    meko got a reaction from Rebel in Map-server Crash when using @reloadscript   
    @Rebel this should fix your crash: https://github.com/HerculesWS/Hercules/pull/2247
  22. Upvote
    meko reacted to Rebel in Map-server Crash when using @reloadscript   
    There is another bug @meko.. After I reloadscript when PK is enabled. The zone is changed. Please see attached image.
    Before @reloadscript, the Map Info is this:

    After @reloadscript, the Map Info is this:

    Notice that 
    -> Zone: Normal turned to Zone: PK Mode
    and
    -> PvP Flags: <empty> turned to PvP Flags: PvP ON |
  23. Upvote
    meko reacted to Rebel in Map-server Crash when using @reloadscript   
    Git revision (src): '852c13305f67948531bd0277eb1922dbd02b1f26'
    Git revision (scripts): '852c13305f67948531bd0277eb1922dbd02b1f26'
    No custom scripts, no custom src  edits, no plugins.. Fresh Hercules.. 
    Full Stack Trace
    Program received signal SIGSEGV, Segmentation fault. __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:31 31 pcmpeqb (%rdi), %xmm1 Missing separate debuginfos, use: debuginfo-install libstdc++-4.8.3-9.el7.x86_64 (gdb) bt full #0 __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:31 No locals. #1 0x00000000004eb2af in map_zone_remove (m=0) at map.c:4659 flag = '\000' <repeats 24 times>, "\302if\000\000\000\000\000\240\334\377\377\377\177\000\000\302if\000\000\000\000\000\000\344\224\363\377\177\000\000\327\302\060\366\377\177\000\000" params = "p\333\377\377\377\177\000\000\260\332\377\377\377\177", '\000' <repeats 18 times>, "\260\333\377\377\377\177\000\000\020\335\377\377\377\177\000\000\302if\000\000\000\000\000\302if\000\000\000\000\000\300" k = 0 #2 0x00000000004ea875 in map_zone_change (m=671, zone=0x150f35c, start=0x6669c2 "", buffer=0x0, filepath=0x0) at map.c:4648 No locals. #3 0x000000000050989b in npc_parse_mapflag (w1=0x628670 <db_obj_get> "UH\211\345AUATI\211\374SH\203\354\bH\205\377\017\204W\001", w2=0x150f35c "PvP", w3=0x3513c0 <Address 0x3513c0 out of bounds>, w4=0x627130 <db_data2ptr> "U1\300H\205\377H\211\345t\t\203?\002u\004H\213G\b]\303f.\017\037\204", start=0x6669c2 "", buffer=0x6669c2 "", filepath=0x6669c2 "", retval=0x0) at npc.c:4193 zone = 0x53340b4 mapname = "1@cata\000\000\060\065\000\a\000\000\000\000\240\334\377\377\377\177\000\000\260`N\000\000\000\000" state = 1 __func__ = "npc_parse_mapflag" #4 0x00000000004eb38a in map_zone_remove (m=0) at map.c:4670 flag = "pvp", '\000' <repeats 61 times> params = "\000ff", '\000' <repeats 13 times>, "p\335\377\377\377\177\000\000\\|b", '\000' <repeats 29 times>, "\364n~\001\000\000\000\000\326" k = 8 #5 0x00000000004e077d in map_zonedb_reload () at map.c:3698 i = 671 __func__ = "map_zonedb_reload" #6 0x000000000050637b in npc_reload () at npc.c:4983 npc_new_min = 110019057 iter = 0x3d6 bl = 0x64 __func__ = "npc_reload" #7 0x000000000040fa16 in atcommand_reloadscript (fd=11, sd=0x150f35c, command=0x6669c2 "", message=0x0, info=0x0) at atcommand.c:3858 iter = 0xf620ac pl_sd = 0x0 #8 0x00000000004310c0 in atcommand_exec (fd=11, sd=0x380d900, message=0x7fffffffe278 "@reloadscript", player_invoked=false) at atcommand.c:10393 params = '\000' <repeats 99 times> command = "@reloadscript", '\000' <repeats 86 times> output = "\000\000\000\000\000\000\000\000\030\340\377\377\377\177\000\000\300aG", '\000' <repeats 21 times>, "\004\021'\004\000\000\000\000\360\337\377\377\377\177\000\000\020\315N", '\000' <repeats 21 times>, "\f", '\000' <repeats 19 times>, "\f\000\000\000\377\377\377\177\000\000\000\000`\000\000\000\000\000\000\000\b\000\000\000\000\000\000\000\000\003\000\000\000\000\000\000\000\000\000\000\a\000\000\000\060\001\000\000\000\000\000\000@\373\232\363\377\177\000\000\210\005\000\000\000\000\000\000\031\000\000\000\003\000\000\000\004\000\000\000\000\000\000\000\003\000\000\000;\000\000\000\300aG", '\000' <repeats 13 times>... logCommand = true atcmd_msg = "@reloadscript\000\000\000\250\341\377\377\n\000\000\000\340\340\377\377\377\177\000\000\321\342\377\377\377\177\000\000\334\020'\004\000\000\000\000P", '\000' <repeats 11 times>, "\005", '\000' <repeats 11 times>, "@i\237\363\377\177\000\000\340\001\000\000\000\000\000\000\306hN\000\000\000\000\000\006\000\000\000\005\000\000\000\004\000\000\000+\000\000\000\061\000\000\000\000\000\000\000?\221g\000\000\000\000\000@\343\377\377\377\177\000\000I\217\061\366\377\177\000\000\001\20---Type <return> to continue, or q <return> to quit--- 0\255\373\000\000\000\000\250\341\377\377\377\177\000\000\300aG", '\000' <repeats 21 times>, "@\301T\000\000\000\000\000\200\341\377\377\377\177\000\000"... #9 0x0000000000539ac2 in pc_process_chat_message (sd=0x380d900, message=0x150f35c "PvP") at pc.c:12217 No locals. #10 0x000000000047476f in clif_process_chat_message (sd=0x380d900, packet=0x7ffff4b5c014, out_buf=0x0, out_buflen=0) at clif.c:9727 srcname = 0x7ffff4b5c018 "admin : @reloadscript" message = 0x7fffffffe278 "@reloadscript" textlen = 87244980 __func__ = "clif_process_chat_message" #11 0x000000000046e473 in clif_parse_GlobalMessage (fd=11, sd=0x380d900) at clif.c:10613 full_message = "admin : @reloadscript\000\000\000\204\264\332\004\000\000\000\000<\216]p\000\000\000\000\240r\235", '\000' <repeats 13 times>, "\326\242c\000\000\000\000\000\340\342\377\377\377\177\000\000h\242b", '\000' <repeats 13 times>, "\210\256\317\003", '\000' <repeats 28 times>, "\364n~\001\000\000\000\000\230\343\377\377\377\177\000\000\000\000\000\000\000\000\000\000\320\026T\000\000\000\000\000h\242b\000\000\000\000\000\060\343\377\377\377\177\000\000\364n~\001\000\000\000\000\230\343\377\377\377\177\000\000\000\000\000\000\000\000\000\000\200\343\377\377\377\177\000\000"... message = 0x380d900 "" __func__ = "clif_parse_GlobalMessage" #12 0x00000000004690b2 in clif_parse (fd=11) at clif.c:21983 parse_cmd_func = 0x53340b4 packet_len = 6711746 sd = 0x380d900 #13 0x000000000063d3de in do_sockets (next=88) at socket.c:1035 rfd = {fds_bits = {2048, 0 <repeats 15 times>}} timeout = {tv_sec = 0, tv_usec = 24394} ret = 0 #14 0x000000000040804a in main (argc=1, argv=0x7fffffffe5e8) at core.c:557 next = 87244980 retval = 6511088  
  24. Upvote
    meko got a reaction from Darius Trevor in Mercenary_Rent   
    @Darius Trevor This is fixed in https://github.com/HerculesWS/Hercules/pull/2240
    but please use constants directly instead of using getd
  25. Upvote
    meko got a reaction from MikZ in Failed assertion Achievement   
    @MikZ this PR should fix your issue: https://github.com/HerculesWS/Hercules/pull/2227
×
×
  • Create New...

Important Information

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