mouse over hotspot problem

Started by dude_r005, Tue 21/11/2006 16:56:47

Previous topic - Next topic

dude_r005

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?

Khris

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

dude_r005

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

Khris

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.

Janik

Perhaps you should use repeatedly_execute, and check if the mouse is over the hotspot, and change the cursor accordingly?
Play pen and paper D&D? Then try DM Genie - software for Dungeons and Dragons!

dude_r005

#5
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?

Code: ags
//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-->

Code: ags

if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hkitty){Ã,  Ã,  //my hotspot is named "kitty"
Ã,  mouse.SaveCursorUntilItLeaves();
Ã,  mouse.Mode = eModeklo;}Ã,  Ã, // change to your special cursor-mode

Khris

Try this:
Code: ags
// 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).

SMF spam blocked by CleanTalk