Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ted Anderson on Thu 20/01/2011 03:15:40

Title: Hotspots look different to different verbs?
Post by: Ted Anderson on Thu 20/01/2011 03:15:40
And yet another dumb beginner question! I'm going for the record.

Is it possible to give a hotspot different names depending on which verb the player is using? I've got a standard LucasArts 9-verb setup--'Look at', 'Pick up', 'Talk to', etc. Say there's an anomalous object on the floor. Player chooses the 'Talk to' verb, the word line says, for example, "Talk to seashell." Player chooses 'Push', it says, "Push surge protector." Player chooses 'Look at', it says, "Look at peg leg." I'm not talking about changing an object by interacting with it; I'm talking about the object showing up as something different depending on what verb you've got "active."

Thoughts?
Title: Re: Hotspots look different to different verbs?
Post by: Ryan Timothy B on Thu 20/01/2011 03:34:05
I can't give an exact answer due to not knowing fully what you're asking for or how you grab your hotspot name. Whether you're using a label with @OVERHOTSPOT@ or you're manually grabbing the hotspot name through the global script by using Game.GetLocationName(mouse.x, mouse.y), which is essentially the same thing but more hands on.

Also I'm assuming this hotspot is one room only.

Anyway, we'll assume you have this in the global script rep ex:

lHotspotLabel.Text = Game.GetLocationName(mouse.x, mouse.y);


A rooms rep ex will run after the global script rep ex (I know this thanks to Monkey (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=42404.msg562936#msg562936))
You'll need something like this in the rep ex for the room script:

if (GetLocationType(mouse.x, mouse.y) == eLocationObject && Object.GetAtScreenXY(mouse.x,  mouse.y) == oSeashell)
{
  if (Verb == eModePickup) lHotspotLabel.Text = "Peg Leg";
    else if (Verb == eModeLookat) lHotspotLabel.Text = "Twiddle Sticks";
}


Something along those lines. But like I said, this is how I'd do it if it were for one room only. If it were for multiple rooms, I may just put it in the global script.

And if every object in the game is doing this name swap, I'd probably just use the Properties schema editor for each hotspot/object/character and make a string for each verb.
Title: Re: Hotspots look different to different verbs?
Post by: Khris on Thu 20/01/2011 03:44:57
Afaik, Ted Anderson is using the 9-verb-GUI.

The bad thing is, it's not possible to change the names of Hotspots or Objects at runtime.
So if this is intended for multiple objects, like Ryan says, you should use Custom properties. These are static values, e.g. numbers or strings of text that you can assign to every game object and read during the game.
One example would be an age property assigned to every character.

What you'd do is create a boolean property with a default value of false. This is set to true for every object that's going to change their name depending on the verb.
Then you'd add a few text properties, one for each verb, holding the alternative name.

A few additional lines to the function that updates the status bar (TranslateAction()), and you are set.

So, multiple objects in multiple rooms?
And, are the alternative names going to be static or subject to change?
Title: Re: Hotspots look different to different verbs?
Post by: Ted Anderson on Sat 22/01/2011 00:02:35
As I'm currently thinking, it would only come up in a single room at one point in the game, with a single object. That should simplify things, I assume?
Title: Re: Hotspots look different to different verbs?
Post by: Khris on Sat 22/01/2011 17:56:56
Yes, greatly.
In the TranslateAction function, at the end, just put something like this:

  if (player.Room == 4 && act_object == "chair") {
    if (action == eGA_Open)     tresult = "Open seashell";
    ...
  }