Issue Information
-
#007965
-
0 - None Assigned
-
Fixed
Issue Confirmations
-
Yes (1)No (0)


addtimer command should report an error if it hits MAX_EVENTTIMER
Posted by AnnieRuru on 12 January 2014 - 09:55 AM
http://rathena.org/b...max-eventtimer/
http://rathena.org/b...pc-event-error/
what a long way to tackle this topic
and the reason is so simple ...
just because the *addtimer script command doesn't report an error when the MAX_EVENTTIMER is full
https://github.com/H...c/map/map.h#L35
there is currently a hardcoded limit that addtimer command can only queue up to 32 instances
over that, addtimer command doesn't report an error
but its weird that OnxxxxEvent does !
https://github.com/H.../map/npc.c#L285
so its better for the addtimer command should be report an error
suggestion, follow how rathena did
http://rathena.org/b...pc-event-error/
what a long way to tackle this topic
and the reason is so simple ...
just because the *addtimer script command doesn't report an error when the MAX_EVENTTIMER is full
https://github.com/H...c/map/map.h#L35
there is currently a hardcoded limit that addtimer command can only queue up to 32 instances
over that, addtimer command doesn't report an error
but its weird that OnxxxxEvent does !
https://github.com/H.../map/npc.c#L285
so its better for the addtimer command should be report an error
suggestion, follow how rathena did
BUILDIN(addtimer) { int tick = script_getnum(st,2); const char* event = script_getstr(st, 3); TBL_PC* sd; script->check_event(st, event); sd = script->rid2sd(st); if( sd == NULL ) return true; if (!pc_addeventtimer(sd,tick,event)) { ShowWarning("buildin_addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n",sd->status.char_id,event); return false; } return true; }
if (!pc->addeventtimer(sd,100,sd->eventqueue[0])) { //Failed to dequeue, couldn't set a timer. ShowWarning("npc_event_dequeue: event timer is full !\n"); return 0; }hmm I wonder why npc_event_dequeue sets a 100ms delay between events, I currently see no reason for them not to be run as the other finishes and so son (the mechanism for that is already existent, script_state has a bk_st pointer to the previous script_state, which allows for recursion to be endless aka as many events as you need), this would also make them stop using MAX_EVENTTIMER room.
there is a special case...which allows for recursion to be endless aka as many events as you need...
#define MAX_EVENTQUEUE 2
yes you might make it infinite IF there is no MAX_EVENTQUEUE
but I remember ultramage add it purposely to ensure the scripters use a clean way to queue up a OnxxxxEvent
there are a few ways to hit this MAX_EVENTQUEUE
use OnPCLoginEvent: and a *mes + *next, then the next OnPCLoginEvent will be waiting in a queue
if used too many, the server will print this error
https://github.com/H.../map/npc.c#L774
I think there is a difference withthis would also make them stop using MAX_EVENTTIMER room.
MAX_EVENTQUEUE and MAX_EVENTTIMER ...
read that topic in rathena forum =/
http://rathena.org/b...error/?p=239258
EDIT: it seems like you have some idea to improve this part, I am interested to hear it
EDIT2: are you thinking about removing the limitation of MAX_EVENTTIMER and MAX_EVENTQUEUE all-together ?
I think hercules core-developer can find a way to make this run unlimitedly
Edited by AnnieRuru, 12 January 2014 - 09:57 PM.