namerpus18 Posted November 7, 2023 Group: Members Topic Count: 40 Topics Per Day: 0.06 Content Count: 113 Reputation: 6 Joined: 11/15/22 Last Seen: 11 hours ago Share Posted November 7, 2023 (edited) Good Day Everyone, Please help me I want to make all cards in my inventory show in the select menu. Thank you so much, ~NOOB prontera,164,200,4 script selectcard 112,{ getinventorylist(); setarray .@menulist[0],0; .@j = 0; for (.@i = 0; .@i < @inventorylist_count; ++.@i) { .@idd = @inventorylist_id[.@i]; .@type = getiteminfo(.@idd,2); if (.@type == 6) { .@menulist[@j] = .@idd; .@j++; dispbottom .@menulist[@j]; } } for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i) { .@menu$ = .@menu$ + getitemname(.@menulist[.@i]); .@menu$ = .@menu$ + ":"; .@part = .@menulist[select(.@menu$)]; } .@part = .@menulist[select(.@menu$)]; end; } Edited November 7, 2023 by namerpus18 Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted January 23 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10015 Reputation: 2357 Joined: 10/28/11 Last Seen: Saturday at 02:34 PM Share Posted January 23 getinventorylist; for (.@i = 0; .@i < @inventorylist_count; .@i++) { if (getiteminfo(@inventorylist_id[.@i], ITEMINFO_TYPE) == IT_CARD) .@menu$ = .@menu$ + getitemname(@inventorylist_id[.@i]); .@menu$ = .@menu$ + ":"; } .@i = select(.@menu$) - 1; mes "Your selected card = " + getitemname(@inventorylist_id[.@i]); you can also do this this way. 1 Quote Link to comment Share on other sites More sharing options...
0 Racaae Posted November 7, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 189 Reputation: 82 Joined: 06/02/12 Last Seen: 5 hours ago Share Posted November 7, 2023 Hi, In the following line there's a missing .(dot) in the variable name: .@menulist[@j] = .@idd; To: .@menulist[.@j] = .@idd; In this part you wrote the same select command line twice: for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i) { .@menu$ = .@menu$ + getitemname(.@menulist[.@i]); .@menu$ = .@menu$ + ":"; .@part = .@menulist[select(.@menu$)]; } .@part = .@menulist[select(.@menu$)]; Remove the first one, and add -1 in the second. Like this: for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i) { .@menu$ = .@menu$ + getitemname(.@menulist[.@i]); .@menu$ = .@menu$ + ":"; } .@part = .@menulist[select(.@menu$) - 1]; 1 Quote Link to comment Share on other sites More sharing options...
0 namerpus18 Posted November 7, 2023 Group: Members Topic Count: 40 Topics Per Day: 0.06 Content Count: 113 Reputation: 6 Joined: 11/15/22 Last Seen: 11 hours ago Author Share Posted November 7, 2023 38 minutes ago, Racaae said: Hi, In the following line there's a missing .(dot) in the variable name: Hi thank you so much, it worked. Quote Link to comment Share on other sites More sharing options...
Question
namerpus18
Good Day Everyone,
Please help me I want to make all cards in my inventory show in the select menu.
Thank you so much, ~NOOB
prontera,164,200,4 script selectcard 112,{ getinventorylist(); setarray .@menulist[0],0; .@j = 0; for (.@i = 0; .@i < @inventorylist_count; ++.@i) { .@idd = @inventorylist_id[.@i]; .@type = getiteminfo(.@idd,2); if (.@type == 6) { .@menulist[@j] = .@idd; .@j++; dispbottom .@menulist[@j]; } } for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i) { .@menu$ = .@menu$ + getitemname(.@menulist[.@i]); .@menu$ = .@menu$ + ":"; .@part = .@menulist[select(.@menu$)]; } .@part = .@menulist[select(.@menu$)]; end; }
Link to comment
Share on other sites
3 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.