Jump to content

  •  

Bug Tracker Migration

June 3rd
Good news everyone! The staff has decided that it is time to slowly kill off this Bug Tracker. We will begin the process of slowly migrating from this Bug Tracker over to our Github Issues which can be found here: https://github.com/HerculesWS/Hercules/issues

Over the next couple of days, I will be closing off any opportunity to create new reports. However, I still will keep the opportunity to reply to existing Bug Reports. Doing this will allow us to slowly fix any bug reports we have listed here so that we can easily migrate over to our Issue Tracker.

Update - June 7th 2015: Creating new bug posts has been disabled. Please use our https://github.com/HerculesWS/Hercules/issues tracker to post bugs. Users are still able to reply to existing bug posts.

- Administration

Issue Information

  • #007965

  • 0 - None Assigned

  • Fixed

Issue Confirmations

  • Yes (1)No (0)
Photo

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
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;
}

Ind 
changed status to: Confirmed

	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.

...which allows for recursion to be endless aka as many events as you need...

there is a special case

#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

this would also make them stop using MAX_EVENTTIMER room.

I think there is a difference with
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.


changed status to: Fixed