Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: dude_r005 on Tue 21/11/2006 16:56:47

Title: mouse over hotspot problem
Post by: dude_r005 on Tue 21/11/2006 16:56:47
hey folks, I was searching the forum for a little porblem I have.
I want to change the cursor while it is ON the hotspot.

I used this code

// script for hotspot1: Mouse moves over hotspot

SaveCursorForLocationChange();
SetMouseCursor(10);

but it just works sporadicly. sometimes I really have to move around on the hotspot until the cursor changes and sometimes it doesn't change at all.

I thought maybe the "Mouse moves over hotspot" is not precise enough.
is there another way, to do this?
Title: Re: mouse over hotspot problem
Post by: Khris on Tue 21/11/2006 23:34:14
1. This is really more of a beginner's question
2. you'd have a really long beard after adding this code to every single hotspot
3. these seem to be custom functions, how are we supposed to help you if we can't see the actual code that's executed?
4. Check the end of this thread for a solution: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=29123.0
Title: Re: mouse over hotspot problem
Post by: dude_r005 on Wed 22/11/2006 15:07:59
I really want to add this effect only to a few hotspots. These are special hotspots and the cursor should change to a very rare used graphic. I wouldn't even know, what code to post. As I said, the code above does what I want, but it seems to be not exactly the right way, since the new cursor isn't functioning  too well. but thanx for the reply. I'll check if I can use some of the code U mentioned
Title: Re: mouse over hotspot problem
Post by: Khris on Wed 22/11/2006 23:12:04
Yeah, sorry, I didn't realize that these are actual script commands of 2.62 and before.
It's simply been to long since I've been using them.
Title: Re: mouse over hotspot problem
Post by: Janik on Thu 23/11/2006 02:08:33
Perhaps you should use repeatedly_execute, and check if the mouse is over the hotspot, and change the cursor accordingly?
Title: Re: mouse over hotspot problem
Post by: dude_r005 on Thu 23/11/2006 02:43:12
The hotspots are in different places and different rooms.
Wouldn't checking mouse-coordinates cause problems then?
I guess U meant something like this, right?

//function repeatedly_execute

if (((mouse.y > 100) && (mouse.y<120)) && ((mouse.x > 70) && (mouse.x<90))) {Ã,  SaveCursorForLocationChange();
SetMouseCursor(10);
}

that couldn't be adjusted to different rooms.
I'm not sure if I understood U right and if this code is even functional.
could you post your idea for a code?Ã,  ???
greez dude

ok, forget what I wrote above!

you were right.
room-->room interactions--> repeatedly execute-->


if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hkitty){Ã,  Ã,  //my hotspot is named "kitty"
Ã,  mouse.SaveCursorUntilItLeaves();
Ã,  mouse.Mode = eModeklo;}Ã,  Ã, // change to your special cursor-mode
Title: Re: mouse over hotspot problem
Post by: Khris on Thu 23/11/2006 03:22:29
Try this:
// repeatedly_execute
  int lt=GetLocationType(mouse.x,mouse.y);

  if (lt==eLocationHotspot) {
    Hotspot*h;
    h=Hotspot.GetAtScreenXY(mouse.x, mouse.y);
   
    if (player.Room==1 && h==hotspot[1]) {   // adjust to fit room and hotspot
      mouse.Mode=eModeUser1;          // adjust to fit special cursor mode
    }
  }
  else mouse.Mode=eModeWalkto;

This code won't work with AGS 2.62, not sure about 2.7(1).