Contents Up Previous Next

Mouse functions

ChangeCursorGraphic
ChangeCursorHotspot
DisableCursorMode
EnableCursorMode
GetCursorMode
HideMouseCursor
RefreshMouse
SetCursorMode
SetDefaultCursor
SetMouseBounds
SetMouseCursor
SetMousePosition
SetNextCursorMode
ShowMouseCursor


ChangeCursorGraphic

ChangeCursorGraphic (int mode, int slot)
Changes mouse cursor mode MODE's cursor graphic to SLOT. This permenantely changes the specified mode's cursor graphic. This function may be useful if you need more than the maximum number of mouse cursors.

Example:

ChangeCursorGraphic (MODE_LOOK, 120);
will change the cursor’s graphic for look mode to the image that's imported in the sprite’s manager slot 120.

See Also: ChangeCursorHotspot, SetCursorMode


ChangeCursorHotspot

ChangeCursorHotspot (int mode, int x, int y)
Permanently changes mouse cursor MODE's hotspot on the cursor graphic to (X,Y). This is the offset into the graphic where the click takes effect. (0,0) is the upper left corner of the cursor graphic.

Example:

ChangeCursorHotspot(MODE_WALK,10,10);
will change the cursor’s hotspot for walk mode to coordinates 10,10.

See Also: ChangeCursorGraphic


DisableCursorMode

DisableCursorMode (int mode)
Disables the mouse cursor MODE. Any attempts to set the cursor to this mode while it is disabled (like using SetMouseCursor) will fail. This function also greys out and disables any interface buttons whose left-click command is set as "Set mode X", where X is equal to MODE.

If the current cursor mode is MODE, then the engine will change it to the next enabled standard cursor.

Example:

DisableCursorMode(MODE_WALK);
will make unaivalable the walk mode until it’s enabled again. See Also: EnableCursorMode


EnableCursorMode

EnableCursorMode (int mode)
Re-enables the mouse cursor mode MODE. This function also enables any interface buttons which were disabled by the DisableCursorMode command.

Example:

EnableCursorMode(MODE_WALK);
will enable cursor mode walk which was disabled before.

See Also: DisableCursorMode


GetCursorMode

GetCursorMode()
Returns the value of the current mode of the cursor. This is either MODE_LOOK, MODE_USE, MODE_TALK or any custom modes you have created.

Example:

if (GetCursorMode() == MODE_WALK)
   { code here }
will execute the code only if the current cursor mode is MODE 0 (WALK).

See Also: SetCursorMode


HideMouseCursor

HideMouseCursor()
Removes the mouse cursor from the screen and makes it invisible. This is useful for briefly hiding the cursor on occasions when you don't want it around.

If you want the Lucasarts-style where the mouse cursor is never visible during cutscenes then a much easier solution is simply to import a transparent graphic over the default wait cursor, so that the Wait cursor becomes invisible.

See Also: SetMouseCursor, ShowMouseCursor


RefreshMouse

RefreshMouse ()
Updates the global variables "mouse.x" and "mouse.y" with the current position of the mouse. Normally, these variables are set just before each script function is executed. However, if you have a very long script where the mouse may have moved since the start of the function, and you need the exact current location, then RefreshMouse will update the variables.


SetCursorMode

SetCursorMode(int new_mode)
Changes the mouse cursor mode to NEW_MODE. The number you pass can be obtained from the CURSORS tab of the Room Editor. This function changes both the appearance of the cursor and the mode used if the player clicks on a hotspot.

Example:

SetCursorMode(MODE_USE);
will change the cursor mode to USE MODE.

See Also: GetCursorMode, SetMouseCursor, SetNextCursorMode


SetDefaultCursor

SetDefaultCursor()
Changes the appearance of the mouse cursor to the default for the current cursor mode. Use this to restore the cursor picture after you changed it with the SetMouseCursor function.


SetMouseBounds

SetMouseBounds(int left, int top, int right, int bottom)
Restricts the area where the mouse can move on screen. The four parameters are the relevant pixel co-ordinates of that edge of the bounding rectangle. They are in the usual range (0,0) - (320,200).

You can pass (0,0,0,0) to disable the bounding rectangle and allow the mouse to move everywhere, as usual.

NOTE: The effect of this function only lasts until the player leaves the screen, at which point the cursor bounds will be reset.

Example:

SetMouseBounds(160, 100, 320, 200);
will restrict the mouse cursor to the bottom-right quarter of the screen.

See Also: SetMousePosition


SetMouseCursor

SetMouseCursor(int new_cursor)
Changes the appearance of the mouse cursor to NEW_CURSOR. Unlike the SetCursorMode function (see above), this does not change the mode used if the user clicks on a hotspot. This is useful for displaying a "wait" cursor temporarily.

Example:

SetMouseCursor(8);
will change the mouse cursor to the cursor number 8 specified in the cursor’s tab .

See Also: ChangeCursorGraphic, SetCursorMode, SetDefaultCursor


SetMousePosition

SetMousePosition(int x, int y)
Moves the mouse pointer to screen co-ordinates (X,Y). They are in the usual range (0,0) - (320,200/240). The mouse.x and mouse.y variables will be updated to reflect the new position.

NOTE: Only use this command when absolutely necessary. Moving the mouse cursor for the player is a sure way to irritate them if you do it too often during the game.

Example:

SetMousePosition(160, 100);
will place the mouse cursor in the centre of the screen.

See Also: SetMouseBounds


SetNextCursorMode

SetNextCursorMode()
Selects the next enabled mouse cursor mode. This is useful for Sierra-style right-click cycling through modes. This function will choose the next mode marked as a Standard Mode, and will also use the Use Inventory mode if the player has an active inventory item.

See Also: SetCursorMode


ShowMouseCursor

ShowMouseCursor()
Makes the mouse cursor visible again after it was previously hidden with HideMouseCursor.

See Also: HideMouseCursor