Moriarty Posted September 16, 2013 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 135 Reputation: 13 Joined: 06/20/12 Last Seen: April 14, 2018 Share 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 Link to comment Share on other sites More sharing options...
Brian Posted September 16, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share 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 Link to comment Share on other sites More sharing options...
Moriarty Posted September 17, 2013 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 135 Reputation: 13 Joined: 06/20/12 Last Seen: April 14, 2018 Author Share 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 Link to comment Share on other sites More sharing options...
Brian Posted September 17, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share 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 Link to comment Share on other sites More sharing options...
Moriarty Posted September 17, 2013 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 135 Reputation: 13 Joined: 06/20/12 Last Seen: April 14, 2018 Author Share Posted September 17, 2013 Thanks a lot for you attetion. Quote Link to comment Share on other sites More sharing options...
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
Link to comment
Share on other sites
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.