Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i,o=input,output
- gn,sn,gb,sb=i.getNumber,o.setNumber,i.getBool,o.setBool
- w,h,lt=0,0,false
- function onTick()
- sys=gn(1)
- iX=gn(2)
- iY=gn(3)
- ps=gb(1)
- ft={1,h-9,7,6,"M",0} -- x,y,w,h,key,active
- mt={{1,7,w-3,6,"System 1",0},
- {1,15,w-3,6,"System 2",0},
- {1,23,w-3,6,"System 3",0},
- {1,31,w-3,6,"System 4",0},
- {1,39,w-3,6,"System 5",0},
- {1,47,w-3,6,"Standby",0}}
- if ps then
- if sys>0 then
- if tc(ft[1],ft[2],ft[3],ft[4]) then
- ft[6]=1
- sn(1,0)
- lock(1,true)
- end
- elseif sys==0 then
- for i,v in ipairs(mt) do
- if tc(v[1],v[2],v[3],v[4]) then
- mt[i][6]=1
- if v[5]=="Standby" then
- sn(1,-1)
- else
- sn(1,i)
- end
- lock(1,true)
- end
- end
- else
- sn(1,0)
- lock(1,true)
- end
- else
- if lt then
- lock(1,false)
- end
- end
- end
- s=screen
- sc=s.setColor
- function onDraw()
- w,h=s.getWidth(),s.getHeight()
- if sys<1 then
- sc(0,0,0)
- s.drawClear()
- if sys==0 then
- sc(0,255,0)
- s.drawTextBox(1,1,w-2,5,"menu",0,0)
- for i,v in ipairs(mt) do
- sc(0,255,0)
- dr(v[1],v[2],v[3],v[4])
- if v[6]==1 then
- sc(0,255,0)
- else
- sc(255,255,255)
- end
- drf(v[1]+1,v[2]+1,v[3]-1,v[4]-1)
- sc(0,0,0)
- dtb(v[1]+1,v[2]+1,v[3],v[4],v[5],0,0)
- end
- else
- sc(3,3,3)
- s.drawTextBox(1,1,w,h,"standby",0,0)
- end
- else
- sc(0,255,0)
- s.drawRect(ft[1],ft[2],ft[3],ft[4])
- if ft[6]==1 then
- sc(0,255,0)
- else
- sc(255,255,255)
- end
- s.drawRectF(ft[1]+1,ft[2]+1,ft[3]-1,ft[4]-1)
- sc(0,0,0)
- s.drawTextBox(ft[1]+1,ft[2]+1,ft[3],ft[4],ft[5],0,0)
- end
- end
- function lock(c,b)
- lt=b
- return sb(c,not b)
- end
- function tc(x,y,w,h)
- return iX>x and iY>y and iX<x+w and iY<y+h
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement