PcPocket 2 Posted March 9, 2015 A very simple command for the queue system, very easy to do, but it isn't available queuecheck( queue_id, value );return 1 if the value is found in the queue, 0 if not.queueremove and queueadd does this checks, but you don't have the option to do the check without actually add / remove the value from the queue.Other thing that would be very usefull. queuevalues( queue_id );returns all the values from the queue as an array. I haven't tested queue iterator yet so I don't know it's behavior, but from what I read I read from the docs, I can't do something like 'setarray .@list,queueiterator(queue_id);', if I can, than do not consider this suggestion, just the above one. Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted March 9, 2015 A very simple command for the queue system, very easy to do, but it isn't available queuecheck( queue_id, value ); return 1 if the value is found in the queue, 0 if not. queueremove and queueadd does this checks, but you don't have the option to do the check without actually add / remove the value from the queue. Other thing that would be very usefull. queuevalues( queue_id ); returns all the values from the queue as an array. I haven't tested queue iterator yet so I don't know it's behavior, but from what I read I read from the docs, I can't do something like 'setarray .@list,queueiterator(queue_id);', if I can, than do not consider this suggestion, just the above one. 1) there's command called qicheck.2) there's queueiterator, which I think does the work, for what you would need array(maybe for looping and checking), that's what iterator do(loop through each value) Hope I didn't misunderstood your questions. 1 PcPocket reacted to this Quote Share this post Link to post Share on other sites
PcPocket 2 Posted March 9, 2015 1) *qicheck(<queue_iterator_id>);checks whether there is a next member in the iterator's queue, 1 whenit does, 0 otherwise.It's a command for the iterator, not to check if a value is in the queue. 2) Yeah, I tested it now. There is no need for "queuevalues", I mean.. it would be nice, but you can do it with queueiterator.I remain with my main suggestion Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted March 9, 2015 Moving to suggestions forum.. Edit: I would like to suggest 3rd thing in this case Move queue system to different interface rather than in script-> pointer... Quote Share this post Link to post Share on other sites
PcPocket 2 Posted March 10, 2015 Sorry for the wrong area haha anyway, how does this work? Somebody from developer team visit this area?Well, another thing..I just finished my system, and I noticed that my queuesize is return -1 after some actions. I use queueremove when player die/change map/logout, maybe this is causing the queue counting to be reduced twice. I don't know, I just know that a queue can't ever have a size smaller than 0. Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted March 10, 2015 Sorry for the wrong area haha anyway, how does this work? Somebody from developer team visit this area? Well, another thing.. I just finished my system, and I noticed that my queuesize is return -1 after some actions. I use queueremove when player die/change map/logout, maybe this is causing the queue counting to be reduced twice. I don't know, I just know that a queue can't ever have a size smaller than 0. Hmmm.. Strange. I have whole BG system using queue, it never got below 0 Quote Share this post Link to post Share on other sites
PcPocket 2 Posted March 10, 2015 (edited) Yeah.. the system I'm working is a BG system too.I use queueremove on everybody on the queue when it is full enough to start the match.And queueopt to call a function that will remove the player from the queue ( on the 3 options, move from map, die or logout ).After I player 2 modules, the queue gets to -1. I will do some tests to figure out whats the reason. If I don't find out, I will patch in the source to never get it below 0 haha. By the way, queue check command: bool script_hqueue_check(int idx, int var) { if( idx < 0 || idx >= script->hqs || script->hq[idx].size == -1 ) { ShowWarning("script_hqueue_add: unknown queue id %dn",idx); return false; } else { int i; for (i = 0; i < script->hq[idx].size; i++) { if (script->hq[idx].item[i] == var) { return true; } } return false; }}BUILDIN(queuecheck) { int idx = script_getnum(st, 2); int var = script_getnum(st, 3); script_pushint(st,script->queue_check(idx,var)?1:0); return true;} They may want to invert the 'true' and 'false' returns, as all queue commands return 0 upon success ( why? I don't know )And of course, the rest. BUILDIN_DEF(queuecheck,"ii"), script->queue_check = script_hqueue_check; script.h bool (*queue_check) (int idx, int var); @EditI found out the piece of code causing it. function Players2BG { .@queue01 = queueiterator(getarg(0)); for (.@elem = qiget(.@queue01); qicheck(.@queue01); .@elem = qiget(.@queue01)) { announce "Adding player"+.@elem+" from queue"+getarg(0)+" to BG Team "+getarg(1),8; player2bg(getarg(1),.@elem,$@BG_Status); queueremove(getarg(0),.@elem); // Removes from the queue } return;} Then, the second time I go to the battleground ( the first one works fine ):(( the announce is in portuguese in the picture )getarg(0) = Queue IDgetarg(1) = BG Team IDI'm almost sure that I'm missing a qiclear in the end of the function, will test it now, must solve it.But.. I still think that the number of elements in the queue shouldn't be able to be lower than 0. @edit2Yeah.. qiclear didn't solve the problem.I tested something new, I put 'queueremove($bgTeamQueue01,-1);' in the top of npc script, so everytime I click on it, it attempts to remove a non-existant value from the queue.Result: After I played one match, every queueremove, lowered the queuecount by 1. So if I click 10 times, npc show that queue has -10 members..This just works after I play once ( so Players2BG gets called ).Trying to figure out why.@edit3Yeah, there is a bug in queueremove command, trying to fix, post here soon.@edit4Aparently, queueremove isn't actually removing a value from the queue, but changing it value to -1? Edited March 10, 2015 by PcPocket 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted November 4, 2015 (edited) confirming this bug http://upaste.me/adea21853ecefe7a9 when player A joins, queue list as 1. 2000000when player B joins, queue list as1. 20000002. 2000001and now remove player A, queue list as1. -12. 2000001this is definitely not rightthe queuesize is display correctly as only 1 person, but the queueiterator still having 2 entry ima thinking of know how to fix this bug EDIT: found 4 bugs in the process XD Fix *queueremove should return true if player is not in the queue Fix *queueiterator return same amount of *queuesize upon *queueremove Fix *queuedel doesn't remove player's side queue Fix @QMapChangeTo$ not usable when HQO_OnMapChange triggered Edited November 5, 2015 by AnnieRuru 1 Aly reacted to this Quote Share this post Link to post Share on other sites