Hotspot Cursor

Started by Swamp Witch, Mon 29/08/2005 03:20:32

Previous topic - Next topic

Swamp Witch

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?

monkey0506

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

Swamp Witch

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.

Swamp Witch

I got it to work like this:

if (GetLocationType(mouse.x,mouse.y) > 0) {
     mouse.UseModeGraphic(eModePointer); }
  else {
     Mouse.UseDefaultGraphic();
}

monkey0506

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)?

Swamp Witch

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?

strazer

#6
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):

Code: ags

// 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("");
}


Code: ags

// script header

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


Code: ags

  // some interaction script

  SaySpecial(cSomelady, "&1 Hello sir!");

Swamp Witch

That worked out real nice.  Thanks Strazer.

strazer

Cool! You're welcome. :)

SMF spam blocked by CleanTalk