UseDefaultGraphic problem. Newbie here.

Started by evenfurtheraway, Fri 02/12/2005 16:38:12

Previous topic - Next topic

evenfurtheraway

I've pored over the FAQs, etc., but can't seem to find out why this wouldn't work.Ã,  I'm just starting, by the way.Ã,  Go easy on me!

All i'm trying to do is limit the cursors to one 'do-it-all' type cursor.Ã,  This I have managed to do effectively, but when the game starts it defaults the wrong cursor.Ã,  Once I right click once, everything is great, I'm just trying to remove the right-click by setting the cursor at its default to the Interact cursor (2).Ã,  I've seen many threads addressing this, but they dont' seem to work for me.Ã,  As this is my first manual script alteration, I'm sure I am omitting something stupid.Ã,  Help?


#sectionstart room_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {

Ã,  // script for Room: First time player enters screen
Ã, 
Mouse.UseDefaultGraphic(eModeInteract);

}


This is an enter room script event.Ã,  I've also tried it in the global script.Ã,  Either way I get the following error message:


"Wrong number of parameters to call to Mouse::DefaultGraphic"


Anyone?

Scummbuddy

you wont want to use one that sets the graphics for it. Even if you were, you were missing telling the engine what graphic you want.

What you want is the old SetMouseCursor, which is now:
----------
Mode property (mouse)
(Formerly known as GetCursorMode, which is now obsolete)
(Formerly known as SetCursorMode, which is now obsolete)

int Mouse.Mode;

Gets/sets the current mode of the mouse cursor. This is one of the cursor modes from your Cursors tab (but with eMode prepended). For example, a cursor mode called "Walk to" on your cursors tab would be eModeWalkto.
Setting this changes both the appearance of the cursor and the Cursor Mode used if the player clicks on a hotspot.

Example:

if (mouse.Mode == eModeWalkto)
{
   // code here
}

will execute the code only if the current cursor mode is MODE 0 (WALK).
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

evenfurtheraway

Thanks, this seems to work, but now I have a new - although related- problem.Ã,  I put the following into my "on_mouse_click" section of the global script.Ã,  Ã, This does what I want, i.e., the mouse is 'locked' into walkto mode, and my global settings have 'don't automatically move character in walk mode' set so it registers a click on an object under the 'any click' interaction.Ã, 

#sectionstart on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(MouseButton button) {
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  if (IsGamePaused() == 1) {
Ã,  Ã,  // Game is paused, so do nothing (ie. don't allow mouse click)
Ã,  }
Ã,  else if (button == eMouseLeft) {
Ã,  Ã,  if (mouse.Mode == eModeWalkto) character[0].Walk (GetViewportX()+mouse.x, GetViewportY()+mouse.y);
Ã,  Ã,  ProcessClick(mouse.x, mouse.y, mouse.Mode );
Ã,  }
Ã,  else {Ã,  Ã, // right-click, so cycle cursor
Ã,  Ã,  mouse.SelectNextMode();
Ã,  }

Like I said, this works, that is, UNTIL I go to a room where the character is hidden (its a close-up of a sign).Ã,  Once i return from a scene where the character is hidden, I have to cycle the mouse cursor, its like it somehow shifts the mouse cursor to another state (perhaps because walkto doesn't exist in a scene with no character visible?Ã,  I'm not sure.)Ã,  Is this what is happening?Ã,  Do I need to reset the cursor to walkto mode upon leaving any scene where the main character is hidden?

Thanks for your help!

Ashen

#3
Quoteit somehow shifts the mouse cursor to another state (perhaps because walkto doesn't exist in a scene with no character visible?  I'm not sure.) Is this what is happening?
Yes, exactly that.

QuoteDo I need to reset the cursor to walkto mode upon leaving any scene where the main character is hidden?
Again, yes. You can either use mouse.Mode = eModeWalkto; in the Player leaves screen interaction, or use a variable to store the mode before you go there, and set it back when you leave. However, if you can ONLY get into those rooms (or if it's just the one room) with walk-to, and can't change modes in there, mouse.Mode = eModeWalkto; is all you need.
I know what you're thinking ... Don't think that.

evenfurtheraway

Great, thank you guys so much.  Works great now.

SMF spam blocked by CleanTalk