Convert.js (system script)

From Spheriki

Jump to: navigation, search

The system script convert.js converts screen to map coordinates and vice versa.


Contents

Usage

RequireSystemScript("convert.js");


Variables and functions of convert.js

  • ScreenX(mapx)
    • Returns a screen x-coordinate from a map x-coordinate.
    • Same as MapToScreenX(0, mapx).
  • ScreenY(mapy)
    • Returns a screen y-coordinate from a map-y coordinate.
    • Same as MapToScreenY(0, mapy).
  • TopX()
    • Returns the left-most map x-coordinate that is on screen.
    • Same as ScreenToMapX(0, 0).
  • TopY()
    • Returns the top-most map y-coordinate that is on screen.
    • Same as ScreenToMapY(0, 0).
  • MapX(screenx)
    • Returns a map x-coordinate from a screen x-coordinate.
    • Same as ScreenToMapX(0, screenx).
  • MapY(screeny)
    • Returns a map y-coordinate from a screen y-coordinate.
    • Same as ScreenToMapY(0, screeny).


Notes

  • Since the functions of this system script can easily be replaced by functions of the Sphere API, there is no need to use it!
  • All functions refer to layer 0 when referring to map coordinates.


Known bugs

  • MapX() and MapY() don't seem to work as intended.


See also

Personal tools