?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. -- Set palette index
  2.  
  3. function main ()
  4.  local w = mappy.getValue(mappy.MAPWIDTH)
  5.  local h = mappy.getValue(mappy.MAPHEIGHT)
  6.  
  7.  if (w == 0) then
  8.   mappy.msgBox ("Set palette index", "You need to load or create a map first", mappy.MMB_OK, mappy.MMB_ICONINFO)
  9.  else
  10.   local isok,index,a,r,g,b = mappy.doDialogue ("Set palette index", "Enter index,alpha,red,green,blue", "0,255,0,0,0", mappy.MMB_DIALOGUE2)
  11.   if isok == mappy.MMB_OK then
  12.    mappy.setValue (mappy.PALETTEARGB+index, a, r, g, b)
  13.    mappy.msgBox ("Set palette index", "index "..tostring(index).." set successfully", mappy.MMB_OK, mappy.MMB_ICONINFO)
  14.   end
  15.  end
  16. end
  17.  
  18. test, errormsg = pcall( main )
  19. if not test then
  20.     mappy.msgBox("Error ...", errormsg, mappy.MMB_OK, mappy.MMB_ICONEXCLAMATION)
  21. end
  22.