Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/24/19 in Posts

  1. 1 point
    Nice Case Closed Annie thanks for showing all this stuff Guess will go the 3rd options. since using hercules as main rathena as supportive testing only..
  2. 1 point
    AnnieRuru

    Endless Cellar

    https://rathena.org/board/topic/67014-endless-tower-2-the-endless-cellar-a-custom-sequel-to-endless-tower-by-chilly/ https://rathena.org/board/topic/113688-quests-games-endless-cellar/?tab=comments#comment-337839 let's see, there's no one write this for hercules yet
  3. 1 point
    prontera,155,185,4 script Mass Junk Seller 1_M_MERCHANT,{ disable_items; getinventorylist; for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) { if ( getiteminfo( @inventorylist_id[.@i], ITEMINFO_TYPE ) == IT_ETC ) { .@id[.@c] = @inventorylist_id[.@i]; .@amount[.@c] = @inventorylist_amount[.@i]; .@zeny_total += getiteminfo( .@id[.@c], ITEMINFO_SELLPRICE ) * .@amount[.@c] *(100 + .Overcharge[ getskilllv(MC_OVERCHARGE)] )/100; ++.@c; } } if ( !.@c ) { mes "you don't have any items to sell"; close; } mes "Are you sure selling :"; for ( .@i = 0; .@i < .@c; ++.@i ) mes .@amount[.@i] +"x "+ getitemname(.@id[.@i]); mes "for "+ F_InsertComma(.@zeny_total) +" Zeny ?"; next; if ( select( "Yes", "No" ) == 2 ) close; if ( Zeny + .@zeny_total > MAX_ZENY ) { mes "You can't carry that much Zeny."; close; } for ( .@i = 0; .@i < .@c; ++.@i ) delitem .@id[.@i], .@amount[.@i]; mes "All item sold for "+ F_InsertComma(.@zeny_total) +" Zeny"; Zeny += .@zeny_total; close; OnInit: setarray .Overcharge[0], 0, 7,9,11,13,15,17,19,21,23,24; end; }
  4. 1 point
    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
×
×
  • Create New...

Important Information

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