How to script double-click to instant transport to different room?

Started by TonyD, Sun 19/11/2023 03:45:11

Previous topic - Next topic

TonyD

Hi,

I'm using AGS 3.6.0 (latest patch), BASS, and Double Click V 1.0 module.

I'm trying to figure out how to script an immediate (or at least as close as one can get) change room when I double click on either a hotspot or an edge.

Seen this done in a few modern games using the engine, but for the life of me unable to figure it out and not been able find any posts on how to programme it with my configuration.

Any help is tremendously appreciated.

Crimson Wizard

Please tell, which exactly part of the above you are stuck with, is that using the double click module, or scripting interaction with a hotspot, or instant change room?


EDIT:
I suppose that the problem here is that AGS hotspots do not provide "on double click event" kind of interaction by default which you could run.
But AGS supports custom "verbs". This is not very obvious, but they may be added by editing existing "Cursor modes", starting with ones called "usermode1" and "usermode2".

I guess this may be done like:
1. Choose one Cursor mode and rename it to "DoubleClk" or else what you think is appropriate.
2. Now for every hotspot that would support double click you may create a event function for this custom event "DoubleClk".
3. When using Double click you determine whether there's a hotspot under mouse, and run "double click" event it:

Code: ags
function on_mouse_click(MouseButton mb)
{
    if (mb = eMouseLeft)
    {
        if (DoubleClick.Event[eMouseLeft])
        {
             LocationType loc = GetLocationType(mouse.x, mouse.y);
             if (loc == eLocationHotspot)
             {
                  Hotspot *h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
                  h.RunInteraction(eModeDoubleClk);
             }
        }
    }
}

SMF spam blocked by CleanTalk