gunvald Posted November 4, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 50 Reputation: 5 Joined: 03/31/12 Last Seen: January 4, 2017 Share Posted November 4, 2012 Is it possible for a script to show someone's storage in an npc dialog box?? And also shows if it has a card... Any help would be greatly appreciated Thx!!! Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 4, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 4, 2012 (edited) prontera,155,187,5 script kdjsfhdksjf 100,{ .@page = 5; // display 5 items per page query_sql( "select count(1) from storage where account_id = "+ getcharid(3), .@total ); while (1) { .@nb = query_sql( "select nameid, amount, identify, refine, attribute, card0, card1, card2, card3 from storage where account_id = "+ getcharid(3) +" limit "+ .@page +" offset "+ .@offset, .@itemid, .@amount, .@identify, .@refine, .@broken, .@card1, .@card2, .@card3, .@card4 ); mes "= Total "+ .@total +" items, Page No."+ .@current_page++ +" ="; for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@amount[.@i] +"x "+ @itemname2_info$[0] + callfunc( "getitemname2", .@itemid[.@i], .@identify[.@i], .@refine[.@i], .@broken[.@i], .@card1[.@i], .@card2[.@i], .@card3[.@i], .@card4[.@i] ) +"^000000"; .@offset += .@page; if ( .@offset < .@total ) next; else close; } close; } simpliest SQL script ever remember need to have my getitemname2 function or maybe you want to show them in another way ? EDIT:fix .@amount into .@amount[.@i] Edited November 5, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
gunvald Posted November 5, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 50 Reputation: 5 Joined: 03/31/12 Last Seen: January 4, 2017 Author Share Posted November 5, 2012 Can you make it show like your itemlist script? Thx annieruru!! More power!! Quote Link to comment Share on other sites More sharing options...
Peopleperson49 Posted November 5, 2012 Group: Members Topic Count: 219 Topics Per Day: 0.05 Content Count: 1181 Reputation: 141 Joined: 01/27/12 Last Seen: April 15 Share Posted November 5, 2012 Seems like if you made that script a OnWhisperGlobal it would work out really good for GMs. Nice work. Peopleperson49 Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 5, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 5, 2012 (edited) /* item = 0,2,11 cash = 18 weapon = 4 armor = 5,8 ammo = 10 card = 6 etc = 3,7 */ prontera,155,187,5 script kdjsfhdksjf 100,{ .@page = 5; // display 5 items per page input .@name$; if ( !( .@aid = getcharid( 3, .@name$ ) ) ) { if ( !query_sql( "select account_id from `char` where name = '"+ escape_sql(.@name$)+"'", .@aid ) ) { mes "no such player"; close; } } /* query_sql( "select count(1) from storage where account_id = "+ .@aid, .@total ); while (1) { .@nb = query_sql( "select nameid, amount, identify, refine, attribute, card0, card1, card2, card3 from storage where account_id = "+ .@aid +" limit "+ .@page +" offset "+ .@offset, .@itemid, .@amount, .@identify, .@refine, .@broken, .@card1, .@card2, .@card3, .@card4 ); mes "= Total "+ .@total +" items, Page No."+ .@current_page++ +" ="; for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@amount +"x "+ @itemname2_info$[0] + callfunc( "getitemname2", .@itemid[.@i], .@identify[.@i], .@refine[.@i], .@broken[.@i], .@card1[.@i], .@card2[.@i], .@card3[.@i], .@card4[.@i] ) +"^000000"; .@offset += .@page; if ( .@offset < .@total ) next; else close; }*/ callsub L_usable_items, "Healing Items", 0, .@aid; close; /* L_display: switch ( getarg(0) ) { case 0: callsub L_usable_items, "Healing Items", getarg(0), getcharid(3); case 2: callsub L_usable_items, "Usable Items"; case 3: callsub L_usable_items, "etc"; case 4: callsub L_weapons, "Weapons"; case 5: callsub L_armors, "Armors"; case 6: callsub L_usable_items, "Cards"; case 7: callsub L_pet_equipments, "Pet egg"; case 8: callsub L_pet_equipments, "Pet equipments"; default: callsub L_pet_equipments, "Misc Equipments"; case 10: callsub L_usable_items, "Ammunitions"; case 11: callsub L_usable_items, "Usable Items"; case 18: callsub L_usable_items, "Cash Items"; } return;*/ L_usable_items: set .@nb, query_sql( "select nameid, amount, card0, card2, card3, expire_time from storage where account_id = "+ getarg(2) +" and type = "+ getarg(1), .@itemid, .@amount, .@card1, .@card3, .@card4, .@expire ); if ( .@nb ) { mes "^000000=== "+ getarg(0) +" ==="; set .@i, 0; while ( .@i < .@nb ) { mes "^996600"+ .@amount[.@i] +" ^00AA00"+ getitemname( .@itemid[.@i] ) +" ^EE8800("+ .@itemid[.@i] +")"; if ( .@card1[.@i] == 254 ) mes " ^0000FF> Char ID : ("+( .@card4[.@i] * pow(2,16) + .@card3[.@i] )+")"; if ( .@expire[.@i] ) mes " ^FF0000> Expire : "+ callfunc( "timeleft__", .@expire[.@i] - gettimetick(2) ); set .@i, .@i +1 ; } mes " "; } return; L_pet_equipments: set .@nb, query_sql( "select nameid, amount, card0, card2, card3, expire_time from storage where account_id = "+ getarg(2) +" and type = "+ getarg(1), .@itemid, .@amount, .@card1, .@card3, .@card4, .@expire ); if ( .@nb ) { mes "^000000=== "+ getarg(0) +" ==="; set .@i, 0; while ( .@i < .@nb ) { mes "^996600"+ .@amount[.@i] +" ^00AA00"+ getitemname( .@itemid[.@i] ) +" ^EE8800("+ .@itemid[.@i] +")"; if ( .@card1[.@i] == 254 || .@card1[.@i] == 255 ) mes " ^0000FF> Char ID : ("+( .@card4[.@i] * pow(2,16) + .@card3[.@i] )+")"; if ( .@expire[.@i] ) mes " ^FF0000> Expire : "+ callfunc( "timeleft__", .@expire[.@i] - gettimetick(2) ); set .@i, .@i +1 ; } mes " "; } return; L_armors: set .@nb, query_sql( "select nameid, amount, identify, refine, attribute, card0, card1, card2, card3, expire_time from storage where account_id = "+ getarg(2) +" and type = "+ getarg(1), .@itemid, .@amount, .@identify, .@refine, .@broken, .@card1, .@card2, .@card3, .@card4, .@expire ); if ( .@nb ) { mes "^000000=== "+ getarg(0) +" ==="; set .@i, 0; while ( .@i < .@nb ) { set .@slot, getiteminfo( .@itemid[.@i], 10 ); mes "^996600"+ .@amount[.@i] +" "+( (.@identify[.@i])?( (.@broken[.@i])?"^FF0000":"^00AA00"):"^999999" )+ getitemname( .@itemid[.@i] ) +" "+( ( .@slot && .@card1[.@i] != 254 && .@card1[.@i] != 255 )?"["+ .@slot +"] ":"" )+( ( .@refine[.@i] )?("+"+ .@refine[.@i]):"" )+" ^EE8800("+ .@itemid[.@i] +")"; if ( .@card1[.@i] == 254 || .@card1[.@i] == 255 ) mes " ^0000FF> Char ID : ("+( .@card4[.@i] * pow(2,16) + .@card3[.@i] )+")"; else if ( .@card1[.@i] > 500 || .@card2[.@i] > 500 || .@card3[.@i] > 500 || .@card4[.@i] > 500 ) { set .@j, 1; while ( .@j <= 4 ) { mes ( getd(".@card"+ .@j +"["+ .@i +"]") )?" ^70AC11> "+ getitemname( getd(".@card"+ .@j +"["+ .@i +"]") ) +" ("+ getd(".@card"+ .@j +"["+ .@i +"]") +")":""; set .@j, .@j +1 ; } } if ( .@expire[.@i] ) mes " ^FF0000> Expire : "+ callfunc( "timeleft__", .@expire[.@i] - gettimetick(2) ); set .@i, .@i +1 ; } mes " "; } return; L_weapons: set .@nb, query_sql( "select nameid, amount, identify, refine, attribute, card0, card1, card2, card3, expire_time from storage where account_id = "+ getarg(2) +" and type = "+ getarg(1), .@itemid, .@amount, .@identify, .@refine, .@broken, .@card1, .@card2, .@card3, .@card4, .@expire ); if ( .@nb ) { mes "^000000=== Weapons ==="; set .@i, 0; while ( .@i < .@nb ) { set .@slot, getiteminfo( .@itemid[.@i], 10 ); if ( .@card1[.@i] == 255 && .@card2[.@i] ) { if ( .@card2[.@i] / 10 == 128 ) set .@sc$, "^000000VS "; else if ( .@card2[.@i] / 10 == 256 ) set .@sc$, "^000000VVS "; else if ( .@card2[.@i] / 10 == 384 ) set .@sc$, "^000000VVVS "; else set .@sc$, ""; if ( .@card2[.@i] % 10 == 1 ) set .@ele$, "^00AAAA(Ice) "; else if ( .@card2[.@i] % 10 == 2 ) set .@ele$, "^CCAA55(Earth) "; else if ( .@card2[.@i] % 10 == 3 ) set .@ele$, "^FF0000(Fire) "; else if ( .@card2[.@i] % 10 == 4 ) set .@ele$, "^999999(Wind) "; else set .@ele$, ""; } else { set .@sc$, ""; set .@ele$, ""; } mes "^996600"+ .@amount[.@i] +" "+ .@sc$ + .@ele$ +( (.@identify[.@i])?( (.@broken[.@i])?"^FF0000":"^00AA00"):"^999999" )+ getitemname( .@itemid[.@i] ) +" "+( ( .@slot && .@card1[.@i] != 254 && .@card1[.@i] != 255 )?"["+ .@slot +"] ":"" )+( ( .@refine[.@i] )?("+"+ .@refine[.@i]) +" ":"" )+" ^EE8800("+ .@itemid[.@i] +")"; if ( .@card1[.@i] == 255 || .@card1[.@i] == 254 && .@card2[.@i] == 0 ) mes " ^0000FF> Char ID : ("+( .@card4[.@i] * pow(2,16) + .@card3[.@i] )+")"; else if ( .@card1[.@i] > 500 || .@card2[.@i] > 500 || .@card3[.@i] > 500 || .@card4[.@i] > 500 ) { set .@j, 1; while ( .@j <= 4 ) { mes ( getd(".@card"+ .@j +"["+ .@i +"]") )?" ^70AC11> "+ getitemname( getd(".@card"+ .@j +"["+ .@i +"]") ) +" ("+ getd(".@card"+ .@j +"["+ .@i +"]") +")":""; set .@j, .@j +1 ; } } if ( .@expire[.@i] ) mes " ^FF0000> Expire : "+ callfunc( "timeleft__", .@expire[.@i] - gettimetick(2) ); set .@i, .@i +1 ; } mes " "; } return; } the moment map-server tell me this error [sql]: DB error - Unknown column 'type' in 'where clause' [Debug]: at d:\eathena\rathena sql 16819\src\map\script.c:14309 - select nameid, amount, card0, card2, card3, expire_time from storage where account_id = 2000000 and type = 0 [Debug]: Source (NPC): kdjsfhdksjf at prontera (155,187) I give up this script is too crazy my itemlist script version is possible because we have *getinventorylist script command a player can carry 100 items max, and our script engine can hold 128 indexes that's why the script is possible but storage, we don't have getstoragelist script command, so this script need hijack SQL SQL can only return 128 rows max, but our current storage limit is 600 spaces WAY more than rathena script engine array can use (5x of our script engine limitation) its possible to make this happen with calling SQL query multiple times, but its not resource friendly furthermore, this script ... needs some kind of algorithm .... to match making 600 different items into 1 long array, and split them all out into different types of items ... I really hate tackling algorithm script ... yeah I know how to do while ( .@j *128 < 600 ) for ( .@i = 0; .@i < 128; .@i++ ) set getd(".array"+ .@j +"["+ .@i +"), information; .@j++; just not in the mood to do something like this right now perhaps some other day I might come back tackle this script, but not today I got more urgent things to do ... @Peopleperson49, we got #storagelist atcommand #storagelist annieruru list out all storage items in my char but yeah ... if my storage has too many items, the chatbox is not enough to display the full information ... that's why he is suggesting to make them into npc chat box and use menu to display them separately by item types which my itemlist script did Edited November 5, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Peopleperson49 Posted November 5, 2012 Group: Members Topic Count: 219 Topics Per Day: 0.05 Content Count: 1181 Reputation: 141 Joined: 01/27/12 Last Seen: April 15 Share Posted November 5, 2012 I understand how #storagelist works. I just like the idea of using the NPC script. I just hate going to a physical NPC when I can use a whisper. Peopleperson49 Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 5, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 5, 2012 - script storagelist2 -1,{ end; Onaa: if ( !( .@aid = getcharid( 3, .@atcmd_parameters$ ) ) ) { if ( !query_sql( "select account_id from `char` where name = '"+ escape_sql(.@atcmd_parameters$)+"'", .@aid ) ) { mes "no such player"; close; } } query_sql( "select count(1) from storage where account_id = "+ .@aid, .@total ); while (1) { .@nb = query_sql( "select nameid, amount, identify, refine, attribute, card0, card1, card2, card3 from storage where account_id = "+ .@aid +" limit "+ .page +" offset "+ .page * .@current_page, .@itemid, .@amount, .@identify, .@refine, .@broken, .@card1, .@card2, .@card3, .@card4 ); mes "= Total "+ .@total +" items, Page No."+( .@current_page +1 )+" ="; for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@amount[.@i] +"x "+ @itemname2_info$[0] + callfunc( "getitemname2", .@itemid[.@i], .@identify[.@i], .@refine[.@i], .@broken[.@i], .@card1[.@i], .@card2[.@i], .@card3[.@i], .@card4[.@i] ) +"^000000"; next; if ( select ( "Next Page", "Previous Page" ) == 1 ) { if ( .page * ( .@current_page +1 ) < .@total ) .@current_page++; else { mes "the end of the page"; close; } } else { if ( .@current_page == 0 ) { mes "this is the 1st page"; close; } else .@current_page--; } } close; OnInit: bindatcmd "storagelist2", "storagelist2::Onaa", 40,40; // 40 for atcommand, 40 for charcommand .page = 5; // display 5 items per page end; } if you want to display page by page, this script can do Usage: @storagelist2 annieruru look up the storage in my account Quote Link to comment Share on other sites More sharing options...
gunvald Posted November 6, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 50 Reputation: 5 Joined: 03/31/12 Last Seen: January 4, 2017 Author Share Posted November 6, 2012 thx master annie Im gonna use the storagelist2 thx again! Quote Link to comment Share on other sites More sharing options...
Question
gunvald
Is it possible for a script to show someone's storage in an npc dialog box??
And also shows if it has a card...
Any help would be greatly appreciated
Thx!!!
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.