MouseOver cursor changes

Started by James Kay, Tue 16/12/2003 11:51:05

Previous topic - Next topic

James Kay

This is probably a terribly n00b question but please help!

I want the old Sam&Max style mouse cursor change over hotspots because I'm not using text labels. E.g. a closed eye when hovering over nothing, an open eye when hovering over a "look at"-able object.
I've made animated cursors that "animate using view X only when over objects or hotspots". The view is one single graphic of the "open" state while the cursor graphic itself is the closed state.
This all works hunky dory except for TALK. I want to exclude inanimate objects and hotspots from talk and only have the "you are able to talk" cursor change when hovering over a character (and even then not all of them).
Please tell me there is an easy fix for this.

I'm thinking of creating a Global Script function and then adding a "check for cursor change" call function. So every character would have a "repeatedly exceute" type function that calls the global script that then checks which cursor change to make if any. How would I go about doing this?
Or am I talking out of my arse?



EDIT:
I found this script:

GetLocationName(mouse.x, mouse.y, name); // Get the name of what's under the cursor

if (StrComp(name,"")==0) SetDefaultCursor(); // if blank ( or hotspot with no name
                                            //'used for CHAR STANDS ON HOTSPOT') do nothing
else {
     //if (GetCursorMode()==0) { //if cursor is WALK
         //if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(5); // change cursor to CHANGED WALK
         //else SetDefaultCursor(); } // change back to WALK
     if (GetCursorMode()==1) { // if cursor is LOOK
         if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(8); // change cursor to CHANGED LOOK
         else SetDefaultCursor(); } // change back to LOOK
     if (GetCursorMode()==2) { // if cursor is USE
         if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(9); // change to CHANGED USE
         else SetDefaultCursor(); } // change back to USE
     if (GetCursorMode()==3) { // if cursor is TALK
         if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(10); // Change to CHANGED TALK
         else SetDefaultCursor(); } // change back to TALK
   }

But get an error as it doesn't know what "name" is. Any help?

SSH

That looks like the one that comes from here:

http://atticwindow.adventuredevelopers.com/tutorials.php?id=2

and you're right, actually: there should be a

string name;

declaration somewhere for that to work. To get it to only chnage the talk over a character, try  changing the last bit to:

if (GetCursorMode()==3) { // if cursor is TALK
if (GetLocationType(mouse.x,mouse.y)==2) SetMouseCursor(10); // Change to CHANGED TALK
else SetDefaultCursor(); } // change back to TALK
}
12

James Kay

It was linked to http://members.tripod.com/atticwindow/gac/tutorials.htm, but from where I don't remember.

It works a treat now, by the way! Thanks!

By the way, is there an easy way to exempt objects or hotspots from this equation? E.g. I have a few objects that are incidental anims. I would like to add something to their script to disable this mouseoverf function. Is that possible?

SSH

Well, you can use the GetObjectAt(mouse.x,mouse.y) function to find the object number and simply check for your object numbers, but that might vary from room to room so probably the better way is to set up a boolean Property on the objects that default to false (call the property "NoCursorChange") then inside the existing code for the object section..

if (GetObjectProperty(GetObjectAt(mouse.x,mouse.y), "NoCursorChange") {
  // do dursor change stuff
}
12

James Kay

Thanks for your help SSH, it all works wonderful now.

But what about inventory items in my inventory? Can I easily add that to the Global Script or should I hand-script these for each inventory item? (specifically LOOK and TAKE cursors - the others don't apply, obviously).

Scorpiorus

#5
Do you mean:

global_repeatedly:

int item = GetInvAt (mouse.x, mouse.y);
if (item > -1) { //if the cursor is over an inv item

if (GetCursorMode() == MODE_USE && GetInvProperty(item, "NoCursorChangeOnUse")==0) SetMouseCursor(...);
else if (GetCursorMode() == MODE_LOOK && GetInvProperty(item, "NoCursorChangeOnLook")==0) SetMouseCursor(...);
else SetDefaultCursor();


}


SMF spam blocked by CleanTalk