Plot:Init mouse

From OHRRPGCE-Wiki

Jump to: navigation, search
init mouse

Initializes the mouse, returning true if one is present, and loads the mouse driver. This command much be run before any mouse functions can be used. Therefore, it is a good idea to place this command in the newgame and loadgame scripts if you are going to use the mouse.

The mouse will start in the middle of the screen with bounds of 0-319 horizontally and 0-199 vertically. The bounds can be changed with mouse region, and you can reposition the mouse with put mouse.


Running this command does not draw a cursor on screen - your script must do this itself by placing an npc at the appropriate location.
Here is an example:

[edit] Examples

include,plotscr.hsd

#Mouse cursor example

plotscript, display mouse, begin

  #start up the mouse
  init mouse

  #loop while the game is running
  while (true) do,begin

    #NPC 0 is the mouse cursor
    put npc (0, mouse pixel x + camera pixel x, mouse pixel y + camera pixel y)
    wait
  end
end
Personal tools