Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Revan on Thu 09/02/2006 12:32:40

Title: Displaying name on curser over hotspot
Post by: Revan on Thu 09/02/2006 12:32:40
Hi, was just wondering how you would be able to place the curser over a hotspot or object and make it display a msg under the curser with the name of the object etc. and how to make it so it doesn't pause the gameplay.... thanks
Title: Re: Displaying name on curser over hotspot
Post by: Khris on Thu 09/02/2006 13:03:52
Please search the forums before asking a question that has been answered 1000 times before.
Title: Re: Displaying name on curser over hotspot
Post by: Revan on Thu 09/02/2006 13:39:56
ok i searched the forums and manuel, found out to make a GUI with the lable
@OverHotspot@ , that I have done... I am writing the code for it to be displayed by the curser....

function repeatedly_execute() {
Ã,  // put anything you want to happen every game cycle here
GUI3.SetPosition(mouse.x, mouse.y);
}


allthough it says that is invalid code, and I'm not sure what else to do...

It says expeted semi colon after ] but I have done that havn't I?


EDIT: ok I'm using different code,

function repeatedly_execute() {
Ã,  // put anything you want to happen every game cycle here
Ã,  if (Game.GetLocationName(mouse.x, mouse.y) != "")
Ã,  Ã,  overhotspot.Text = Game.GetLocationName(mouse.x, mouse.y);
Ã,  else overhotspot.Text = " ";
}


It displays what I want but it isn't folowing the mouse around, it's up in the top corner... how do i get it to folloe the mouse (I thought it was in the code that was writen)
Title: Re: Displaying name on curser over hotspot
Post by: strazer on Thu 09/02/2006 14:39:53
Just add some code to place the GUI at the mouse coordinates, it's not that hard:


  overhotspot.OwningGUI.SetPosition(mouse.x, mouse.y);


Make sure to remove the "Clickable" checkbox from the GUI so it doesn't interfere with mouse clicks.

You can also try the OverHot module: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23328.0
Title: Re: Displaying name on curser over hotspot
Post by: Revan on Thu 09/02/2006 15:18:08
ok done Thankyou... Just one little thing;Ã,  if an object is close to the ground how do i make it so the lable shows above the curser (But as a standard for items at cretain coordanates... (It would hapen to hotspots top right aswell...) By the way I'm no coder, at all! lol
Title: Re: Displaying name on curser over hotspot
Post by: strazer on Thu 09/02/2006 15:27:54

  if ((YourGUI.Y + YourGUI.Height) > system.viewport_height)
    YourGUI.Y = system.viewport_height - YourGUI.Height;

  if ((YourGUI.X + YourGUI.Width) > system.viewport_width)
    YourGUI.X = system.viewport_width - YourGUI.Width;


Have you tried the OverHot module?
Title: Re: Displaying name on curser over hotspot
Post by: Revan on Thu 09/02/2006 15:33:15
Quote from: strazer on Thu 09/02/2006 15:27:54
Have you tried the OverHot module?

yeah i downloaded it but it said that string was not used anymore or something... so I didn't use it........

added your latest code but it justs moves all @overhotspot@ gui's to the left of the screen (They moove up and down with the mouse, but stay at the left)
Title: Re: Displaying name on curser over hotspot
Post by: strazer on Thu 09/02/2006 16:39:35
What's your GUI's width?

And are you sure you've used the latest version (1.12) of the OverHot module? I have clarified the announcement post (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23328.0) a bit.
Title: Re: Displaying name on curser over hotspot
Post by: Revan on Thu 09/02/2006 16:51:58
lol no i didnt lol, downloaded it now.... it's good, just 1 thing.... the message displays under my inventory GUI....
Title: Re: Displaying name on curser over hotspot
Post by: strazer on Thu 09/02/2006 18:11:15
Hm, yeah, that's because it uses an overlay and those are covered up by GUIs. But looking at the module's script (menu "Script" -> "Module manager...") should at least give you a few hints.

As for your GUI approach, please post the complete rep_ex script you're using.