Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local e={}local t={}function e.API(a,o,i,n,s)if a==true then
- a={os.pullEvent("monitor_touch")}end if a[3]>=o and a[3]<=o+n-1 then if a[4]>=i
- and a[4]<=i+s-1 then return true else return false end end end function
- e.touch()local h={os.pullEvent("monitor_touch")}return h end function
- e.timetouch(r,d)local l=os.startTimer(r)while true do local
- u={os.pullEvent()}if(u[1]=="timer")and(u[2]==l)then if d==nil then local
- d="timeout"end
- return{"timeout",d,1000,1000}elseif(u[1]=="monitor_touch")and(u[2]==d)then
- return{u[1],u[2],u[3],u[4]}end end end function e.button(c,f,w,y,p)if f[2]==c
- then if f~=nil then
- m=peripheral.wrap(c)x=e.API(f,w,y,string.len(p),1)m.setCursorPos(w,y)m.write(p)return
- x end end end function e.counter(v,b,g,k,q,j,z,E,T)if v=="db"then if data==nil
- then return nil else return data[b]end end if v=="setdb"then if data==nil then
- return"no data to edit"else data[b]=g return("value changed too "..type(g))end
- end if b[2]==v then if b~=nil then local A=peripheral.wrap(v)if data==nil then
- data={}for O=0,1000 do data[O]=0 end end
- A.setCursorPos(k,q)A.write("\24".." "..data[g])A.setCursorPos(k,q+1)A.write("\25")if
- e.API(b,k,q,1,1)==true then if data[g]<z then data[g]=data[g]+j
- A.setCursorPos(k,q)A.setTextColor(colors.green)A.write("\24".." "..data[g].." ")A.setCursorPos(k,q+1)A.setTextColor(colors.red)A.write("\25")A.setTextColor(colors[T])return
- data[g]end end end if e.API(b,k,q+1,1,1)==true then if data[g]>E then
- data[g]=data[g]-j
- m.setCursorPos(k,q)m.setTextColor(colors.green)m.write("\24".." "..data[g].." ")m.setCursorPos(k,q+1)m.setTextColor(colors.red)m.write("\25")m.setTextColor(colors[T])return
- data[g]end end end end function e.fill(I,N,S,H,R)local D=peripheral.wrap(I)for
- L=0,R-1 do D.setCursorPos(N,S+L)D.write(string.rep(" ",H))end end function
- e.switch(U,C,M,F,W,Y,P,V,B)if U=="db"then if data1==nil then return nil else
- return data1[C]end end if U=="setdb"then if data1==nil then
- return"no data to edit"else data1[C]=M return("value changed too "..type(M))end
- end if M[2]==U then if M~=nil then local G=string.len(B)local
- K=peripheral.wrap(U)if data1==nil then data1={}for Q=0,1000 do data1[Q]=false
- end end local function J()data1[C]=not data1[C]end if
- e.API(M,F,W,string.len(B),1)==true then J()end local X=K.getTextColor()local
- Z=K.getBackgroundColor()if data1[C]==true then
- K.setBackgroundColor(colors[P])else K.setBackgroundColor(colors[Y])end
- K.setCursorPos(F,W)K.setTextColor(colors[V])K.write(B)K.setTextColor(X)K.setBackgroundColor(Z)return(data1[C])end
- end end function e.switchn(et,tt,at,ot,it,nt,st,ht,rt,dt)if et=="db"then if
- data2==nil then return nil else return data2[tt]end end if et=="setdb"then if
- data2==nil then return"no data to edit"else data2[tt]=at
- return("value changed too "..type(at))end end if at[2]==et then if at~=nil then
- local lt=string.len(rt)if string.len(rt)~=string.len(dt)then if
- string.len(rt)>string.len(dt)then lt=string.len(rt)else lt=string.len(dt)end
- end local ut=peripheral.wrap(et)if data2==nil then data2={}for ct=0,1000 do
- data2[ct]=false end end local function mt()data2[tt]=not data2[tt]end if
- e.API(at,ot,it,lt,1)==true then mt()end local ft=ut.getTextColor()local
- wt=ut.getBackgroundColor()if data2[tt]==true then ut.setCursorPos(ot,it)if
- string.len(rt)~=string.len(dt)then ut.write(string.rep(" ",lt))end
- ut.setBackgroundColor(colors[st])ut.setCursorPos(ot,it)ut.setTextColor(colors[ht])ut.write(dt)else
- ut.setCursorPos(ot,it)if string.len(rt)~=string.len(dt)then
- ut.write(string.rep(" ",lt))end
- ut.setBackgroundColor(colors[nt])ut.setCursorPos(ot,it)ut.setTextColor(colors[ht])ut.write(rt)end
- ut.setTextColor(ft)ut.setBackgroundColor(wt)return(data2[tt])end end end
- function
- e.bundle(yt,pt,vt)if(type(yt)=="string")and(type(pt)=="number")and(type(vt)=="boolean")then
- if vt==true then
- rs.setBundledOutput(yt,colors.combine(rs.getBundledOutput(yt),pt))elseif
- vt==false then
- rs.setBundledOutput(yt,colors.subtract(rs.getBundledOutput(yt),pt))end else
- error("please use like this:\nbundle(side:string,colors.(color),state:boolean)")end
- end function e.signal(bt,gt,kt,qt)if gt=="clear"then
- rs.setBundledOutput(bt,0)else if qt==true then if gt=="on"then gt=true end if
- gt=="nil"then gt=false end end if gt~=nil then if gt==true then
- bundle(bt,kt,true)elseif gt==false then bundle(bt,kt,false)end end end end
- function e.sliderHor(jt,xt,zt,Et,Tt,At,Ot,It)if jt=="db"then if data3==nil then
- return nil else return data3[xt]end end if jt=="setdb"then if data3==nil then
- return"no data to edit"else data3[xt]=zt
- return("value changed too "..type(zt))end end if xt[2]==jt then if xt~=nil then
- m=peripheral.wrap(jt)local Nt=m.getBackgroundColor()local
- St=m.getTextColor()m.setBackgroundColor(colors[Ot])m.setTextColor(colors[It])m.setCursorPos(Et,Tt)for
- Ht=0,At do m.write("-")m.setCursorPos(Et+Ht,Tt)end if data3==nil then
- data3={}for Rt=0,1000 do data3[Rt]=0 end end local
- Dt=(xt[3])if(xt[4]==Tt)and(xt[3]>=Et)and(xt[3]<=(Et+At)-1)then
- m.setCursorPos(Dt,Tt)data3[zt]=Dt m.write("|")else
- m.setCursorPos(data3[zt],Tt)m.write("|")end
- m.setBackgroundColor(Nt)m.setTextColor(St)if data3[zt]-Et>=0 then
- return(data3[zt]-Et)elseif data3[zt]-Et<0 then return 0 end end end end
- function e.sliderVer(Lt,Ut,Ct,Mt,Ft,Wt,Yt,Pt)if Lt=="db"then if data10==nil
- then return nil else return data10[Ut]end end if Lt=="setdb"then if data10==nil
- then return"no data to edit"else data10[Ut]=Ct
- return("value changed too "..type(Ct))end end if Ut[2]==Lt then if Ut~=nil then
- m=peripheral.wrap(Lt)local Vt=m.getBackgroundColor()local
- Bt=m.getTextColor()m.setBackgroundColor(colors[Yt])m.setTextColor(colors[Pt])m.setCursorPos(Mt,Ft)for
- Gt=0,Wt do m.write("\124")m.setCursorPos(Mt,Ft-Gt)end if data10==nil then
- data10={}for Kt=0,1000 do data10[Kt]=0 end end local
- Qt=Ut[4]if(Ut[3]==Mt)and(Ut[4]<=Ft)and(Ut[4]>=(Ft-Wt)+1)then
- m.setCursorPos(Mt,Qt)data10[Ct]=Qt m.write("\xad")else
- m.setCursorPos(Mt,data10[Ct])m.write("\xad")end
- m.setBackgroundColor(Vt)m.setTextColor(Bt)if data10[Ct]-Mt>=0 then
- return(data10[Ct]-Mt)elseif data10[Ct]-Mt<0 then return 0 end end end end
- function e.render(Jt,Xt,Zt,ea,ta,aa)local oa=peripheral.wrap(Jt)local
- ia=oa.getBackgroundColor()local na=oa.getTextColor()local
- sa={oa.getCursorPos()}oa.setTextColor(colors[ta])if type(aa)=="string"then
- oa.setBackgroundColor(colors[aa])elseif type(aa)=="number"then
- oa.setBackgroundColor(aa)end
- oa.setCursorPos(Zt,ea)oa.write(Xt)oa.setBackgroundColor(ia)oa.setTextColor(na)oa.setCursorPos(sa[1],sa[2])end
- function e.menu(ha,ra,da,la,ua,ca,ma,fa,wa,ya,pa)if ra[2]==ha then if
- thisIsUseless==nil then for va=0,1000 do
- thisIsUseless={}thisIsUseless[va]=false end end if not thisIsUseless[da]then
- e.render(ha,fa,la,ua,ca,oldcol2)end if ra~=nil then local
- ba=peripheral.wrap(ha)local ga=ba.getTextColor()local
- ka=ba.getBackgroundColor()local qa=string.len(fa)if ra[1]~="timeout"then if
- data4==nil then data4={}for ja=0,1000 do data4[ja]=false end end if data5==nil
- then data5={}for xa=0,1000 do data5[xa]=false end end if data6==nil then
- data6={}for za=0,1000 do data6[za]=false end end if e.API(ra,la,ua,qa,1)==true
- then data4[da]=fa data5[da]=la data6[da]=ua local function Ea()for Ta=1,500 do
- if data4[Ta]~=false then
- ba.setBackgroundColor(ka)ba.setCursorPos(data5[Ta],data6[Ta])ba.setTextColor(colors[ca])ba.write(data4[Ta])end
- end local Aa=0 end
- Ea()ba.setCursorPos(data5[da],data6[da])ba.setBackgroundColor(colors[ma])ba.setTextColor(colors[ca])ba.write(fa)ba.setTextColor(ga)ba.setBackgroundColor(ka)menuout=fa
- if wa==nil then return menuout else if(ya==nil)or(ya==false)then menuout=wa
- return menuout else menuout={wa,pa}if menuout==nil then return 0 end return
- menuout end end end end end end thisIsUseless[da]=true if ya==true then if
- menuout==nil then menuout={wa,"nil"}end end end function e.menudata()if
- menuout~=nil then return menuout else return"no output"end end function
- e.timeswitch(Oa,Ia,Na,Sa,Ha,Ra,Da,La,Ua,Ca,Ma)if Oa=="db"then if data7==nil
- then return nil else return data7[Ia]end end if Oa=="setdb"then if data7==nil
- then return"no data to edit"else data7[Ia]=Na
- return("value changed too "..type(Na))end end if Ia[2]==Oa then if Ia~=nil then
- local Fa=peripheral.wrap(Oa)local Wa=Fa.getTextColor()local
- Ya=Fa.getBackgroundColor()Fa.setBackgroundColor(colors[Ua])Fa.setTextColor(colors[La])if
- data7==nil then data7={}for Pa=0,1000 do data7[Pa]=false end end if data8==nil
- then data8={}for Va=0,1000 do data8[Va]=false end end if data8[Na]==false then
- data8[Na]=Da Fa.setCursorPos(Sa+6,Ha)Fa.write(data8[Na])end
- Fa.setCursorPos(Sa,Ha)Fa.write("start")if e.API(Ia,Sa,Ha,4,1)==true then
- data7[Na]=true end if data7[Na]==true then if data8[Na]>0 then repeat
- timeOut=data8[Na]Fa.setBackgroundColor(colors[Ca])data8[Na]=data8[Na]-Ra
- Fa.setCursorPos(Sa+6,Ha)sleep(1)Fa.write(data8[Na])until data8[Na]==0
- return"ended"end end if Ma==true then data8[Na]=Da end
- Fa.setBackgroundColor(colors[Ua])Fa.setCursorPos(Sa+6,Ha)Fa.write(data8[Na])Fa.setTextColor(Wa)Fa.setBackgroundColor(Ya)end
- end end function
- e.bar(Ba,Ga,Ka,Qa,Ja,Xa,Za,eo,to,ao,oo,io,no,so,ho,ro)if(Xa==nil)or(Xa<0)then
- Xa=0 end if so==nil then local so=false end if Xa~=nil then local
- lo=peripheral.wrap(Ba)oldcol=lo.getBackgroundColor()oldcol1=lo.getTextColor()lo.setTextColor(colors[ao])local
- function
- uo()lo.setBackgroundColor(colors[eo])e.fill(Ba,Ga-1,Ka-Ja,Qa,Ja*2)lo.setBackgroundColor(oldcol)xm=lo.getBackgroundColor()xb=lo.getTextColor()lo.setTextColor(xm)lo.setBackgroundColor(xb)lo.setCursorPos(Ga-1,Ka-Ja)if
- ro then lo.setBackgroundColor(colors[ao])end if ro then
- lo.write(string.rep("\x83",Qa+1))lo.setTextColor(xb)lo.setBackgroundColor(xm)else
- lo.write("\159"..string.rep("\143",Qa-1))lo.setTextColor(xb)lo.setBackgroundColor(xm)lo.write("\144")end
- if ro then lo.setBackgroundColor(colors[ao])end lo.setCursorPos(Ga-1,Ka+Ja)if
- ro then lo.write(string.rep("\x8c",Qa+1))else
- lo.write("\130"..string.rep("\131",Qa-1).."\129")end for co=0,(Ja*2)-2 do if
- not ro then lo.setTextColor(xm)lo.setBackgroundColor(xb)end
- lo.setCursorPos(Ga-1,(Ka+co)-(Ja)+1)if ro then
- lo.setBackgroundColor(colors[ao])end
- lo.write("\x95")lo.setCursorPos((Ga-2)+(Qa+1),(Ka+co)-(Ja)+1)if not ro then
- lo.setTextColor(xb)lo.setBackgroundColor(xm)end lo.write("\x95")end end if
- ho~=false then uo()else e.fill(Ba,Ga-1,Ka-Ja,Qa,Ja*2)end local mo=Xa/Za*Qa
- local fo=Xa/Za*Ja local wo=math.ceil(fo)local yo=(wo*2)-2 local po=Ka+Ja
- lo.setBackgroundColor(colors[to])if(io==false)or(io==nil)then
- e.fill(Ba,Ga,(Ka-Ja)+1,mo-1,(Ja*2)-1)else e.fill(Ba,Ga,(po-1)-yo,Qa-1,yo+1)end
- if oo==true then lo.setCursorPos(Ga,Ka)lo.setTextColor(colors[ao])if io==true
- then if so then if Xa>=Za/2 then lo.setBackgroundColor(colors[to])else
- lo.setBackgroundColor(colors[eo])end else if Xa>=(Za/2)-(Za/Ja)then
- lo.setBackgroundColor(colors[to])else lo.setBackgroundColor(colors[eo])end end
- elseif io==false then lo.setCursorPos(Ga,Ka)lo.setTextColor(colors[ao])if
- io==true then if Xa>=1 then lo.setBackgroundColor(colors[to])else
- lo.setBackgroundColor(colors[eo])end end end if so then
- lo.write(Xa.."/"..Za)lo.setCursorPos(Ga,Ka+1)lo.write(no)else
- lo.write(Xa.."/"..Za.." "..no)end
- lo.setBackgroundColor(oldcol)lo.setTextColor(oldcol1)end
- lo.setTextColor(oldcol1)lo.setBackgroundColor(oldcol)end end function
- e.frame(vo,bo,go,ko,qo,jo,xo,zo)local Eo=peripheral.wrap(vo)local
- To=Eo.getBackgroundColor()local
- Ao=Eo.getTextColor()Eo.setBackgroundColor(colors[xo])e.fill(vo,bo-1,go-qo,ko,qo*2)Eo.setBackgroundColor(To)xm=Eo.getBackgroundColor()xb=Eo.getTextColor()Eo.setTextColor(xm)Eo.setBackgroundColor(xb)Eo.setCursorPos(bo-1,go-qo)if
- zo then
- Eo.setBackgroundColor(colors[jo])Eo.setTextColor(To)Eo.write(string.rep("\x83",ko+1))Eo.setTextColor(xb)Eo.setBackgroundColor(xm)else
- Eo.setTextColor(To)Eo.setBackgroundColor(colors[jo])Eo.write("\159"..string.rep("\143",ko-1))Eo.setTextColor(colors[jo])Eo.setBackgroundColor(To)Eo.write("\144")end
- Eo.setCursorPos(bo-1,go+qo)if zo then
- Eo.setBackgroundColor(To)Eo.setTextColor(colors[jo])Eo.write(string.rep("\x8f",ko+1))Eo.setBackgroundColor(colors[xo])Eo.setTextColor(colors[jo])else
- Eo.write("\130"..string.rep("\131",ko-1).."\129")end for Oo=0,(qo*2)-2 do if
- not zo then Eo.setTextColor(xm)Eo.setBackgroundColor(xb)end
- Eo.setCursorPos(bo-1,(go+Oo)-(qo)+1)if zo then
- Eo.setBackgroundColor(colors[jo])end
- Eo.setBackgroundColor(colors[jo])Eo.write("\x95")Eo.setCursorPos((bo-2)+(ko+1),(go+Oo)-(qo)+1)if
- not zo then Eo.setTextColor(xb)Eo.setBackgroundColor(xm)end
- Eo.setTextColor(colors[jo])Eo.write("\x95")end
- Eo.setBackgroundColor(To)Eo.setTextColor(Ao)end function
- t.API(Io,No,So,Ho,Ro)if Io==true then Io={os.pullEvent("mouse_click")}end if
- Io[3]>=No and Io[3]<=No+Ho-1 then if Io[4]>=So and Io[4]<=So+Ro-1 then return
- true else return false end end end function t.touch()local
- Do={os.pullEvent("mouse_click")}return Do end function t.timetouch(Lo)local
- Uo=os.startTimer(Lo)while true do local
- Co={os.pullEvent()}if(Co[1]=="timer")and(Co[2]==Uo)then
- return{"timeout","tout",1000,1000}elseif(Co[1]=="mouse_click")then
- return{Co[1],Co[2],Co[3],Co[4]}end end end function t.button(Mo,Fo,Wo,Yo,Po)if
- Fo[2]==Mo or Fo[2]=="tout"then if Fo~=nil then
- x=t.API(Fo,Wo,Yo,string.len(Po),1)term.setCursorPos(Wo,Yo)term.write(Po)return
- x end end end function t.counter(Vo,Bo,Go,Ko,Qo,Jo,Xo,Zo,ei)if Vo=="db"then if
- data==nil then return nil else return data[Bo]end end if Vo=="setdb"then if
- data==nil then return"no data to edit"else data[Bo]=Go
- return("value changed too "..type(Go))end end if Bo[2]==Vo or Bo[2]=="tout"then
- if Bo~=nil then if data==nil then data={}for ti=0,1000 do data[ti]=0 end end
- term.setCursorPos(Ko,Qo)term.write("\24".." "..data[Go])term.setCursorPos(Ko,Qo+1)term.write("\25")if
- t.API(Bo,Ko,Qo,1,1)==true then if data[Go]<Xo then data[Go]=data[Go]+Jo
- term.setCursorPos(Ko,Qo)term.setTextColor(colors.green)term.write("\24".." "..data[Go].." ")term.setCursorPos(Ko,Qo+1)term.setTextColor(colors.red)term.write("\25")term.setTextColor(colors[ei])return
- data[Go]end end end if t.API(Bo,Ko,Qo+1,1,1)==true then if data[Go]>Zo then
- data[Go]=data[Go]-Jo
- term.setCursorPos(Ko,Qo)term.setTextColor(colors.green)term.write("\24".." "..data[Go].." ")term.setCursorPos(Ko,Qo+1)term.setTextColor(colors.red)term.write("\25")term.setTextColor(colors[ei])return
- data[Go]end end end end function t.fill(ai,oi,ii,ni)for si=0,ni-1 do
- term.setCursorPos(ai,oi+si)term.write(string.rep(" ",ii))end end function
- t.switch(hi,ri,di,li,ui,ci,mi,fi,wi)if hi=="db"then if data1==nil then return
- nil else return data1[ri]end end if hi=="setdb"then if data1==nil then
- return"no data to edit"else data1[ri]=di
- return("value changed too "..type(di))end end if di[2]==hi or di[2]=="tout"then
- if di~=nil then local yi=string.len(wi)if data1==nil then data1={}for pi=0,1000
- do data1[pi]=false end end local function vi()data1[ri]=not data1[ri]end if
- t.API(di,li,ui,string.len(wi),1)==true then vi()end local
- bi=term.getTextColor()local gi=term.getBackgroundColor()if data1[ri]==true then
- term.setBackgroundColor(colors[mi])else term.setBackgroundColor(colors[ci])end
- term.setCursorPos(li,ui)term.setTextColor(colors[fi])term.write(wi)term.setTextColor(bi)term.setBackgroundColor(gi)return(data1[ri])end
- end end function t.switchn(ki,qi,ji,xi,zi,Ei,Ti,Ai,Oi,Ii)if ki=="db"then if
- data2==nil then return nil else return data2[qi]end end if ki=="setdb"then if
- data2==nil then return"no data to edit"else data2[qi]=ji
- return("value changed too "..type(ji))end end if ji[2]==ki or ji[2]=="tout"then
- if ji~=nil then local Ni=string.len(Oi)if string.len(Oi)~=string.len(Ii)then if
- string.len(Oi)>string.len(Ii)then Ni=string.len(Oi)else Ni=string.len(Ii)end
- end if data2==nil then data2={}for Si=0,1000 do data2[Si]=false end end local
- function Hi()data2[qi]=not data2[qi]end if t.API(ji,xi,zi,Ni,1)==true then
- Hi()end local Ri=term.getTextColor()local Di=term.getBackgroundColor()if
- data2[qi]==true then term.setCursorPos(xi,zi)if
- string.len(Oi)~=string.len(Ii)then term.write(string.rep(" ",Ni))end
- term.setBackgroundColor(colors[Ti])term.setCursorPos(xi,zi)term.setTextColor(colors[Ai])term.write(Ii)else
- term.setCursorPos(xi,zi)if string.len(Oi)~=string.len(Ii)then
- term.write(string.rep(" ",Ni))end
- term.setBackgroundColor(colors[Ei])term.setCursorPos(xi,zi)term.setTextColor(colors[Ai])term.write(Oi)end
- term.setTextColor(Ri)term.setBackgroundColor(Di)return(data2[qi])end end end
- function
- t.bundle(Li,Ui,Ci)if(type(Li)=="string")and(type(Ui)=="number")and(type(Ci)=="boolean")then
- if Ci==true then
- rs.setBundledOutput(Li,colors.combine(rs.getBundledOutput(Li),Ui))elseif
- Ci==false then
- rs.setBundledOutput(Li,colors.subtract(rs.getBundledOutput(Li),Ui))end else
- error("please use like this:\nbundle(side:string,colors.(color),state:boolean)")end
- end function t.signal(Mi,Fi,Wi,Yi)if Fi=="clear"then
- rs.setBundledOutput(Mi,0)else if Yi==true then if Fi=="on"then Fi=true end if
- Fi=="nil"then Fi=false end end if Fi~=nil then if Fi==true then
- bundle(Mi,Wi,true)elseif Fi==false then bundle(Mi,Wi,false)end end end end
- function t.sliderHor(Pi,Vi,Bi,Gi,Ki,Qi,Ji,Xi)if Pi=="db"then if data3==nil then
- return nil else return data3[Vi]end end if Pi=="setdb"then if data3==nil then
- return"no data to edit"else data3[Vi]=Bi
- return("value changed too "..type(Bi))end end if Vi[2]==Pi or Vi[2]=="tout"then
- if Vi~=nil then local Zi=term.getBackgroundColor()local
- en=term.getTextColor()term.setBackgroundColor(colors[Ji])term.setTextColor(colors[Xi])term.setCursorPos(Gi,Ki)for
- tn=0,Qi do term.write("-")term.setCursorPos(Gi+tn,Ki)end if data3==nil then
- data3={}for an=0,1000 do data3[an]=0 end end local
- on=(Vi[3])if(Vi[4]==Ki)and(Vi[3]>=Gi)and(Vi[3]<=(Gi+Qi)-1)then
- term.setCursorPos(on,Ki)data3[Bi]=on term.write("|")else
- term.setCursorPos(data3[Bi],Ki)term.write("|")end
- term.setBackgroundColor(Zi)term.setTextColor(en)if data3[Bi]-Gi>=0 then
- return(data3[Bi]-Gi)elseif data3[Bi]-Gi<0 then return 0 end end end end
- function t.sliderVer(nn,sn,hn,rn,dn,ln,un,cn)if nn=="db"then if data10==nil
- then return nil else return data10[sn]end end if nn=="setdb"then if data10==nil
- then return"no data to edit"else data10[sn]=hn
- return("value changed too "..type(hn))end end if sn[2]==nn or sn[2]=="tout"then
- if sn~=nil then local mn=term.getBackgroundColor()local
- fn=term.getTextColor()term.setBackgroundColor(colors[un])term.setTextColor(colors[cn])term.setCursorPos(rn,dn)for
- wn=0,ln do term.write("\124")term.setCursorPos(rn,dn-wn)end if data10==nil then
- data10={}for yn=0,1000 do data10[yn]=0 end end local
- pn=sn[4]if(sn[3]==rn)and(sn[4]<=dn)and(sn[4]>=(dn-ln)+1)then
- term.setCursorPos(rn,pn)data10[hn]=pn term.write("\xad")else
- term.setCursorPos(rn,data10[hn])term.write("\xad")end
- term.setBackgroundColor(mn)term.setTextColor(fn)if data10[hn]-rn>=0 then
- return(data10[hn]-rn)elseif data10[hn]-rn<0 then return 0 end end end end
- function t.render(vn,bn,gn,kn,qn)local jn=term.getBackgroundColor()local
- xn=term.getTextColor()local
- zn={term.getCursorPos()}term.setTextColor(colors[kn])if type(qn)=="string"then
- term.setBackgroundColor(colors[qn])elseif type(qn)=="number"then
- term.setBackgroundColor(qn)end
- term.setCursorPos(bn,gn)term.write(vn)term.setBackgroundColor(jn)term.setTextColor(xn)term.setCursorPos(zn[1],zn[2])end
- function t.menu(En,Tn,An,On,In,Nn,Sn,Hn,Rn,Dn,Ln)if Tn[2]==En or
- Tn[2]=="tout"then if thisIsUseless==nil then for Un=0,1000 do
- thisIsUseless={}thisIsUseless[Un]=false end end if not thisIsUseless[An]then
- t.render(Hn,On,In,Nn,oldcol2)end if Tn~=nil then local
- Cn=term.getTextColor()local Mn=term.getBackgroundColor()local
- Fn=string.len(Hn)if Tn[1]~="timeout"then if data4==nil then data4={}for
- Wn=0,1000 do data4[Wn]=false end end if data5==nil then data5={}for Yn=0,1000
- do data5[Yn]=false end end if data6==nil then data6={}for Pn=0,1000 do
- data6[Pn]=false end end if t.API(Tn,On,In,Fn,1)==true then data4[An]=Hn
- data5[An]=On data6[An]=In local function Vn()for Bn=1,500 do if
- data4[Bn]~=false then
- term.setBackgroundColor(Mn)term.setCursorPos(data5[Bn],data6[Bn])term.setTextColor(colors[Nn])term.write(data4[Bn])end
- end local Gn=0 end
- Vn()term.setCursorPos(data5[An],data6[An])term.setBackgroundColor(colors[Sn])term.setTextColor(colors[Nn])term.write(Hn)term.setTextColor(Cn)term.setBackgroundColor(Mn)menuout=Hn
- if Rn==nil then return menuout else if(Dn==nil)or(Dn==false)then menuout=Rn
- return menuout else menuout={Rn,Ln}if menuout==nil then return 0 end return
- menuout end end end end end end thisIsUseless[An]=true if Dn==true then if
- menuout==nil then menuout={Rn,"nil"}end end end function t.menudata()if
- menuout~=nil then return menuout else return"no output"end end function
- t.timeswitch(Kn,Qn,Jn,Xn,Zn,es,ts,as,is,ns,ss)if Kn=="db"then if data7==nil
- then return nil else return data7[Qn]end end if Kn=="setdb"then if data7==nil
- then return"no data to edit"else data7[Qn]=Jn
- return("value changed too "..type(Jn))end end if Qn[2]==Kn or Qn[2]=="tout"then
- if Qn~=nil then local hs=term.getTextColor()local
- ds=term.getBackgroundColor()term.setBackgroundColor(colors[is])term.setTextColor(colors[as])if
- data7==nil then data7={}for ls=0,1000 do data7[ls]=false end end if data8==nil
- then data8={}for us=0,1000 do data8[us]=false end end if data8[Jn]==false then
- data8[Jn]=ts term.setCursorPos(Xn+6,Zn)term.write(data8[Jn])end
- term.setCursorPos(Xn,Zn)term.write("start")if t.API(Qn,Xn,Zn,4,1)==true then
- data7[Jn]=true end if data7[Jn]==true then if data8[Jn]>0 then repeat
- timeOut=data8[Jn]term.setBackgroundColor(colors[ns])data8[Jn]=data8[Jn]-es
- term.setCursorPos(Xn+6,Zn)sleep(1)term.write(data8[Jn])until data8[Jn]==0
- return"ended"end end if ss==true then data8[Jn]=ts end
- term.setBackgroundColor(colors[is])term.setCursorPos(Xn+6,Zn)term.write(data8[Jn])term.setTextColor(hs)term.setBackgroundColor(ds)end
- end end function
- t.bar(cs,ms,fs,ws,ys,ps,vs,bs,gs,ks,qs,js,xs,zs,Es)if(ys==nil)or(ys<0)then ys=0
- end if xs==nil then local xs=false end if ys~=nil then
- oldcol=term.getBackgroundColor()oldcol1=term.getTextColor()term.setTextColor(colors[gs])local
- function
- Ts()term.setBackgroundColor(colors[vs])t.fill(cs-1,ms-ws,fs,ws*2)term.setBackgroundColor(oldcol)xm=term.getBackgroundColor()xb=term.getTextColor()term.setTextColor(xm)term.setBackgroundColor(xb)term.setCursorPos(cs-1,ms-ws)if
- Es then term.setBackgroundColor(colors[gs])end if Es then
- term.write(string.rep("\x83",fs+1))term.setTextColor(xb)term.setBackgroundColor(xm)else
- term.write("\159"..string.rep("\143",fs-1))term.setTextColor(xb)term.setBackgroundColor(xm)term.write("\144")end
- if Es then term.setBackgroundColor(colors[gs])end
- term.setCursorPos(cs-1,ms+ws)if Es then term.write(string.rep("\x8c",fs+1))else
- term.write("\130"..string.rep("\131",fs-1).."\129")end for As=0,(ws*2)-2 do if
- not Es then term.setTextColor(xm)term.setBackgroundColor(xb)end
- term.setCursorPos(cs-1,(ms+As)-(ws)+1)if Es then
- term.setBackgroundColor(colors[gs])end
- term.write("\x95")term.setCursorPos((cs-2)+(fs+1),(ms+As)-(ws)+1)if not Es then
- term.setTextColor(xb)term.setBackgroundColor(xm)end term.write("\x95")end end
- if zs~=false then Ts()else t.fill(cs-1,ms-ws,fs,ws*2)end local Os=ys/ps*fs
- local Is=ys/ps*ws local Ns=math.ceil(Is)local Ss=(Ns*2)-2 local Hs=ms+ws
- term.setBackgroundColor(colors[bs])if(qs==false)or(qs==nil)then
- t.fill(cs,(ms-ws)+1,Os-1,(ws*2)-1)else t.fill(cs,(Hs-1)-Ss,fs-1,Ss+1)end if
- ks==true then term.setCursorPos(cs,ms)term.setTextColor(colors[gs])if qs==true
- then if xs then if ys>=ps/2 then term.setBackgroundColor(colors[bs])else
- term.setBackgroundColor(colors[vs])end else if ys>=(ps/2)-(ps/ws)then
- term.setBackgroundColor(colors[bs])else term.setBackgroundColor(colors[vs])end
- end elseif qs==false then
- term.setCursorPos(cs,ms)term.setTextColor(colors[gs])if qs==true then if ys>=1
- then term.setBackgroundColor(colors[bs])else
- term.setBackgroundColor(colors[vs])end end end if xs then
- term.write(ys.."/"..ps)term.setCursorPos(cs,ms+1)term.write(js)else
- term.write(ys.."/"..ps.." "..js)end
- term.setBackgroundColor(oldcol)term.setTextColor(oldcol1)end
- term.setTextColor(oldcol1)term.setBackgroundColor(oldcol)end end function
- t.frame(Rs,Ds,Ls,Us,Cs,Ms,Fs)local Ws=term.getBackgroundColor()local
- Ys=term.getTextColor()term.setBackgroundColor(colors[Ms])t.fill(Rs-1,Ds-Us,Ls,Us*2)term.setBackgroundColor(Ws)xm=term.getBackgroundColor()xb=term.getTextColor()term.setTextColor(xm)term.setBackgroundColor(xb)term.setCursorPos(Rs-1,Ds-Us)if
- Fs then
- term.setBackgroundColor(colors[Cs])term.setTextColor(Ws)term.write(string.rep("\x83",Ls+1))term.setTextColor(xb)term.setBackgroundColor(xm)else
- term.setTextColor(Ws)term.setBackgroundColor(colors[Cs])term.write("\159"..string.rep("\143",Ls-1))term.setTextColor(colors[Cs])term.setBackgroundColor(Ws)term.write("\144")end
- term.setCursorPos(Rs-1,Ds+Us)if Fs then
- term.setBackgroundColor(Ws)term.setTextColor(colors[Cs])term.write(string.rep("\x8f",Ls+1))term.setBackgroundColor(colors[Ms])term.setTextColor(colors[Cs])else
- term.write("\130"..string.rep("\131",Ls-1).."\129")end for Ps=0,(Us*2)-2 do if
- not Fs then term.setTextColor(xm)term.setBackgroundColor(xb)end
- term.setCursorPos(Rs-1,(Ds+Ps)-(Us)+1)if Fs then
- term.setBackgroundColor(colors[Cs])end
- term.setBackgroundColor(colors[Cs])term.write("\x95")term.setCursorPos((Rs-2)+(Ls+1),(Ds+Ps)-(Us)+1)if
- not Fs then term.setTextColor(xb)term.setBackgroundColor(xm)end
- term.setTextColor(colors[Cs])term.write("\x95")end
- term.setBackgroundColor(Ws)term.setTextColor(Ys)end
- return{monitor=e,terminal=t}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement