?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. -- Show mouse coords
  2.  
  3. function main ()
  4.  if (mappy.getValue(mappy.MAPWIDTH) == 0) then
  5.   mappy.msgBox ("Show mouse coords", "You need to load or create a map first", mappy.MMB_OK, mappy.MMB_ICONINFO)
  6.  else
  7.  
  8.   local x = mappy.getValue (mappy.MOUSEBLOCKX)
  9.   local y = mappy.getValue (mappy.MOUSEBLOCKY)
  10.   mappy.msgBox("Show mouse coords", "This script should be run from a keypress, see 'Key Shortcuts' in the docs. Mouse is over block "..x..", "..y..". Useful for writing scripts which modify the map at mouse location...", mappy.MMB_OK, mappy.MMB_ICONINFO)
  11.  
  12.  end
  13. end
  14.  
  15. test, errormsg = pcall( main )
  16. if not test then
  17.     mappy.msgBox("Error ...", errormsg, mappy.MMB_OK, mappy.MMB_ICONEXCLAMATION)
  18. end
  19.  
  20.