Radian Posted November 6, 2014 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Share Posted November 6, 2014 How can i set multiple items with multiple choices? for example. If player have item 501 or 502 or 503 then he can choose what he/she wants to trade with it.? Quote Link to comment Share on other sites More sharing options...
Skorm Posted November 7, 2014 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted November 7, 2014 Perhaps a little more information is needed? But maybe something along these lines or? getinventorylist; .@len = @inventorylist_count; copyarray .@inv_list[0], @inventorylist_id[0], .@len; setarray .@items, 501, 502, 503; setarray .@exchange, 504, 506, 507; .@l_2 = getarraysize(.@items); .@l_3 = getarraysize(.@exchange); for( .@a = 0; .@a < .@len; .@a++ ) { for( .@b = 0; .@b < .@l_2; .@b++ ) if( .@inv_list[.@a] == .@items[.@b] ) .@selection$ = .@selection$ + getitemname(.@inv_list[.@a]) + ":"; .@selection$ = .@selection$ + ":"; } mes "Pick from the items you'd like to exchange."; .@menu = select(.@selection$)-1; mes "You've selected "+getitemname(.@inv_list[.@menu])+". What would you like to exchange it with?"; for( .@a = 0; .@a < .@l_3; .@a++ ) .@s_2$[getarraysize(.@s_2$)] = getitemname(.@exchange[.@a]); .@s_3$ = implode( .@s_2$, ":" ); .@menu2 = select(.@s_3$)-1; delitem .@inv_list[.@menu], 1; getitem .@exchange[.@menu2], 1; Quote Link to comment Share on other sites More sharing options...
Radian Posted November 7, 2014 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Author Share Posted November 7, 2014 Perhaps a little more information is needed? But maybe something along these lines or? getinventorylist; .@len = @inventorylist_count; copyarray .@inv_list[0], @inventorylist_id[0], .@len; setarray .@items, 501, 502, 503; setarray .@exchange, 504, 506, 507; .@l_2 = getarraysize(.@items); .@l_3 = getarraysize(.@exchange); for( .@a = 0; .@a < .@len; .@a++ ) { for( .@b = 0; .@b < .@l_2; .@b++ ) if( .@inv_list[.@a] == .@items[.@b] ) .@selection$ = .@selection$ + getitemname(.@inv_list[.@a]) + ":"; .@selection$ = .@selection$ + ":"; } mes "Pick from the items you'd like to exchange."; .@menu = select(.@selection$)-1; mes "You've selected "+getitemname(.@inv_list[.@menu])+". What would you like to exchange it with?"; for( .@a = 0; .@a < .@l_3; .@a++ ) .@s_2$[getarraysize(.@s_2$)] = getitemname(.@exchange[.@a]); .@s_3$ = implode( .@s_2$, ":" ); .@menu2 = select(.@s_3$)-1; delitem .@inv_list[.@menu], 1; getitem .@exchange[.@menu2], 1; thanks it works Quote Link to comment Share on other sites More sharing options...
Radian Posted November 15, 2014 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Author Share Posted November 15, 2014 How can i fix this one? [Error]: buildin_delitem: unknown item "0".[Debug]: Source (NPC): Augustus at mellina (95,51) I set the item and exchange into this setarray .@items, 20286, 20287, 20288, 20289, 20290, 20291, 20292; setarray .@exchange, 20286, 20287, 20288, 20289, 20290, 20291, 20292; Quote Link to comment Share on other sites More sharing options...
Skorm Posted November 15, 2014 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted November 15, 2014 How can i fix this one? [Error]: buildin_delitem: unknown item "0".[Debug]: Source (NPC): Augustus at mellina (95,51) I set the item and exchange into this setarray .@items, 20286, 20287, 20288, 20289, 20290, 20291, 20292; setarray .@exchange, 20286, 20287, 20288, 20289, 20290, 20291, 20292; Just make sure all your items exist in your database to check use @item <item_id> if it doesn't work then they will cause that error. Quote Link to comment Share on other sites More sharing options...
Radian Posted November 15, 2014 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Author Share Posted November 15, 2014 How can i fix this one? [Error]: buildin_delitem: unknown item "0".[Debug]: Source (NPC): Augustus at mellina (95,51) I set the item and exchange into this setarray .@items, 20286, 20287, 20288, 20289, 20290, 20291, 20292; setarray .@exchange, 20286, 20287, 20288, 20289, 20290, 20291, 20292; Just make sure all your items exist in your database to check use @item <item_id> if it doesn't work then they will cause that error. Yea i've check it its working but sometimes the errors shows out. Quote Link to comment Share on other sites More sharing options...
Skorm Posted November 15, 2014 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted November 15, 2014 Yea i've check it its working but sometimes the errors shows out. I was thinking about it and someone might be exploiting the npc by dropping or storing the items in the middle of the transaction... Try this instead. prontera,101,101,5 script exchange_test 100,{ getinventorylist; .@len = @inventorylist_count; copyarray .@inv_list[0], @inventorylist_id[0], .@len; setarray .@items, 501, 502, 503; setarray .@exchange, 504, 506, 507; .@l_2 = getarraysize(.@items); .@l_3 = getarraysize(.@exchange); for( .@a = 0; .@a < .@len; .@a++ ) { for( .@b = 0; .@b < .@l_2; .@b++ ) if( .@inv_list[.@a] == .@items[.@b] ) .@selection$ = .@selection$ + getitemname(.@inv_list[.@a]) + ":"; .@selection$ = .@selection$ + ":"; } mes "Pick from the items you'd like to exchange."; .@menu = select(.@selection$)-1; mes "You've selected "+getitemname(.@inv_list[.@menu])+". What would you like to exchange it with?"; for( .@a = 0; .@a < .@l_3; .@a++ ) .@s_2$[getarraysize(.@s_2$)] = getitemname(.@exchange[.@a]); .@s_3$ = implode( .@s_2$, ":" ); .@menu2 = select(.@s_3$)-1; if( countitem(.@inv_list[.@menu]) >= 1 ) { delitem .@inv_list[.@menu], 1; getitem .@exchange[.@menu2], 1; } else mes "Something went wrong."; close; } 1 Quote Link to comment Share on other sites More sharing options...
Question
Radian
How can i set multiple items with multiple choices?
for example. If player have item 501 or 502 or 503 then he can choose what he/she wants to trade with it.?
Link to comment
Share on other sites
6 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.