Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Swamp Witch on Mon 29/08/2005 03:20:32

Title: Hotspot Cursor
Post by: Swamp Witch on Mon 29/08/2005 03:20:32
I am trying to make the cursor turn to the hand graphic when I run over a hotspot.Ã,  After changing the script, I can't pick up anything from my inventory. In the game start function, I am using this:

mouse.UseModeGraphic(eModePointer);

So that I will have the pointer until I come to a hotspot,

In the repeatedly execute function, I have this:

function repeatedly_execute() {
Ã,  // put anything you want to happen every game cycle here
Ã,  if (GetLocationType(mouse.x,mouse.y) > 0) {
Ã,  Ã,  Ã, mouse.Mode = eModeInteract; }
Ã,  else {
Ã,  Ã,  Ã, mouse.Mode = eModeInteract;
Ã,  Ã,  Ã, mouse.UseModeGraphic(eModePointer); }
}

What did I do wrong?
Title: Re: Hotspot Cursor
Post by: monkey0506 on Mon 29/08/2005 16:47:41
Okay, I'm not sure I understand the problem...it appears from your code that in your game you ONLY use the eModeInteract cursor, but use the eModePointer graphic if the mouse isn't over a hotspot?

This could make things difficult for you...you would have to manually script the walking, the talking, the picking up of inventory items, the looking at of everything, the interaction with inventory items...a lot of things that are built in.  Perhaps you should re-think that a bit, unless you're really sure it's what you want to do.

It looks though like you may just be trying to automatically set the cursor to eModeInteract when you move the mouse over a hotspot, and then restore it when it's not?

Well...I'm confused now. :D
Title: Re: Hotspot Cursor
Post by: Swamp Witch on Tue 30/08/2005 02:34:39
QuoteIt looks though like you may just be trying to automatically set the cursor to eModeInteract when you move the mouse over a hotspot, and then restore it when it's not?

Yes, this is what I am trying to do.Ã,  It is a first person game.
Title: Re: Hotspot Cursor
Post by: Swamp Witch on Tue 30/08/2005 03:12:49
I got it to work like this:

if (GetLocationType(mouse.x,mouse.y) > 0) {
     mouse.UseModeGraphic(eModePointer); }
  else {
     Mouse.UseDefaultGraphic();
}
Title: Re: Hotspot Cursor
Post by: monkey0506 on Tue 30/08/2005 16:16:13
Okay...that would make it look like the pointer cursor...but then what happens if you actually try to interact with it?  Unless you just want to make it look like the pointer, but then use the interaction for the mode the mouse is actually set to (which is actually in a way a good method IMO so that way the user always knows what they can interact with)?
Title: Re: Hotspot Cursor
Post by: Swamp Witch on Wed 31/08/2005 02:53:14
Yes.Ã,  You will always have the "interact hand" until the mouse rolls over a hotspot, which will then turn into the pointer, signifying there is some activity at hand there.  It worked out well.

Different question ....Ã,  Can the statusbar be used for text?Ã,  If there are voice files for the other characters, can I use the statusbar to show the text the character is speaking?
Title: Re: Hotspot Cursor
Post by: strazer on Wed 31/08/2005 03:26:00
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20249

If you really need the text to be displayed on a GUI label, try this (AGS v2.7):


// global script

function SaySpecial(Character *thechar, string message) {
  YourGUILabelName.TextColor = thechar.SpeechColor;
  YourGUILabelName.SetText(message);
  thechar.SayAt(0, 0, 0, message); // say text but hidden (width 0), so voice speech plays
  YourGUILabelName.SetText("");
}



// script header

import function SaySpecial(Character *thechar, string message); // make function useable in room scripts as well



  // some interaction script

  SaySpecial(cSomelady, "&1 Hello sir!");
Title: Re: Hotspot Cursor
Post by: Swamp Witch on Thu 01/09/2005 15:40:33
That worked out real nice.  Thanks Strazer.
Title: Re: Hotspot Cursor
Post by: strazer on Fri 02/09/2005 23:14:14
Cool! You're welcome. :)