Getting hotspots/objects mouseover to show text(SOLVED)

Started by proskiier, Sat 10/11/2007 16:51:18

Previous topic - Next topic

Khris

Are you serious...? :)

Look for a textbox labeled "Name:". It's "Full name:" for characters and "Inventory item name:" for inv items.

gypsysnail

Yes I'm serious, I told you I'm pretty crappy with programming at this point and its silly cos I told Ashen a year ago the same thing lol. My 3 jobs took me away from ags for so long, but I'm back. ;).

Ok.... I'm not fully sure what you mean by text box and all that.. where are those?  :-[
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

AGS 2.72:
Hotspots: Go to Room Editor -> Areas, selects Hotspots at the dropdown, look immediately below that.
Objects: Go to Room Editor -> Objects, check the right side beneath the three checkboxes
Characters: Select a character and look above the Normal view button
Inventory items: well, I'm sure you'll find it on your own ;)

gypsysnail

Yup thats easy!! I can do that lol. Thanks for that. That was all the guidance I needed ;) I'm getting there :P.

EDIT:
Ok... I have done what you told me to do and yes the name... but... when I test the game nothing happens. Whats going wrong do you know?

EDIT by Ashen: To remove ANOTHER double post.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

Some basic troubleshooting:
In the GUI Editor, select the GUI and set its border color to 15.
Now test the game. Can you see the border?
If not, make sure that the GUI's visible property is set to normal.

If you can see the border but there's still no text, change the label's text from "@OVERHOTSPOT@" to e.g. "Test".
Test the game. Can you see the word "Test" displayed next to your mouse?

gypsysnail

Ok I have tried all that, no still does not work at all. I know one thing, the game (when I test game) starts off in replay mode (and I have no idea how to turn this off) so I press ESC and it stops the replay so I can control the game myself. I had been doing a replay for an exhibition to automatically make the game character etc move and do things automatically as it was to be displayed on the wall out in the city. Now I dont know how to stop or get rid of this replay.....? Maybe this replay causes the problem with the text on hotspots not showing at all?
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

To get rid of the replay, start winsetup, click the Advanced button and select "Don't run a replay", then click "Save and run".

So you can't see the border, you can't see any text?
In the GUI editor, what does the GUI look like? I assume it's a white rectangle on a pink background, right?

gypsysnail

#27
Yep thats exactly it, a white border with a pink background which means transparent. Ok the text is "test" at the moment, still no show. Thanks re the replay.

EDIT: Sorry I have tried and tried to find winsetup and I have no idea where it is anymore. I used to be able to know all this but it seems to have changed. Even my father who is an IT expert doesnt even know this one OMG
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

Save the game, then open the game's Compiled folder.

path_to_AGS/GameName/Compiled/winsetup.exe

So the GUI doesn't show at all? You seem to have added a lot of custom code to your game, probably from forum posts from a year ago. Maybe it screws with the GUI, although that's unlikely.

Did you check the GUI's visibility property? Is it set to "Normal"?
Another thing you could try is to add the following lines to the OverHot-code in rep_ex:
Code: ags
  //*****OverHot code start
  int c=System.ViewportWidth-gOverhot.Width;
  int x=mouse.x+XOFFSET; if (x<0) x=0; if (x>c) x=c;
  c=System.ViewportHeight-gOverhot.Height;
  int y=mouse.y+YOFFSET; if (y<0) y=0; if (y>c) y=c;
  gOverhot.SetPosition(x, y);
  gOverhot.Visible=true;                       <-- add this
  gOverhot.Transparency=0;             <-- and this
  //*****end

gypsysnail

#29
Lol you wont believe this!!!! I just turned off the replay and the test text showed up with the border completely!!! It stays next to the mouse pointer all the time tho, so thats something accomplished. I had a feeling the replay was holding back the text over hotspot gui. Ok next step is to tweak the whole thing... I'm guessing changing border back to 0 from 15 and the text back to @OVERHOTSPOT@?

EDIT:
BINGO!!! Its working now!!!!!! Thank you KrisMUC for your great help! As always this forum is a good friend ;)
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

Great, and good job pinning the cause for the trouble on the replay!

Since everything's working now, we can add a little spice:

Code: ags
  //*****OverHot code start
  String ohs="";
  int ohmx=mouse.x; int ohmy=mouse.y;
  if (GetLocationType(ohmx, ohmy)!=eLocationNothing)
    ohs=ohs.Append(Game.GetLocationName(ohmx, ohmy));
  GUIControl*ohgc=gOverhot.Controls[0];
  Label*ohl=ohgc.AsLabel;
  int ohtw=GetTextWidth(ohs, ohl.Font);
  ohl.Width=ohtw+3;
  gOverhot.Width=ohtw+6;
  int c=System.ViewportWidth-gOverhot.Width;
  ohmx+=3; if (ohmx<0) ohmx=0; if (ohmx>c) ohmx=c;
  c=System.ViewportHeight-gOverhot.Height;
  ohmy+=3; if (ohmy<0) ohmy=0; if (ohmy>c) ohmy=c;
  gOverhot.SetPosition(ohmx, ohmy);
  //*****end


This should allow the GUI to move further to the right if the hotspot's text is shorter.

Edit: yup, sorry, missed one x. Code is corrected.

gypsysnail

Ok great... where will I put this. I have tried to put it where the existing code for this function is.... but maybe I have to replace some of that code with this one?... also how will I stop the characters name from being shown when mouse pointed over her? I know she must have her name in the field in the characters editor of ags.... ?
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

Replace ALL the existing code with the new lot. Everything currently between //*****OverHot code start and //*****end in your repeatedly_execute function, should be replaced with everything between //*****OverHot code start and //*****end in Khris' last post. Really shouldn't be that hard to follow...

Quote
also how will I stop the characters name from being shown when mouse pointed over her? I know she must have her name in the field in the characters editor of ags.... ?
Which character? The player character, some other character, or just all characters in general? To not have ANY character's name appear, but still let them have names, will take a fair bit of work - fortunately, I don't think that's what you want. To have the player character's name not show up, go to the 'Characters' pane of the editor, and un-check the 'Clickable' box. The mouse now won't register when it's over the player character - which also means you can't have any interactions for them (Look at, Use Inventory on, etc). (Works for any character, not just the player.)
I know what you're thinking ... Don't think that.

gypsysnail

Hi Ashen, thanks for joining :) umm ok well I have done that and I got an error message:

Line 28: "Undefined symbol x" which I've pasted below:
ohmx+=3; if (x<0) ohmx=0; if (ohmx>c) ohmx=c;

Now my inability to understand programming fully probably contributes to this and I am assuming I have to change the x into a number......?

And yes sorry its not so easy for me to follow, I have virtually no experience or qualifications in programming so be patient with me please ;)
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

Try changing it to ohmx, as used in the rest of that line. It looks like Khris didn't fully update the code when he wrote the new version (often happens to me when I'm writing off the top of my head, and not in AGS). So:
Code: ags

ohmx+=3; if (ohmx<0) ohmx=0; if (ohmx>c) ohmx=c;
I know what you're thinking ... Don't think that.

gypsysnail

All done! Thank you. Yes know what you mean, very hard to keep track when thinking off head, I must say you guys are talented! :) Wish I could script just like that! But I'll learn, probably never be as good as you ;). Thank you again. Am very pleased its all solved.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

SMF spam blocked by CleanTalk