BUG/SUGGESTION: Disabling cursor animation on regions. [SOLVED]

Started by Rambutaan, Mon 14/02/2005 12:50:40

Previous topic - Next topic

Rambutaan

Hi all,

My apologies if this is in the wrong spot but I'm not sure if this is an easy problem to solve or not  :(.

I think it'd be great if there was an option to specify whether the cursor animations on objects, hotspots, characters and regions. The problem arises when you wish a region to be hidden from the player (e.g. a "pressure plate" that when the player steps on it triggers a door to open) so that the mouse cursor when it hovers over it, doesn't start animating (although you may still want it to animate on everything else). To try and get around this problem, I was hoping that I could just run a script for the problem regions and leave the animating to everything else.

I've tried placing the script:

if(GetHotspotAt(mouse.x,mouse.y)==1){
                                                     
SaveCursorForLocationChange();
SetCursorMode( 8 );

}

mentioned in an earlier post in the Repeatedly Executes function for the room, and it works for a hotspot, but when I do the same thing for a region, i.e.:

if(GetRegionAt(mouse.x,mouse.y)==1){
                                                     
SaveCursorForLocationChange();
SetCursorMode( 8 );

}

the cursor doesn't animate anymore.

Any bright ideas?

Ashen

The problem looks to be, since it's in repeatedly_execute, the SaveCursorForLocationChange is called again, after the SetCursorMode.

What if you try:
Code: ags

if(GetRegionAt(mouse.x,mouse.y)==1){
  SetMouseCursor ( 8 );
}
else SetDefaultCursor ();
I know what you're thinking ... Don't think that.

Rambutaan

Yeah I tried that but you see the weird thing about that is that the cursor still doesn't animate. It actually goes to frame 1 in the animation (as opposed to 0) but it still doesn't animate :(. Thanks for the suggestion though...

Ashen

Bum. I think I can see why, now - constantly re-setting the cursor mode, when not over the region, probably 'stalls' the animation. Didn't think about that.
How about:
Code: ags

if(GetRegionAt(mouse.x,mouse.y)==1){
  if (GetGlobalInt (1) == 0) { 
    SaveCursorForLocationChange();
    SetCursorMode( 8 );
    SetGlobalInt (1, 1);
}
else SetGlobalInt (1,0);

To get the SaveCursor/ChangeCursor bit to only run once.
I know what you're thinking ... Don't think that.

Rambutaan

Absolute legend!  ;D That did the trick :). Thanks a million Ashen :D.

SMF spam blocked by CleanTalk