Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mbot = nil
- mdata = {}
- ldata = {}
- --
- BlackMoon = ""
- GreyMoon = ""
- WhiteMoon = ""
- --
- moonwin = nil
- --
- mbtcolors = {
- white = "yellow"
- ,grey = "yellow"
- ,black = "yellow"
- }
- --
- mbtacolors = {
- white = "[1;33m"
- ,grey = "[1;33m"
- ,black = "[1;33m"
- }
- --
- mbstate = false
- --
- function mbtinit()
- --
- mbot = Moonbot()
- moonwin = windows[zs.var.gmcpwin]
- if moonwin then mbot.setGMCP(true) end
- mbtclear()
- ldata = mbot.predict()
- mdata = mbot.getMoons()
- --
- end
- function mbtclear()
- --
- zs.gettrigger("moontrig1").enabled = false
- zs.gettrigger("moontrig2").enabled = false
- --
- end
- function mbtdinit()
- --
- if moonwin then
- moonwin.echo(cup(36,2)..eol..cw.."WHITE:"..rc..cup(36,13)..cd.."GREY:"..rc..cup(36,23)..cb.."BLACK:"..rc)
- moonwin.echo(cup(38,2)..eol..oc.."CONJUNCTION IN:"..rc..cup(38,22)..oc.."FOR"..rc)
- end
- --
- end
- function moontick()
- --
- ldata = mbot.predict()
- mdata = mbot.getMoons()
- setmoons()
- --
- end
- function mbtmdisp()
- --
- if moonwin then
- local x1, x2, x3, x4, x5 = 9, 19, 30, 18, 27
- local y1, y2 = 36, 38
- local fs1 = "%d"
- local fs2 = "%2d"
- local fs3 = "%3d"
- local bc = mdata.black > 0 and cg2 or cr2
- local gc = mdata.grey > 0 and cg2 or cr2
- local wc = mdata.white > 0 and cg2 or cr2
- local bd = bc..fs2:format(math.abs(mdata.black))..rc
- local gd = gc..fs2:format(math.abs(mdata.grey))..rc
- local wd = wc..fs2:format(math.abs(mdata.white))..rc
- moonwin.echo(cup(y1,x1)..wd..cup(y1,x2)..gd..cup(y1,x3)..bd)
- if ldata.tickno ~= -1 then
- moonwin.echo(cup(y2,x4)..cw..fs3:format(ldata.tickno)..cup(y2,x5)..cw..fs1:format(ldata.ticklen)..rc)
- else
- moonwin.echo(cup(y2,x4)..cw..fs3:format(0)..cup(y2,x5)..cw..fs1:format(0)..rc)
- end
- end
- --
- end
- function setmoons()
- --
- BlackMoon = mbot.BlackMoon()
- GreyMoon = mbot.GreyMoon()
- WhiteMoon = mbot.WhiteMoon()
- if moonwin then mbtmdisp() end
- --
- end
- function mbtmreset()
- --
- if moonwin then
- mbtdinit()
- mbtmdisp()
- end
- --
- end
- function moonbot(state)
- --
- local header = "MoonBot: "
- local msg1 = "Moon Tracker Activated"
- local msg2 = "Moon Tracker Deactivated"
- local msg3 = "Moon Tracker is "
- local msg4 = "Invalid Option"
- if type(state) == "boolean" then
- mbstate = state
- local status = mbstate and "active" or "inactive"
- if mbstate then
- zs.getclass("MoonTriggers").enabled = true
- zs.gettrigger("moontrig1").enabled = true
- zs.gettrigger("moontrig1").enabled = true
- zs.getbutton("mButton").enabled = true
- mbot.setStatus(true)
- -- mbot.setColors(mbtcolors)
- zs.cmd.window(hWind,zs.sys.crlf..oc..header..cw..msg1..rc..zs.sys.crlf)
- mbtmdisp()
- else
- zs.getbutton("mButton").enabled = false
- zs.gettrigger("moontrig1").enabled = false
- zs.gettrigger("moontrig1").enabled = false
- zs.getclass("MoonTriggers").enabled = false
- mbot.setStatus(false)
- zs.cmd.window(hWind,crlf..oc..header..cw..msg3..rc..crlf)
- mbtmdisp()
- end
- zs.cmd.window(hWind,crlf..oc..header..cw..msg3..cy..status..rc..crlf)
- else
- zs.cmd.window(hWind,crlf..oc..header..cw..msg4..rc..crlf)
- end
- --
- end
- function moontick()
- --
- if mbstate then
- mbot.mudTick()
- ldata = mbot.predict()
- mdata = mbot.getMoons()
- setmoons()
- end
- --
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement