Kurofly Posted April 13, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted April 13, 2015 Hello rA world ! I'm working on a script in which it would be very useful to have an array in another array. Is it possible? Thanks in advance Quote Link to comment Share on other sites More sharing options...
nanakiwurtz Posted April 13, 2015 Group: Members Topic Count: 81 Topics Per Day: 0.02 Content Count: 1654 Reputation: 583 Joined: 08/09/12 Last Seen: January 14, 2020 Share Posted April 13, 2015 Example? Quote Link to comment Share on other sites More sharing options...
Kurofly Posted April 13, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Author Share Posted April 13, 2015 I tried something like setarray .array[0][0] , 1; Doesn't work. I'm doing an autoshop which sells items instead of players so that they can play while selling. A shop must be able to keep trace of what its owners sold so that if they log out before the shop closes it can give them back their items and money$$ To do so I need to have an array with all the items sold for each player who didn't login back yet So the best way would have to set an array in another array. I already changed everything using getd instead but this is something I will want to do in the future for sure so that's why I wanted to know. Thank you for your time . Quote Link to comment Share on other sites More sharing options...
nanakiwurtz Posted April 13, 2015 Group: Members Topic Count: 81 Topics Per Day: 0.02 Content Count: 1654 Reputation: 583 Joined: 08/09/12 Last Seen: January 14, 2020 Share Posted April 13, 2015 Hmm unfortunately a multi-dimension array is impossible to use in rA Quote Link to comment Share on other sites More sharing options...
Kurofly Posted April 13, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Author Share Posted April 13, 2015 (edited) Too bad At least I know for sure it's impossible. TY Edited April 13, 2015 by Kurofly Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 14, 2015 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 613 Joined: 07/05/12 Last Seen: April 15 Share Posted April 14, 2015 You can do a trick setarray .@array_acid[0], 2000000, 2000001; setarray getd( ".@array_item"+ .@array_acid[0] ), 501, 502, 503; .@array_item2000000[0] == 501 .@array_item2000000[1] == 502 .@array_item2000000[2] == 503 Quote Link to comment Share on other sites More sharing options...
Kurofly Posted April 14, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Author Share Posted April 14, 2015 Don't worry, that's exactly what I did function SetShop { attachrid(getarg(1)); if (getarg(0) == 0) { mes "Sorry but the last shop has been taken during your set up" ; close; } //creates the items in the shop npcshopitem "Subshop"+getarg(0),@sold_nameid[0],@price[0]; delitem @sold_nameid[0],@sold_quantity[0]; for(@i = 1 ; @i < getarraysize(@sold_nameid) ; @i++) { delitem @sold_nameid[@i],@sold_quantity[@i] ; npcshopadditem "Subshop"+getarg(0),@sold_nameid[@i],@price[@i]; } //set the shop and player variables for (@i = 0 ; @i < getarraysize(@sold_nameid) ; @i++) { setarray getd("$Shop"+getarg(0)+"itemid"+getarraysize(getd("$Shop"+getarg(0)+"rid"))+"["+@i+"]") , @sold_nameid[@i]; setarray getd("$Shop"+getarg(0)+"amount"+getarraysize(getd("$Shop"+getarg(0)+"rid"))+"["+@i+"]") , @sold_quantity[@i]; setarray getd("$Shop"+getarg(0)+"price"+getarraysize(getd("$Shop"+getarg(0)+"rid"))+"["+@i+"]") , @price[@i]; setarray getd("$"+strcharinfo(0)+"amount["+@i+"]") , @sold_quantity[@i]; } setarray getvariableofnpc(.shopname$,"Shop#"+getarg(0)) , @shopname$; setd "$Shop"+getarg(0)+"rid["+getarraysize(getd("$Shop"+getarg(0)+"rid"))+"]" , getarg(1); //setarray getvariableofnpc(.itemidcount[getarraysize(getd("$Shop"+getarg(0)+"rid"))],"Shop#"+getarg(0)) , @i+1; getmapxy @map$,@x,@y,0; set getvariableofnpc(.map$,"Shop#"+getarg(0)) , @map$; set getvariableofnpc(.x,"Shop#"+getarg(0)) , @x; set getvariableofnpc(.y,"Shop#"+getarg(0)) , @y; //enable shop donpcevent "Shop#"+getarg(0)+"::OnEnable"; return; } But of course it's god damn unreadable Too bad though ^^ Quote Link to comment Share on other sites More sharing options...
Question
Kurofly
Hello rA world !
I'm working on a script in which it would be very useful to have an array in another array.
Is it possible?
Thanks in advance
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.