Jump to content

AnnieRuru

Script Developers
  • Content Count

    1677
  • Joined

  • Last visited

  • Days Won

    245

Everything posted by AnnieRuru

  1. why not just use *bindatcmd and *setquest/*erasequest script command ? can probably add this inside global_function file or something ... though, if wanna add in as atcommand version, that's ... actually better as no need to parse the script command function
  2. autobonus "{ bonus bStr, 100; }", 10000, 1000, BF_WEAPON|BF_NORMAL, "{ disguise 1002; sleep2 1000; undisguise; }";transform into poring for 1 second, during the period will gain 100 str stat bonus
  3. I believe this would belongs to disabled_skills: SC_END SC_ENERGYCOAT can be done in npc scripting too to add inside map_zone_db ... hmm... nice idea actually then there is no need to add so many OnPCLoadMapEvent with sc_end sc_*** on so many maps (zones = many maps in group)
  4. // Restrict character deletion if carrying these item IDschar_del_itemid: 1530,2629,2857prevent character deletion if carrying mjolnir, magingiorde, brisingamen and the check range should included inventory, cart, mail attachment
  5. why not just make an atcommand that will shows the number of players without chatroom or vending script command version http://rathena.org/board/topic/70126-floating-rates-question/?p=146588 this is a roundabout method
  6. AnnieRuru

    getserverdef

    I can write this one http://upaste.me/a73c1057844f2d601 please review tested with prontera,155,184,5 script dfjskdfhds 100,{ for ( .@i = 0; .@i <= 12; .@i++ ) { if ( .@i == 10 || .@i == 11 ) continue; dispbottom getserverdef(.@i) +""; } end;}VAR_VIP_SCRIPT and VAR_MIN_STORAGE can be add later after you guys done VIP system
  7. I can write this http://upaste.me/de7c10577fd5ed9d5 there is a problem ... prontera,162,180,5 script aasdf 100,{ dispbottom "test color"; dispbottom "test color", 0xFF0000; dispbottom "test color", 0x00FF00; dispbottom "test color", 0x0000FF; end;}I test with this scriptit seems only able to display RED correct ... green and blue are not ... I remember when I did with rathena emulator on my previous post here, I don't recall having this bug
  8. definitely require source modification in scripting the syntax is if ( strcharinfo(3) == "guild_vs1" && gettime(3) != 21 ) so to do this in source code correctly is src/map/skill.c | 9 +++++++++ 1 file changed, 9 insertions(+)diff --git a/src/map/skill.c b/src/map/skill.cindex b0c6d7a..53b6380 100644--- a/src/map/skill.c+++ b/src/map/skill.c@@ -535,6 +535,15 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; }+ else if ( !strcmp( mapindex_id2name(sd->mapindex), "guild_vs1" ) ) {+ time_t clock;+ struct tm *t;+ time( &clock );+ t = localtime( &clock );+ if ( t->tm_hour != 21 ) // assuming KoE runs at 9pm to 10pm+ clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);+ return 1;+ } break; case BS_GREED: case WS_CARTBOOST:.. seriously there is no need to do like that I have received several reports about this prize abused http://rathena.org/board/topic/81302-im-using-annie-koe-script-but-need-some-modifications/?p=192946 but only figured out recently due to reading skill.conf emergency recall allow to use in gvg mapflag,and with default setting, it can also be use in nowarpto mapflag, that's the reason it can be abused ... or can just change 11 into 27 ... but that will disallow to use in this map totally
  9. hmm ... paskie made a post makes me change my plan to make this topic a top priority in my list I have made 3 variations of lucky pick event script http://www.eathena.ws/board/index.php?s=&showtopic=275732&view=findpost&p=1512505 3 years ago http://rathena.org/board/topic/77364-dynamic-time-lucky-pick-event/?p=173025 last year http://rathena.org/board/topic/91510-lucky-pick-event/?p=240207 last month and 4th method now if consider adding paskie's method above but now I'm going to propose a 5th method ... write a new script command call *getservermember I always wanted to write one since years ago but there was array limitation to 127 index all the time ... until last month http://upaste.me/23e0105643b9c3019 and the script with shuffle algorithm http://upaste.me/ab41105653011d513 keyworld, feel free to optimized that shuffle algorithm =/
  10. in my original koe script, I did mes "[Exit]"; mes "See ya."; if ( getcharid(2) == $koegid ) getitem 501, 1; // configure prize here close2; warp "Save",0,0; end;so yeah, members can talk to this npc (claim the prize), don't press the close buttonand wait for guild master recall them, and talk to this npc (claim the prize), don't press the close button repeat so yeah, that's how they abuse the prize I just figured it out 2 days ago when I read bug report section about someone posting about guild aura bug to fix it, simply move the condition of giving the prize into after the close2; button mes "[Exit]"; mes "See ya."; close2; if ( getcharid(2) == $koegid ) getitem 501, 1; // configure prize here warp "Save",0,0; end;like this so in your modified script, it should be // KoE Exitguild_vs1,49,56,5 script Exit#KoE 51,{ mes "[Exit]"; mes "Thank you for Joining"; mes "You Won PVP Tokens and Cash Points"; close2; if ( getcharid(2) == $koegid ) { getitem 8039,150; set #CASHPOINTS,#CASHPOINTS + 50; dispbottom "You got "+#CASHPOINTS+" cash points."; } warp "Save",0,0; end;}
  11. rathena support .@i++ but doesn't support ++.@i so no, it doesn't support on rathena . . that's the reason I overlook counting sort as an optionbecause in practical use there is always a parallel array originally I also thought counting sort cannot output as the array index but after looking at your sample ... now I have a 2nd opinion ... your so-called hacking method is not new to me because you have already demonstrated 3 years ago in this shuffle algorithm topic and I also able to reproduced it until this version it was made with rathena script engine limitation in mind, so now I have to update it again to make it compatible with hercules new scripting engine . . in your sample, counting sort doesn't include sorting array index so I think I have to do itI think it might be possible by faking a 2-dimensional array like .@tmp[.@_arr[.@i] + .@neg]++;intosetd ".@tmp_"+( .@arr[.@i] + .@neg )+"["+ getarraysize( getd( ".@tmp_"+( .@arr[.@i] + .@neg ) ) ) +"]", .@idx[.@i];and this will still retain the complexity of O(n)
  12. that's cheating ! just because you understand more about *eathena scripting engine works this function is only optimized with *eathena/hercules scripting engine only LOL ! but yeah http://upaste.me/27f51050340b8af47 haru's merge sort -> 452-468 mili-seconds keyworld's merge sort -> 405-422 mili-seconds actually I'm not that amazed though I just learn that set getelementofaray( getarg(x) ) is not a good practice <.< . . now I have a quick question ... is bottom-up merge sort and top-down merge sort has any advantages in certain scenario ? example like cocktail sort has advantages if the array has already in inverted order ready ...
  13. I have never write a script that needs the timer to attach to the player and yet continue after logout what kind of script are you writing ? although this is do-able prontera,155,186,5 script kjfhksdjf 100,{ dispbottom "current timer is "+( gettimetick(2) - .timer[ getcharid(0) ] )+" seconds"; end;OnPCLoginEvent: .@cid = getcharid(0); if ( .timer[.@cid] ) { dispbottom "continue the timer from "+( gettimetick(2) - .timer[.@cid] ); end; } .timer[.@cid] = gettimetick(2); end;}honestly ... tell me what you are writing ...
  14. yeah now this is the patch for hercules src/map/mob.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)diff --git a/src/map/mob.c b/src/map/mob.cindex dab7b99..cd50475 100644--- a/src/map/mob.c+++ b/src/map/mob.c@@ -2367,7 +2367,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { //MSG: "'%s' won %s's %s (chance: %0.02f%%)" intif->broadcast(message, strlen(message)+1, BC_DEFAULT); }- + if ( sd )+ if ( it->type == 6 )+ pc_setglobalreg( sd, script->add_str("Daily_Points"), pc_readglobalreg( sd, script->add_str("Daily_Points") )+( ( md->status.mode & 32 )? 10 : 1 ) ); /* heres the thing we got the feature set up however we're still discussing how to best define the ids, * so while we discuss, for a small period of time, the list is hardcoded (yes officially only those 2 use it, * thus why we're unsure on how to best place the setting) */
  15. a quick guess is that you didn't update your so call "points" from `global_reg_value` into `char_reg_num_db` run this file should work ? https://github.com/HerculesWS/Hercules/blob/master/sql-files/upgrades/2014-01-04--16-47.sql
  16. wow ! that's really fix ithttp://upaste.me/a63a10487f4315bee my comb sort -> 468-514 miliseconds your comb sort -> 483-500 miliseconds although it doesn't seem to improve the execution time but the range/varies seems to be more stable ... maybe I can learn a thing or two from here XD . . YES exactly what I wanthttp://upaste.me/78f11048686c8fbc4 everything works perfect this merge sort will be the one I'll be using from now on its solved now you know ... for some reason the answer, merge-sort that I want runs 450 mili-seconds but your original one on post#5 only runs 350 mili-seconds however its still 50 mili-seconds faster than comb-sort
  17. the reason that I want to create a temporary array $@tmp_array is to not mess up with the original input arrayin the original version merge sort you've wrote the .@array[] will be also sorted along with the .@output[] when I display the .@array[] after the callfunc "mergesort", this array is sorted ! . . yeah ... hahaha .. just noticed it too . . yes its still slow,now I'm using Hercules emulator to test, the array index can go up to 2^32 (4b...) just like Haru did, he confirm your iterative merge sort still slower than comb sort . . and wait, I just knew merge sort has 2 versions ! http://en.wikipedia.org/wiki/Merge_sort wait, just how many versions merge sort has ? nonono .. my head gonna explode 1st hahaha ! . . yeah I immediately noticed some modification on the comb sortbut you just bug the script lol http://upaste.me/c50310475cfb4a976 screenshot -> http://imageshack.com/a/img33/8201/81nz.jpg obviously you only see the last few index when having over 1000 index but the 1st few index are not sorted properly so, I have to use back my own comb sort honestly, how fast is your computer o.o same test as yours .@total = 1000; generate rand(10000); comb sort -> 468-530 mili-seconds iterative merge sort -> 484-499 mili-seconds bottom-up merge sort -> 327-343 mili-seconds (*own*) . . 2nd, keyworld is right while-loop is faster than for-loop when parse in script engine the is even a significant difference with this script same test as before your original for-loop -> 343-359 mili-seconds I change into while-loop -> 327-343 mili-seconds keyworld has proposed an improvements to the looping with rathena script engine http://rathena.org/board/topic/81457-hardcoded-script-commands-improvement/ any chance this might get implement in hercules ? . . that's because I want to output the sorted array indexnot the sorted array result Haru also copyarray .@arr from getarg(0) in the comb sort function which is not I want . . http://rathena.org/board/topic/92070-suggestion-new-scriptcommand-search-array/?p=242896 here is a real examplehttp://upaste.me/1d2110474e08867d3 screenshot -> http://imageshack.com/a/img33/778/oyn5.jpg EDIT: -> forgot to tell getitemname2 function come from here if you try to do dispbottom .@output[.@i], .@output is actually just the index of the array I want to sort the ID, I also want to sort the parallel array such as @inventorylist_amount and so on so I only output the sorted index and put them in as @inventorylist_id[ .@output[.@i] ]; and so on along with the parallel arrays and I have no idea how to do like this on iterative merge sort, it seems the original array is being sorted as well but @Haru bottom-up merge sort doesn't seem to be the case maybe haru can write one xD ======== EDIT =================== summary ... I think this post too long read 1. throw away the iterative merge sort 2. I want Hercules core developer to take a look at keyworld's script command optimizations and get it implement 3. I like haru's bottom-up merge sort, any way to get that function to output sorted index ?
  18. YES !now I remember this topic http://www.eathena.ws/board/index.php?showtopic=237976 we have already discussed before that *goto is not evil ... LOL ! so using multiple callfunc/function/callsub in the script is the one that slow down the script execution time since these commands parse very ugly I guess there is no way to improve this script further, since this is a script engine problem 1st question solved 2nd part remains
  19. hahaha @KeyWorld ! I just learn strpos can be use this way ! it seems better than *compare ... that *compare method was learned from you to begin with now I go open another topic, solve for me please <3 http://herc.ws/board/topic/4321-help-me-improve-this-merge-sort-algorithm/ @Cabrera since the script already has setmapflag, there is no need to set another mapflag again use keyworld's script, his script better than mine ! ( my scripting rival hahaha ) EDIT: it seems keyworld's script somehow not working when I test it, let me check yeah, really out from scripting for too long hahaha .@joinMap_2nd$ is a scope variable that will vanish after the script hits an END; it should be change into npc variable
  20. ok I just recently cracked @KeyWorld's merge sort algorithm in this topic http://www.eathena.ws/board/index.php?s=&showtopic=180080&view=findpost&p=1293102 here is the script http://rathena.org/board/pastebin/jdsshuef1ic/ I have 2 questions 1. why is that comb sort runs faster than merge sort ?? in theory, merge sort should be better than comb sort, right ? O(n log n) is better than O(n2) however, in practical test on rathena emulator when .@total = 100, comb sort run 16~32 mili-seconds merge sort run 31~47 mili-seconds something is wrong here my 1st assumption is my merge sort is not efficient, maybe it can be improve ... however @Euphy told me maybe its just script engine problem ... can someone test here with hercules emulator and confirm comb sort is faster than merge sort ? ============================== 2. it seems I'm not able to write this kind of algorithm I'm trying to replicate the way that I have used in my comb_sort function dispbottom .@array[ .@r[.@i] ] +""; so that I can list out the index of the array I believe display with the index of the sorted array is better than getting output from sorted array because like I said in this topic http://rathena.org/board/topic/92070-suggestion-new-scriptcommand-search-array/?p=242896 I want the index of the sorted array to display the highest score, or the lowest number I wish someone can point me some light on how to get the sorted index done because comb sort use index swap, and I can easily do it, but merge sort use array merge <.<
  21. AnnieRuru

    getserverdef

    https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L3525 I want this *getserverdef script command in hercules I used it quite intensively during rathena now I move here I want to use them again they are just a simple script command that just read a variable from the source code you guys can add this in an instant . . VAR_VIP_SCRIPT 10VAR_MIN_STORAGE 11these 2 can be add laterbut 0-9 I want them so badly EDIT: https://github.com/HerculesWS/Hercules/blob/master/src/map/chat.h#L24 I change the 20 into 30 struct map_session_data* usersd[30];this will increase the chat room size limit into 30 players this is useful if making battleground script that use chat room to create a higher amount of battleground team members is there a way to read this "20" ? oh yes https://github.com/HerculesWS/Hercules/blob/master/src/map/chat.c#L39 cd->limit = min(limit, ARRAYLENGTH(cd->usersd));I want this one tooVAR_MAX_CHATSIZE ?
  22. http://rathena.org/board/topic/91042-utility-sql-mission-board/?p=243485 I just fixed the script so that now allow to setup mission without time-limit along with some other bugs that other members has reported
  23. please get yourself a test server and test the above script the above script is a snippet to tell you, your idea is not possible . .. just use the script that fluxCP provided that script using the correct method . . like I said already, your idea is not possible I not going to make anymore post if you don't even want to test
  24. no its not possible you can't mess with player's online data with query_sql, Sql_Handle or mysqli_query asking players to click on npc again is the correct method if you inject items into an online player, the item sure lost, even after relog if you need proof prontera,158,185,5 script kdjshfkjsf 100,{ query_sql "select id from storage where account_id = "+ getcharid(3) +" and nameid = 501", .@id; if ( .@id ) query_sql "update storage set amount = amount + 1 where account_id = "+ getcharid(3) +" and nameid = 501"; else query_sql "insert into storage ( account_id, nameid, amount, identify ) values ( "+ getcharid(3) +",501 , 1, 1, )"; mes "item successfully injected"; end;}this script is bugprontera,160,185,5 script kdjshfkjsf2 100,{ .@origin = getcharid(3); atcommand "@kick "+ strcharinfo(0); sleep 1000; query_sql "select id from storage where account_id = "+.@origin +" and nameid = 501", .@id; if ( .@id ) query_sql "update storage set amount = amount + 1 where account_id = "+ .@origin +" and nameid = 501"; else query_sql "insert into storage ( account_id, nameid, amount, identify ) values ( "+ .@origin +", 501, 1, 1 );"; end;}this script is working there is no way for fluxCP to kick an online player in a game, so its not possible
  25. doing like this should be discouragebecause the players can still be login in the game while vote for your server in the original script the fluxCP provided, the query_sql is being read on the spot, so even if the player is online while voting if the player click on the npc again, the points has been updated due to reading the sql table but since you want to inject an item into storage, the sql query will only work if the player is offline if you inject an item into storage while that player is online, that player will not have the item because the character data is being processed inside char_server.exe
×
×
  • Create New...

Important Information

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