?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. -- Layer Count
  2.  
  3. lnum = 0
  4.  
  5. function main ()
  6.  local w = mappy.getValue(mappy.MAPWIDTH)
  7.  local h = mappy.getValue(mappy.MAPHEIGHT)
  8.  
  9.  if (w == 0) then
  10.   mappy.msgBox ("Layer Count", "You need to load or create a map first", mappy.MMB_OK, mappy.MMB_ICONINFO)
  11.  else
  12.  
  13.   mappy.msgBox ("Layer Count", "Number of layers in map = "..lnum, mappy.MMB_OK, mappy.MMB_ICONINFO)
  14.  
  15.  end
  16. end
  17.  
  18. function countlayer ()
  19.  mappy.getBlock(0,0,lnum)
  20. end
  21.  
  22. while 1 do
  23.  lnum = lnum + 1
  24.  test, errormsg = pcall( countlayer )
  25.  if not test then
  26.   break
  27.  end
  28.  if (lnum == 8) then
  29.   break;
  30.  end
  31. end
  32.  
  33. test, errormsg = pcall( main )
  34. if not test then
  35.     mappy.msgBox("Error ...", errormsg, mappy.MMB_OK, mappy.MMB_ICONEXCLAMATION)
  36. end
  37.