Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. i,o=input,output
  2. gn,sn,gb,sb=i.getNumber,o.setNumber,i.getBool,o.setBool
  3. w,h,lt=0,0,false
  4. function onTick()
  5.     sys=gn(1)
  6.     iX=gn(2)
  7.     iY=gn(3)
  8.     ps=gb(1)
  9.     ft={1,h-9,7,6,"M",0} -- x,y,w,h,key,active
  10.     mt={{1,7,w-3,6,"System 1",0},
  11.         {1,15,w-3,6,"System 2",0},
  12.         {1,23,w-3,6,"System 3",0},
  13.         {1,31,w-3,6,"System 4",0},
  14.         {1,39,w-3,6,"System 5",0},
  15.         {1,47,w-3,6,"Standby",0}}
  16.    
  17.     if ps then
  18.         if sys>0 then
  19.             if tc(ft[1],ft[2],ft[3],ft[4]) then
  20.                 ft[6]=1
  21.                 sn(1,0)
  22.                 lock(1,true)
  23.             end
  24.         elseif sys==0 then
  25.             for i,v in ipairs(mt) do
  26.                 if tc(v[1],v[2],v[3],v[4]) then
  27.                     mt[i][6]=1
  28.                     if v[5]=="Standby" then
  29.                         sn(1,-1)
  30.                     else
  31.                         sn(1,i)
  32.                     end
  33.                     lock(1,true)
  34.                 end
  35.             end
  36.         else
  37.             sn(1,0)
  38.             lock(1,true)
  39.         end
  40.     else
  41.         if lt then
  42.             lock(1,false)
  43.         end
  44.     end
  45. end
  46.  
  47. s=screen
  48. sc=s.setColor
  49. function onDraw()
  50.     w,h=s.getWidth(),s.getHeight()
  51.    
  52.     if sys<1 then
  53.         sc(0,0,0)
  54.         s.drawClear()
  55.         if sys==0 then
  56.             sc(0,255,0)
  57.             s.drawTextBox(1,1,w-2,5,"menu",0,0)
  58.             for i,v in ipairs(mt) do
  59.                 sc(0,255,0)
  60.                 dr(v[1],v[2],v[3],v[4])
  61.                 if v[6]==1 then
  62.                     sc(0,255,0)
  63.                 else
  64.                     sc(255,255,255)
  65.                 end
  66.                 drf(v[1]+1,v[2]+1,v[3]-1,v[4]-1)
  67.                 sc(0,0,0)
  68.                 dtb(v[1]+1,v[2]+1,v[3],v[4],v[5],0,0)
  69.             end
  70.         else
  71.             sc(3,3,3)
  72.             s.drawTextBox(1,1,w,h,"standby",0,0)
  73.         end
  74.     else
  75.         sc(0,255,0)
  76.         s.drawRect(ft[1],ft[2],ft[3],ft[4])
  77.         if ft[6]==1 then
  78.             sc(0,255,0)
  79.         else
  80.             sc(255,255,255)
  81.         end
  82.         s.drawRectF(ft[1]+1,ft[2]+1,ft[3]-1,ft[4]-1)
  83.         sc(0,0,0)
  84.         s.drawTextBox(ft[1]+1,ft[2]+1,ft[3],ft[4],ft[5],0,0)
  85.     end
  86. end
  87.    
  88. function lock(c,b)
  89.     lt=b
  90.     return sb(c,not b)
  91. end
  92.  
  93. function tc(x,y,w,h)
  94.     return iX>x and iY>y and iX<x+w and iY<y+h
  95. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement