Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this online program displays all Laws
- local Pg = 1
- local Laws = {"All Citizens must live within or on the outskirts of a Legal settlement","No one is allowed to steal items", "the use/Ownership of a Coin Press is Only allowed for those given the Permission to do so by the Appropriate Government Organizations", "The Destruction of Public Transportation Infrastructure without Repairing is Illegal unless given Proper permission by the Appropriate Government Bodies"}
- local MaxPg = #Laws/6
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function DisplayTabTop()
- print("-----Laws-----")
- if MaxPg > 1 then
- print("Pg"..Pg..", a < > d, c to exit")
- else
- print("Pg"..Pg..", c to exit")
- end
- end
- local function DrawPage()
- local PgSpot = ((Pg * 9) - 8)
- local Items = 6
- if #Laws < 6 then Items = #Laws end
- for i = PgSpot, Items do
- print(i.." - "..Laws[i])
- end
- end
- function PageInteraction()
- Clear()
- DisplayTabTop()
- DrawPage()
- local event
- repeat
- event = {os.pullEvent("key")}
- until event[2] == keys.a or event[2] == keys.d or event[2] == keys.c
- if event[2] == keys.a and Pg > 1 then
- Pg = Pg - 1
- PageInteraction()
- elseif event[2] == keys.d and Pg < MaxPg then
- Pg = Pg + 1
- PageInteraction()
- elseif event[2] == keys.c then
- shell.run("os/os_Programs/os_MainScript")
- else
- PageInteraction()
- end
- end
- PageInteraction()
Add Comment
Please, Sign In to add comment