Advertisement
Guest User

controll

a guest
May 3rd, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. mode=2
  2. anz=1
  3. dir="W"
  4. function draw1()
  5.   --Head
  6.   term.setBackgroundColor(colors.black)
  7.   term.clear()
  8.   term.setTextColor(colors.white)
  9.   term.setCursorPos(1,1)
  10.   term.write("Position")
  11.   term.setCursorPos(1,2)
  12.   term.write("Controll")
  13.   term.setCursorPos(11,1)
  14.   term.write("Hight")
  15.   term.setCursorPos(11,2)
  16.   term.write("Controll")
  17.   --NOSW
  18.   term.setTextColor(colors.yellow)
  19.   term.setCursorPos(4,4)
  20.   term.write("S")
  21.   term.setCursorPos(4,5)
  22.   term.write("|")
  23.   term.setCursorPos(2,6)
  24.   term.write("O- -W")
  25.   term.setCursorPos(4,7)
  26.   term.write("|")
  27.   term.setCursorPos(4,8)
  28.   term.write("N")
  29.   --UP Down
  30.   term.setTextColor(colors.orange)
  31.   term.setCursorPos(14,4)
  32.   term.write("@")
  33.   term.setCursorPos(14,5)
  34.   term.write("|")
  35.   term.setCursorPos(14,7)
  36.   term.write("|")
  37.   term.setCursorPos(14,8)
  38.   term.write("V")
  39.   --mode
  40.   term.setTextColor(colors.white)
  41.   term.setCursorPos(1,10)
  42.   term.write("X Manuell")
  43.   term.setCursorPos(3,11)
  44.   term.write("Automatik")
  45.   --credits
  46.   --term.setTextColor(colors.lime)
  47.   --term.setCursorPos(8,12)
  48.   --term.write("by SimssmiS")
  49.  
  50. end
  51. --draw1()
  52.  
  53. function draw2()
  54.   term.setBackgroundColor(colors.black)
  55.   term.clear()
  56.   --Dir
  57.   term.setTextColor(colors.white)
  58.   term.setCursorPos(1,1)
  59.   term.write("Dir: "..dir)
  60.   term.setCursorPos(3,3)
  61.   term.write("S")
  62.   term.setCursorPos(2,4)
  63.   term.write("O W")
  64.   term.setCursorPos(3,5)
  65.   term.write("N")
  66.   --Option
  67.   term.setCursorPos(9,3)
  68.   term.write("Raise")
  69.   term.setCursorPos(9,4)
  70.   term.write("Move")
  71.   term.setCursorPos(9,5)
  72.   term.write("Move+Dig")
  73.   --Anzahl
  74.   term.setCursorPos(11,7)
  75.   term.write("++")
  76.   term.setCursorPos(11,9)
  77.   term.write("--")
  78.   tmp=""..anz
  79.   if string.len(tmp)==1 then
  80.   tmp="0"..anz
  81.   end
  82.   term.setCursorPos(6,8)
  83.   term.write("Anz: "..tmp)
  84.   --mode
  85.   term.setCursorPos(1,10)
  86.   term.write("  Manuell")
  87.   term.setCursorPos(1,11)
  88.   term.write("X Automatik")
  89. end
  90.  
  91. function getInput()
  92.   event,side,x,y=os.pullEvent("monitor_touch")
  93.   return x,y
  94. end
  95.  
  96. function touch1()
  97.   draw1()
  98.   x,y=getInput()
  99.   if x>=1 and x<=11 and y==10 then
  100.     mode=1
  101.   elseif x>=1 and x<=11 and y==11 then
  102.     mode=2
  103.   end
  104. end
  105. function touch2()
  106.   draw2()
  107.   x,y=getInput()
  108.   if x==3 and y==3 then
  109.     dir="S"
  110.   elseif x==2 and y==4 then
  111.     dir="O"
  112.   elseif x==4 and y==4 then
  113.     dir="W"
  114.   elseif x==3 and y==5 then
  115.     dir="N"
  116.   elseif x==11 and y==7 then
  117.     anz=anz+10
  118.   elseif x==12 and y==7 then
  119.     anz=anz+1
  120.   elseif x==11 and y==9 then
  121.     anz=anz-10
  122.   elseif x==12 and y==9 then
  123.     anz=anz-1
  124.   end
  125.  
  126.   if x>=1 and x<=11 and y==10 then
  127.     mode=1
  128.   elseif x>=1 and x<=11 and y==11 then
  129.     mode=2
  130.   end
  131. end
  132.  
  133. while true do
  134.   if mode==1 then
  135.     touch1()
  136.   elseif mode==2 then
  137.     touch2()
  138.   end
  139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement