Keep overhotspot name during a click? [SOLVED]

Started by , Wed 12/07/2017 15:09:03

Previous topic - Next topic

m0ds

Hi Khris, and other helpers. I'm not too sure what to search on this, and it's only a small personal aesthetic issue really I suppose, but in game when I hover mouse over something it might say "use tree". When I click it reverts to just "use" but I'd much prefer it to continue to say "use tree" whilst the character does this action. It seems like something from mouse click script, that instantly clears the overhotspot text as soon as it's activated, but I'm not too sure I'm looking at it the right way. Is there a simple method to keep that text up whilst the action that relates to it (eg. using the tree) occurs rather than the default wipe immediately on (left) click (in this instance)? Thank you!

Cassiebsg

You can create a String to store that info when you click on it, then get the lbloverhotspot to show it.
Once you finished just return it to use @overhotspot@ again?

I did this on my game to keep the name of the hotspot visible when I open the verbcoin.

There are those who believe that life here began out there...

Khris

Similarly to what Cassie suggests, the 9verb template achieves this by manually setting a string to the entire action, i.e. "use tree" and only resetting it in repeatedly_execute, which isn't called until the blocking interaction has finished.

However I'm wondering why a left-click would remove the noun immediately; even when using @OVERHOTSPOT@, that shouldn't happen.

How are you composing and displaying the text?

m0ds

#3
That's right, the verb is (sort of inexplicably) removed on click. I've checked some other projects and it seems to happen in them too. The label text is using @overhotspot@. "ProcessClick" is hard-coded but I'm assuming it's that command that for some reason wipes the verb prematurely?

Label1 is set to "@OVERHOTSPOT@" and the code in rep exec always is:

Code: ags


  if (mouse.Mode == eModeInteract) {
  Label1.Text = "Use @OVERHOTSPOT@";
    } else
  if (mouse.Mode == eModeLookat) {
  Label1.Text = "Look at @OVERHOTSPOT@";
  
  } else
  if (mouse.Mode == eModeTalkto) {
  Label1.Text = "Talk to @OVERHOTSPOT@";
  
  } else
  if (mouse.Mode == eModeWalkto) {
  Label1.Text = "Walk to @OVERHOTSPOT@";
  
  }
  if (mouse.Mode == eModeUseinv) {
    //Label1.Text = "Use x with @OVERHOTSPOT@";
    Label1.Text = String.Format("Use %s with @OVERHOTSPOT@", player.ActiveInventory.Name);
  }


And that's the only place in entire code where Label1 is told to do something, so I have no idea what's affecting it, but it looks incredibly tacky that it can't hold the sentence "Look at tree" during the action :( I've moved it to rep exec only in a bid for it to get blocked but it still does it.

Even though the mouse is still hovering over a hotspot, it clears. It's just that it's in a blocking script like some dialogue or animation etc. I can't figure it out.

side note
Spoiler

It seems that the process of walking to and object (ie the tree you want to look at, with a walk to co-ordinate) is blocking, but anything else is not. My click of the mouse executes whatever's in that script command during the character reading lines/doing normal stuff of the interaction etc. Point is, I can't seem to get it to hold off wiping the @overhotspot@ verb no matter what I try, blocking or not, in the "mouse click" function or in the normal functions.
[close]

What's the String method please? It sounds useful Cassie but I don't really understand how to execute that (I tried and failed). It sounds like it might be a way of avoiding using @overhotspot@ completely?

Cassiebsg

That's weird, I would have guessed that somewhere in the code, there should be a Label1.Text ="@OVERHOTSPOT@", to revert it to the "no-action" shown. (wtf)

Anyway, here's my code:
Code: ags

function show_VerbCoin()
{
	if (gVerbCoin.Visible) close_VerbCoin();
	else
	{
		clicked_x = mouse.x;
		clicked_y = mouse.y;
		String text = Game.GetLocationName(clicked_x, clicked_y);
		if (text!=null) 
		{
			lbloverhotspot.Text=text;
		}
/// Other code non-relevant here
        }
}

function close_VerbCoin()
{
	game.inv_activated=0;
	lbloverhotspot.Text="@overhotspot@";
	gVerbCoin.Visible=false;	
}
There are those who believe that life here began out there...

m0ds

#5
Thanks cassie! I couldn't make that work specifically, but your code gave me a way of looking at displaying "OVERHOTSPOT" differently. So I've modified my code from

Label1.Text = "Use @OVERHOTSPOT@";

to

Label1.Text = String.Format("Use %s", Game.GetLocationName(mouse.x, mouse.y));

and moved it from execute_always to just execute, and now it's working as intended :) From what I can tell, it's @OVERHOTSPOT@ causing the problem. Seems to work fine if calling it under String.Format as an %s though. No idea why @OVERHOTSPOT@ is borked, but it always clears the hotspot name and defaults to only the words written (ie Use) from the line still demanding it display @OVERHOTSPOT@, when the cursor is still clearly over that hotspot (something Game.GetLocationName seems to be able to determine properly, overhotspot seems not to be able to). That said, I realize @OVERHOTSPOT@ is effectively ancient history when it comes to commands in AGS...maybe conflicting with "new style strings" settings checked or sth. Anyway, I'm probably better without it ;) Thanks for your help and Khris!

SMF spam blocked by CleanTalk