After reading this post on mouse cursor looping I went ahead and tried to replicate the same behaviour using the latest build of AGS 3.5.1. It no longer appears to work - the mouse wait cursor continues to reset itself to the first frame when a new Wait(x) is called.
I also noticed that when the animation runs, it "hiccups" and skips between frames. It appears as if the engine is competing with itself for the View's graphic property - sometimes the (below script's) scripting code "wins" and sets the graphic property, other times the view's default animation "wins" and sets the graphic property. Is there a chance that the engine's graphics execution order (or script execution order?), or something else has changed since this code was written in 2014?
Have I missed something obvious?
Update: cause of the problem found. See my response below.
Code below. I have ensured that the correct View is being used, as well as wait delay, frames and sprite numbers.
Code: ags
I also noticed that when the animation runs, it "hiccups" and skips between frames. It appears as if the engine is competing with itself for the View's graphic property - sometimes the (below script's) scripting code "wins" and sets the graphic property, other times the view's default animation "wins" and sets the graphic property. Is there a chance that the engine's graphics execution order (or script execution order?), or something else has changed since this code was written in 2014?
Have I missed something obvious?
Update: cause of the problem found. See my response below.
Code below. I have ensured that the correct View is being used, as well as wait delay, frames and sprite numbers.
(at top of script)
// mouse wait cursor
int cursorWaitView = MOUSEWAIT; //view of your cursor
int cursorWaitDelay = 5; //animation delay of your cursor
int cursorWaitFrames = 8; //number of animated frames
int cursorWaitFirstSlot = 21; //ID of the first frame
int cursorWaitCounter; // maintain a counter for the cursor
function UpdateMouseWaitCursor()
{
if (!IsInterfaceEnabled())
{
cursorWaitCounter = (cursorWaitCounter + 1) % (cursorWaitDelay * cursorWaitFrames);
ViewFrame* vf = Game.GetViewFrame(cursorWaitView, 0, 0);
vf.Graphic = cursorWaitFirstSlot + cursorWaitCounter / cursorWaitDelay;
}
}
function repeatedly_execute_always()
{
UpdateMouseWaitCursor();
}