Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Davweb on Wed 11/06/2025 07:34:21

Title: Hotspot interaction
Post by: Davweb on Wed 11/06/2025 07:34:21
Hello,
I just resumed creating my game (which I stopped almost a year ago) and have to start all over again, having lost the file.

I'm having a problem with a hotspot. I have a closed door, which is the exit from the room, but this door won't have an opening animation; the character will be able to exit the room if the conditions are met.

But first, I want the player to be able to interact with the door and the Sierra menu words (talk, push, etc.), but it doesn't work.

When I do this:

function htokitchen_AnyClick(Hotspot *theHotspot, CursorMode mode)
{
player.Say("I'm leaving the room");
}

When I click on the door, the player goes to the door and speaks,
but when I do this:

function htokitchen_AnyClick(Hotspot *theHotspot, CursorMode mode)
{
if (Verbs.UsedAction(eGA_LookAt)) {
player.Say("Pretty door");
}
}

Nothing happens, the player doesn't move, no dialogue.

However, if (Verbs.UsedAction(eGA_LookAt)) works because I have an object in the room.

At the hotspot level, I set the function to: Any click hotspot

I also tested it on Interract hotspot but nothing.

Is it possible to do this type of interaction?

Thanks
Title: Re: Hotspot interaction
Post by: Khris on Wed 11/06/2025 11:24:12
It's weird that the player moves in one case and not the other.

Anyway, having the verbs means you're using the Tumbleweed (9-Verb / Lucasarts) Template, not the Sierra one.
In that template, a single left-click runs the WalkTo action code.
Did you try clicking on the "Look At" button first? The template also has an action line which should display something like "walk to door" when you're moving the mouse over the door.
Title: Re: Hotspot interaction
Post by: Davweb on Wed 11/06/2025 14:11:44
Hello,
Yes, I made a mistake, it's indeed the Tumbleweed model.

When I hover, I do see "go to..." and when I set an action on click, it works, but when I select "Look" beforehand, for example (like the code I provided) and hover over the door, I do see "Look...", but when I click, there's no action, and the mouse stays on "Look..."
Title: Re: Hotspot interaction
Post by: Khris on Thu 12/06/2025 14:21:03
That's weird. Let's do basic debugging first:

function htokitchen_AnyClick(Hotspot *theHotspot, CursorMode mode)
{

  Display("htokitchen_AnyClick called, Look is %d", Verbs.UsedAction(eGA_LookAt));

  if (Verbs.UsedAction(eGA_LookAt)) {
    player.Say("Pretty door");
  }
}
Title: Re: Hotspot interaction
Post by: Davweb on Sat 14/06/2025 19:35:36
Thank you.

So, when I click on the door, the hero moves to the door and then there's the message: "htokitchen_AnyClick called, Look is 0"

But when I click on "look", then on the door, nothing. The cursor still displays the text "look door".

I find it strange not being able to interact like with an object.
Title: Re: Hotspot interaction
Post by: Khris on Sun 15/06/2025 10:42:39
When I click on my testing hotspot the message appears right away. Walking to a hotspot in the Tumbleweed template is implemented by calling Verbs.Goto() or Verbs.MovePlayer(x, y) iirc. In other words, the player shouldn't approach the door first.

Plus, the debug message should always appear. If your game doesn't react to looking at the door, something is wrong on a fundamental level.

To clarify, you did start a new game using the Tumbleweed template, right?
And when you check the events pane for the door hotspot, it does say "htokitchen_AnyClick" next to "any click on hotspot"?
Title: Re: Hotspot interaction
Post by: Davweb on Fri 27/06/2025 12:13:34
Hello,
I finally deleted the hotspot (description, action, etc.)

and it works again.

I don't know why it's not working.

Thanks again.
Title: Re: Hotspot interaction
Post by: eri0o on Fri 27/06/2025 12:38:13
What was the description? In the manual about Tumbleweed template it says the descriptions use > character for verb interactions.
Title: Re: Hotspot interaction
Post by: Davweb on Sat 28/06/2025 11:34:08
Can you clarify this for me, because the character > must be included in the description?
Title: Re: Hotspot interaction
Post by: eri0o on Sat 28/06/2025 11:53:00
Here's the manual page about it

https://adventuregamestudio.github.io/ags-manual/Tumbleweed.html

Can't write more right now, but you add each letter at right
Title: Re: Hotspot interaction
Post by: tiredprofuse on Fri 11/07/2025 08:32:34
Quote from: Davweb on Wed 11/06/2025 07:34:21Hello,
I just resumed creating my game (which I stopped almost a year ago) and have to start all over again, having lost the file.

I'm having a problem with a hotspot. I have a closed door, which is the exit from the room, but this door won't have an opening animation; the character will be able to exit the room if the conditions are met.

But first, I want the player to be able to interact with the door and the Sierra menu words (talk, push, etc.), but it doesn't work.

When I do this:

function htokitchen_AnyClick(Hotspot *theHotspot, CursorMode mode)
{
player.Say("I'm leaving the room");
}

When I click on the door, the player goes to the door and speaks,
but when I do this:

function htokitchen_AnyClick(Hotspot *theHotspot, CursorMode mode)
{
if (Verbs.UsedAction(eGA_LookAt)) {
player.Say("Pretty door");
}
}

Nothing happens, the player doesn't move, no dialogue.

However, if (Verbs.UsedAction(eGA_LookAt)) works because I have an object in the room.

At the hotspot level, I set the function to: Any click hotspot

I also tested it on Interract hotspot but nothing.

Is it possible to do this type of interaction?

Thanks
Yes, this type of interaction is definitely possible in AGS. Your code logic looks mostly fine, but the issue might be that Verbs.UsedAction() only works correctly after game.GetVerbAtMouse() or similar functions are handled properly. Also, make sure the Sierra-style verbs are correctly assigned in your template. Try logging the current action to see what's being detected. You could also try checking mouse.Mode == eModeLookat instead to test the action directly.