Code script when mouse is over hotspot

Started by Nyrhinen, Mon 16/02/2004 16:27:42

Previous topic - Next topic

Nyrhinen

Hey guys! Can you help me with my game. I want to know how i can get a text when mouse goes over a hotspot. Can you tell!?!  :-\

Akumayo

After you have drawn your hotspot.  Click on interactions.  Then select "mouse moves over hotspot".  Click on the down arrow to open the menu.  Select "Game-Display a Message" Click "Change", then enter the message number. Click "Edit Message", and there type in the message text. Click "Okay", then "Close".  Now when you move the mouse over the hotspot it will say "(whatever you told it to)".  


"Power is not a means - it is an end."

Kweepa

#2
I presume he wanted to know how to write the name of the hotspot next to the mouse pointer or in a status line.
There are a bunch of threads like this - try a search.

Put this in repeatedly execute:
string name;
GetLocationName(mouse.x, mouse.y, name);
SetLabelText(STATUSLINE, 0, name);
Still waiting for Purity of the Surf II

Ben

#3
Why doesn't anyone ever do anything the easy way?  :P

Just create a new GUI and add a label, then enter @OVERHOTSPOT@ for the text.

Kweepa

And then you want to position the text...
And then you want to add "Walk to", "Talk to"...
:)
Still waiting for Purity of the Surf II

SSH

#5
I know this works becuase its what is in my game...

You'll need a GUI called TOOLTIP with object 0 a text label...

int ttt; // tooltip transparency
string oldloc;

function repeatedly_execute() {

 // Set tooltip
 string locname;
 GetLocationName(mouse.x, mouse.y, locname);
 if (StrLen(locname)==0) {
   int invat=GetInvAt(mouse.x, mouse.y);
   if (invat>0) GetInvName(invat, locname);
 }

 if (StrComp(locname, oldloc)==0) {
   if (ttt>0) ttt--;
 } else {
   ttt=200;
 }  
 StrCopy(oldloc, locname);
 
 if ((ttt>100) || StrLen(locname)==0) {
   GUIOff(TOOLTIP);
 } else {
   int ttx,tty;
   ttx=mouse.x+10;
   tty=mouse.y-10;
   GUIOn(TOOLTIP);
   if (mouse.y<50) {
     tty=mouse.y+10;
   }
   if (mouse.x>260) {
     ttx=mouse.x-30;
   }
   SetGUIPosition(TOOLTIP, ttx, tty);
   SetLabelText(TOOLTIP, 0, locname);
   SetGUITransparency(TOOLTIP,ttt);
 }



hmmm, needs some more comments!
12

Nyrhinen


SMF spam blocked by CleanTalk