I'm getting this 'too many events posted' bug, and have tracked it down.
I can force the error by doing this
player.Walk(40,639, eBlock,eWalkableAreas);
player.Walk(40,639, eBlock,eWalkableAreas);
player.Walk(40,639, eBlock,eWalkableAreas);
player.Walk(40,639, eBlock,eWalkableAreas);
player.Walk(40,639, eBlock,eWalkableAreas);
about 30 times.
(It's a tall scrolly room).
This is obviously an extreme test case, but in a game each time a line like this happens you get closer to the crash. So the crash can happen later unexpectedly where eveything usually worked.
I think if the walk function is unable to reach the position, or is already standing there, the event is not getting cleared.
edit: May or may not be important but code is in a use inventory on hotspot script, and the crash happens even when a few player.Changeroom(player.Room) calls have been made, inbetween.
Can you clarify, does the error happen as soon as you run that script, or once the character reaches the destination?
The player walks to the point, then it crashes
Ã, int t=0;
Ã, player.Walk(40, 469, eBlock, eWalkableAreas);
Ã, Display("%d", t);
Ã, t++;
Ã, player.Walk(40, 469, eBlock, eWalkableAreas);
Ã, Display("%d", t);
Ã, t++;
Ã, player.Walk(40, 469, eBlock, eWalkableAreas);
Ã, Display("%d", t);
Ã, t++;
Ã, player.Walk(40, 469, eBlock, eWalkableAreas);
Ã, Display("%d", t);
Ã, t++;
Ã, player.Walk(40, 469, eBlock, eWalkableAreas);
/*** crash too many events posted ***/
in fact it crashs on the 5th walk command. Although there were some other walks before this test code happens.
I had a similar problem when I manually scripted a character to walk to a hotspot upon interaction. I forgot that the hotspot already had a "Walk-to" point, so I think the game froze because it was trying to move the character twice at the same time. Removing the "Walk-to" point fixed this, though.
Ah yes, good point, that hotspot already had a walk-to point, I don't usually use them, and forgot about it.
I've removed the walk-to-points, and it still crashes.
Is 469 below the bottom screen Edge (ie. the Edge line in the Room Settings pane, not the actual screen size)?
No, bottom screen edge is at 479.
Ok, I've replicated the problem, I'll look into it. Thanks for your help.
Edit by strazer:
AGS v2.72 Beta 5:
* Fixed "too many events posted" error if several commands like Walk were used in quick succession.