FANDOM


BYOND Environment This page contains an entry from the official DM Reference.

Mouse ProceduresEdit

Various mouse actions may be handled by defining procedures either on the client object or on the atomic object being manipulated. Any of the following procedures may be defined:

WarningEdit

In general, define only the procedures you need, because extra communication overhead may be avoided when the compiler detects that you do not care about certain events.

ArgumentsEdit

The arguments used in mouse procs generally follow one of two forms:

For Click(), DblClick(), MouseDown(), MouseUp(), MouseEntered(), and MouseExited():

 client/Click(object, location, control, params)

 atom/Click(location, control, params)

For MouseDrag() and MouseDrop():

 client/MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params)

 atom/MouseDrag(over_object, src_location, over_location, src_control, over_control, params)

locationEdit

The location argument varies with the type of control. For the map, it will be the turf where the mouse action happened. For info controls (statpanels), it will be the name of the statpanel where the action happened. For grid controls, it will be the cell where the action happened. For others controls it may vary, but most will leave this blank.

controlEdit

The control argument is the ID of the skin control where the action happened, such as "mappane.map" or "mainwindow.banner".

paramsEdit

The params argument is text, and can be converted to a list using params2list(). It may contain any of the following properties, which will only be set if they are used:

  • icon-x, icon-y: Pixel coordinates within the icon; 1,1 is the lower left
  • screen-loc: Pixel coordinates in screen_loc format ("[tile_x]:[pixel_x],[tile_y]:[pixel_y]")
  • left, middle, right: Mouse buttons pressed/held/released
  • ctrl, shift, alt: Keys held down during the mouse action
  • drag-cell, drop-cell: Cells involved if using a Grid control

Mouse pointerEdit

The mouse pointer may be customized as well. The following variables all deal with the appearance of the pointer. They do not control what actions may be taken by the user, but they provide hints to the user about what actions may work.

VariablesEdit

ValuesEdit

When selecting a mouse pointer, you may provide your own custom icon or use one of the built-in pointers.


NoteEdit

Older games compiled prior to BYOND 4.0 had a different format for the MouseDown() and MouseUp() procs. These used icon_x and icon_y as arguments, but control and params have replaced them.