HDK Mouse And Keys

by Hiro the Dragon King
HDK Mouse And Keys
Real-time mouse updates as well as left and right macros for the Shift, Ctrl, and Alt keys. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://HirotheDragonKing.HDKMouseAndKeys##version=10

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:


Version 3.3
Date added: Feb 12 2011
Last updated: Sep 7 2013
7 fans
This library is not compatible with Internet Explorer 11. The quirk that I use to give us mouse tracking has been patched due to security concerns. In order to use this library or play games that use it, you will have to downgrade Internet Explorer to any version between IE6 and IE10.


This library is fully capable of tracking accurate mouse coordinates (in pixels) in relation to an infinite amount of maps and, if need be, converting those coordinates to map coordinates (again, in pixels) and tile-based screen and map coordinates. It can also track absolute coordinates over the client's screen and actively replicate the icon-x and icon-y parameters that mouse procedures allow.

This library provides screen management, allowing you to swap and displays different screen sizes and HUDs across multiple clients. A developer also now has access to accurate individual left and right key-down and key-up events for the modifier keys, Alt, Ctrl, and Shift. As well, you will also have access to the client's resolution information.

Even better, all of this, save for screen management and the advanced mouse functions, is handled on the client's end and all the server has to do is receive updates from the client, much like it already does for verbs and mouse functions, making all of this perfectly viable for a multi-player experience.

Version History
September 7th, 2013: Version 3.3
- Added client.default_screen. This allows developers using a single screen to not
have to learn the complicated /Screen system.
- Added world.default_screen for developer to easily share a screen between clients.
- Updated the JavaScript to adhere to any sense of standards. (It didn't.) Also
tweaked it a little for more compatibility with some of Windows botched updates.
- General house cleaning: eliminated redundant functions; increased modularity.

April 3rd, 2012: Version 3.2
- Changed the way that StartJavaScriptMouse/Keys/Vars starts up. This tweak prevents the lingering windows seen in Faction Wars 2 and the "flash" of windows upon start up.
- UpdateFPS has been updated to allow an update speed independent of tick_lag.
- Bug fixes, and minor tweaks.

March 28th, 2012: Version 3.1
- Added support for individual left and right macros for modifier keys.
- Bug fix for the demo.
- Updated the demo and documentation.

March 28th, 2012: Version 3.0
- Added /Screen datum. (Read on for more information.)
- Rearranged and organize the source for more readability.
- Fixed bugs in the pause/resume systems.
- Rewrote the icon_x/y systems to eliminate bugs and inefficiencies.
- Updated the demo.
- Rewrote the documentation.

November 30th, 2011: Version 2.5
- Updated the documentation.
- Forgot to update UpdateFPS() and UpdateScreenSize() to allow arguements for setting world.fps and screen_view_x/y, repsectively. Fixed.

November 17th, 2011: Version 2.4
- Conformed variables to a single naming convention. Note: JavaScript related variables still follow the naming conventions of their JavaScript counterparts.
- Updated for support of other libraries that will rely upon this.

September 3rd, 2011: Version 2.3
- Added support for iconx/y. GenerateIconCoordinates will now ouput what atom your cursor is over to client.current_atom and will output what pixel of the atom's icon that your mouse is over to client.iconx/y. GenerateMapLoc and GenerateScreenLoc must be enabled for this to work, otherwise the procedure will crash and remind you.
- Added support for and FPS override for JavaScript. If global.fps_override is set, the scripts will only send information at the specified rate.
- UpdateTickLag() has been replaced with UpdateFPS().
- Fixed a few copy and paste errors to UpdateScreenSize() that LummoxJR pointed out.
- Fixed GenerateMapLoc and GenerateMapCoordinates to output the correct information. Previously, they were switched.

May 28th, 2011: Version 2.2
- Corrected a prior oversight regarding calculations of world.icon_size and map.view-size.
- I added documentation for client.screen_sizex/y.

May 17th, 2011: Version 2.1
- A typographical error has been corrected. "UpadateScreenSize()" has been corrected to "UpdateScreenSize()".
- I corrected the demo file associations. In order for this update to correctly take effect, you must manually delete the prior version before installing the update.

April 7th, 2011: Version 2.0
- Major Update
- All systems will now only update the server if there is something to update.
- All systems now have a Start, Stop, Pause, and Resume command.
- Whether or not a map is in use is kept track of.
- The JavaScript extras have been split to separate systems for mouse and variables.

Febrary 13th, 2011: Version 1.0
- Initial Release

Use the donate button below to contribute money to my life. This will help me pay my bills so that I can create more games and libraries with less of the stress-caused bugs.

<input type="hidden" name="encrypted" value="-----BEGIN QEHATAUBggqhkiG9w0DBwQIkqgFtNyKz3SAgahqs66z2EZdMhvZre9AFHUM/ v1az7Ynvmxuxa+feTkecyA+iYQV6hUL8KhnndB2rHnwyvXXTsI1T78x1z4p/ WJQr0ku656R71f6xE9815VYR+i+qyf2dc5EtKWpkdmmITpR1+fBFis9qsDF/ 4uw+6awntALWh03PewmIJuzbALScsTS4sZoS1fKciBGoh11gIfHzylvkdNe/ hJl66/RGqrj5rFb08sAABNTzDTiqqNpJeBsYs/ MBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbYIBADAMBgNVHRMEBTADAQH/ QEBBQUAA4GBAIFfOlaagFrl71+jq6OKidbWFSE+Q4FqROvdgIONth+8kSK// GSIb3DQEJBTEPFw0xMjA0MTAwMDA1MjJaMCMGCSqGSIb3DQEJBDEWBBSDBJ/ 0VClBa7qIFtqznyixHM7C4qIgLoPSSTou4ZXM8KaPI4bA5Edy+GoRZjz178/ 2srTQpoG9pJ1Cr0Xbh+bM1uaJxhV0Dp1BYm2OCIR7l5NzPdRQddHfoUu8Mw7 jZZ5C7DOrj+ZjLFvx0-----END PKCS7-----


Tsfreaks: (Jul 21 2011, 6:58 pm)
Totally wow'd and sooo happy to have found this. Nice work.
Oasiscircle: (Feb 18 2011, 3:25 am)
Pretty awesome library! (:
Jemai1: (Feb 13 2011, 8:53 pm)
I like it :)