A little confused with hotspot Name and Description in V3.01

Started by riseryn, Mon 21/04/2008 12:02:28

Previous topic - Next topic

riseryn

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)?

Khris

What are you trying to do?
You can access a room's hotspots by using the array:   hotspot

riseryn

I would like to trigger an interaction  considering the hotspotname

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


monkey0506

You should be able to do it like this:

Code: ags
Hotspot *hat = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (hat != hotspot[0]) {
  if (hat.Name.Substring(0, 7) == "hsortie") {
    // action here
  }
}

Khris

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.

riseryn

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?

Khris

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.

miguel

Hi, I had a similar problem a while ago, I use this:

Code: ags
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
Working on a RON game!!!!!

SMF spam blocked by CleanTalk