Hotspot interaction

Started by Davweb, Wed 11/06/2025 07:34:21

Previous topic - Next topic

Davweb

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

Khris

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.

Davweb

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..."

Khris

That's weird. Let's do basic debugging first:

Code: ags
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");
  }
}

SMF spam blocked by CleanTalk