Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- mon = peripheral.wrap("back")
- gs = {}
- gs["small"] = {}
- gs["small"]["size"] = "2x2"
- gs["small"]["amount"] = 0
- gs["middle"] = {}
- gs["middle"]["size"] = "2x3"
- gs["middle"]["amount"] = 0
- gs["big"] = {}
- gs["big"]["size"] = "3x3"
- gs["big"]["amount"] = 0
- if fs.exists("gs") == false then
- cFile = fs.open("gs","w")
- cFile.writeLine(textutils.serialize(gs))
- cFile.close()
- else
- rFile = fs.open("gs","r")
- gs = textutils.unserialize(rFile.readLine())
- rFile.close()
- end
- function save(gTab)
- sFile = fs.open("gs","w")
- gTab = textutils.serialize(gTab)
- sFile.writeLine(gTab)
- sFile.close()
- end
- function cbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = colors.black
- end
- if tcol == nil then
- tcol = colors.white
- end
- mon.setCursorPos(cx,cy)
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.write(text)
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- end
- gx,gy = mon.getSize()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- function range()
- cbut(4,2,"Ultra City Grundstuecke",colors.black,colors.red)
- cbut(4,3," Grössen : Anzahl ",colors.black,colors.white)
- cbut(6,5," " .. gs.small.size.. " ",colors.red,colors.white)
- cbut(20,5," " .. gs.small.amount.. " ",colors.red,colors.white)
- cbut(6,7," " .. gs.middle.size.. " ",colors.blue,colors.white)
- cbut(20,7," " .. gs.middle.amount.. " ",colors.blue,colors.white)
- cbut(6,9," " .. gs.big.size.. " ", colors.orange,colors.white)
- cbut(20,9," " .. gs.big.amount.. " ", colors.orange,colors.white)
- end
- function editCon()
- cbut(20,5,"<",colors.white,colors.black)
- cbut(20,7,"<",colors.white,colors.black)
- cbut(20,9,"<",colors.white,colors.black)
- cbut(24,5,">",colors.white,colors.black)
- cbut(24,7,">",colors.white,colors.black)
- cbut(24,9,">",colors.white,colors.black)
- cbut(gx,gy,"S",colors.green,colors.black)
- evt ,side, x,y = os.pullEvent("monitor_touch")
- if x == 20 then
- if y == 5 then
- if gs.small.amount < 0 then
- gs.small.amount = 0
- else
- gs.small.amount = gs.small.amount - 1
- end
- elseif y == 7 then
- if gs.middle.amount < 0 then
- gs.middle.amount = 0
- else
- gs.middle.amount = gs.middle.amount - 1
- end
- elseif y == 9 then
- if gs.big.amount < 0 then
- gs.big.amount = 0
- else
- gs.big.amount = gs.big.amount - 1
- end
- end
- save(gs)
- elseif x == 24 then
- if y == 5 then
- gs.small.amount = gs.small.amount + 1
- elseif y == 7 then
- gs.middle.amount = gs.middle.amount + 1
- elseif y == 9 then
- gs.big.amount = gs.middle.amount + 1
- end
- save(gs)
- elseif x == gx and y == gy then
- start()
- else
- range()
- editCon()
- end
- range()
- editCon()
- end
- function start()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- range()
- evt , side , x, y = os.pullEvent("monitor_touch")
- if x == gx or x == gx - 1 and gy == 1 then
- editCon()
- else
- start()
- end
- end
- while true do
- start()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement