pajodex Posted March 8, 2018 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
0 Ajjwidjdneidjenw Posted March 8, 2018 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
0 pajodex Posted March 8, 2018 Author 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
0 Emistry Posted June 29, 2018 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
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.
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.