Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: riseryn on Mon 21/04/2008 12:02:28

Title: A little confused with hotspot Name and Description in V3.01
Post by: riseryn on Mon 21/04/2008 12:02:28
Hi
using V3.01 it seems that Hotspot.Name refers to Description in the editor.
How to get the value of Name in the editor by script, i mean the internal name of the hotspot (hHotspot)?
Title: Re: A little confused with hotspot Name and Description in V3.01
Post by: Khris on Mon 21/04/2008 19:22:50
What are you trying to do?
You can access a room's hotspots by using the array:   hotspot
Title: Re: A little confused with hotspot Name and Description in V3.01
Post by: riseryn on Mon 21/04/2008 23:30:06
I would like to trigger an interaction  considering the hotspotname

pseudo code below
if hotspot.substring == hsortie -> action

Title: Re: A little confused with hotspot Name and Description in V3.01
Post by: monkey0506 on Tue 22/04/2008 02:43:05
You should be able to do it like this:

Hotspot *hat = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (hat != hotspot[0]) {
  if (hat.Name.Substring(0, 7) == "hsortie") {
    // action here
  }
}
Title: Re: A little confused with hotspot Name and Description in V3.01
Post by: Khris on Tue 22/04/2008 09:27:29
I think the scriptname is hSortie (sortie = exit).

riseryn, *do* you want to know the hotspot under the mouse?
If you don't, all you need to do is to select the hotspot, click the flash icon, click the interaction in the list, click the ...-button, then put code into the generated function.
Title: Re: A little confused with hotspot Name and Description in V3.01
Post by: riseryn on Tue 22/04/2008 17:17:14
Yes i want to know the hotspot under the mouse.
I intend to have hotspot with no description but internal name to trigger some different interaction when mouse over.

The problem is that script hotspot.name refer to the description and not to the script name.

Having a field Decription that you acces by name and a fiel name that you acces by (apparently) nothing in the editor is somehow confusing.
at least to me.

Im not sure im clear  ;D
do you understand what i want to realize and where is my problem?
Title: Re: A little confused with hotspot Name and Description in V3.01
Post by: Khris on Wed 23/04/2008 01:42:33
What you really want is to *compare* the hotspot under the mouse to a certain hotspot in your room, if I understand you correctly.
monkey showed you how this is done; add a check for player.Room and you're done.

Just to make this clear: you seem to want a field that returns the hotspot itself. Which is obviously unnecessary, since you'd have to write "hSortie.scriptname" which would be nothing else than "hSortie" itself.
Title: Re: A little confused with hotspot Name and Description in V3.01
Post by: miguel on Wed 23/04/2008 10:53:39
Hi, I had a similar problem a while ago, I use this:

if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hotspot[3]) && (cEgo.Room==10)){
  ////code here
  //// in my game I open a gui that returns @OVERHOTSPOT@ and some buttons(actions)
}


I hope it is what you need but Khris and Monkey can help you better than me