Moriarty Posted September 16, 2013 Posted September 16, 2013 The title says it all, I'm making a function to return char_ids from everybody on the player screen, so I need to build an array from source, so I can use it on my script, but I have no idea how to do it Quote
Brian Posted September 16, 2013 Posted September 16, 2013 For examples, look at script commands that set global arrays. getpartymember() - src/map/script.c#L7142 for(i=0;i<MAX_PARTY;i++){ if(p->party.member[i].account_id){ switch (type) { case 2: mapreg_setreg(reference_uid(add_str("$@partymemberaid"), j),p->party.member[i].account_id); break; case 1: mapreg_setreg(reference_uid(add_str("$@partymembercid"), j),p->party.member[i].char_id); break; default: mapreg_setregstr(reference_uid(add_str("$@partymembername$"), j),p->party.member[i].name); } j++; } } Quote
Moriarty Posted September 17, 2013 Author Posted September 17, 2013 Thanks, I did it before looking here, this was a silly post, I should have searched Anyway, I have a new problem now.How do I delete all elements of this array before build it? I was using mapreg, now i'm using pc_setreg and deleting the array with the npc.. It works, but it would be nice to know how to do it from source :\ Quote
Brian Posted September 17, 2013 Posted September 17, 2013 Looking at src/map/mapreg_sql.c#L36, it automatically removes/deletes the variable if you are setting it to 0 or "". Quote
Moriarty Posted September 17, 2013 Author Posted September 17, 2013 Thanks a lot for you attetion. Quote
Question
Moriarty
The title says it all, I'm making a function to return char_ids from everybody on the player screen, so I need to build an array from source, so I can use it on my script, but I have no idea how to do it
4 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.