Mouse Stuck in Look At mode after Room Switch

Started by Jrodan, Wed 22/05/2024 15:36:31

Previous topic - Next topic

Jrodan

Hi,
This is my first post. Been creeping on here for a while now, the community seems active and really nice.

I can't seem to find a post regarding this issue. I have a room where the 'Show Player Character' is set to false which auto changes the mouse to Look At. Once I change rooms and the Player Character is now set to 'True' the Mouse Cursor is still stuck on 'Look At Mode'. I've tried using the function room_AfterFadeIn() to reset the mouse in the Room Script but this doesn't seem to work at all. Here is what I've tried:
Code: ags
function room_AfterFadeIn()
{
 mouse.EnableMode(eModeInteract);
 Mouse.Mode = eModeInteract;
 mouse.Visible = true;
 Wait(30);
 Display("anything?");
}
I'm using the BASS template. I added the display text to check if it's running but I'm not getting that pop up either. Anyone had this issue or have any advice?
Thanks!

Khris

#1
Welcome :)

You didn't link the function to the event. Open the room and click the thunderbolt icon, then paste "room_AfterFadeIn" without quotes next to the corresponding event.
It's usually done the other way around, as explained here with hotspots: https://adventuregamestudio.github.io/ags-manual/acintro3.html

Crimson Wizard

#2
If you need to do something on each room "enter" event, I recommend using on_event function instead:
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Event.html#on_event

But with BASS template, it needs only 1 cursor mode, so it's more convenient to simply not use a "walk to" mode at all, and use "interact" from the start.

There's a chance that above code may be not enough for you, because a cursor may switch back to "walkto" in some cases, like when deselecting an active inventory item.

Recently I fixed BASS to use Interact mode instead, that solves this problem completely, the latest source code may be found here:
https://github.com/adventuregamestudio/ags-template-source/tree/master/BASS
And template itself here:
https://github.com/adventuregamestudio/ags-templates/tree/master/Templates

If you like to see only the changes, that have to be applied to a script in the existing game:
https://github.com/adventuregamestudio/ags-template-source/commit/587f157c58fae93fa456c2c71fa741de8ac255f4

Jrodan

Oh amazing! @Crimson Wizard your template fixed everything and your solution is going to help my game out a lot.

@Khris I feel so silly about the event function. I've used the events with so many other things and didn't see it there. Still getting my head around AGS.

Thanks again. This is all so helpful.

SMF spam blocked by CleanTalk