pajodex Posted March 8, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Share Posted March 8, 2018 Hi, So I tested out a lot of things but this part seemed to be not working. for(.@i=0; .@i < .@size; .@i++) { if (.char_id[.@i] == getcharid(0)) cleararray .char_id[.@i],0,getcharid(0); } This supposed to delete char_id to the array. Is there an alternative where I can retrieve the char_id list so I can remove the specific char_id listed? To explain futher: array .char_id: .char_id[0] = 150001 .char_id[1] = 150002 .char_id[2] = 150003 .char_id[3] = 150004 I want to remove .char_id[2] from the list. using: deletearray .char_id[2],1; so results will be: .char_id[0] = 150001 .char_id[1] = 150002 .char_id[2] = 150004 I also tried this: for(.@i=0; .@i < .@size; .@i++) { if (.char_id[.@i] == getcharid(0)) deletearray .char_id[.@i],1; } but I figured that .@i is not = 2... I know you get what I mean xD Thanks for anybody interested in helping. Quote Link to comment Share on other sites More sharing options...
0 Ajjwidjdneidjenw Posted March 8, 2018 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 161 Reputation: 31 Joined: 12/06/11 Last Seen: December 25, 2022 Share Posted March 8, 2018 Is .@size defined? try for(.@i=0; .@i < getarraysize(.char_id); .@i++) { if (.char_id[.@i] == getcharid(0)) deletearray .char_id[.@i],1; } 1 Quote Link to comment Share on other sites More sharing options...
0 pajodex Posted March 8, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Author Share Posted March 8, 2018 (edited) 1 minute ago, Jeroen said: Is .@size defined? try for(.@i=0; .@i < getarraysize(.char_id); .@i++) { if (.char_id[.@i] == getcharid(0)) deletearray .char_id[.@i],1; } Will this part of the code ".@i" deletearray .char_id[.@i],1; locate the char_id of the invoking character? Edited March 8, 2018 by pajodex Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted June 29, 2018 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted June 29, 2018 .@aid = getcharid(0); for(.@i = getarraysize(.char_id) - 1; .@i >= 0; .@i--) { if (.char_id[.@i] == .@aid) deletearray .char_id[.@i],1; } you could do it this way as well, loop from the end to the start... this way you wont need to worry to recalculate the index in case you're intend to continue removing all the duplicates data in the array. 1 Quote Link to comment Share on other sites More sharing options...
Question
pajodex
Hi,
So I tested out a lot of things but this part seemed to be not working.
for(.@i=0; .@i < .@size; .@i++) { if (.char_id[.@i] == getcharid(0)) cleararray .char_id[.@i],0,getcharid(0); }
This supposed to delete char_id to the array.
Is there an alternative where I can retrieve the char_id list so I can remove the specific char_id listed? To explain futher:
array .char_id: .char_id[0] = 150001 .char_id[1] = 150002 .char_id[2] = 150003 .char_id[3] = 150004 I want to remove .char_id[2] from the list. using: deletearray .char_id[2],1; so results will be: .char_id[0] = 150001 .char_id[1] = 150002 .char_id[2] = 150004
I also tried this:
for(.@i=0; .@i < .@size; .@i++) { if (.char_id[.@i] == getcharid(0)) deletearray .char_id[.@i],1; }
but I figured that .@i is not = 2... I know you get what I mean xD
Thanks for anybody interested in helping.
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.