Advertisement
9551

Untitled

Jul 2nd, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.02 KB | None | 0 0
  1. local e={}local t={}function e.API(a,o,i,n,s)if a==true then
  2. a={os.pullEvent("monitor_touch")}end if a[3]>=o and a[3]<=o+n-1 then if a[4]>=i
  3. and a[4]<=i+s-1 then return true else return false end end end function
  4. e.touch()local h={os.pullEvent("monitor_touch")}return h end function
  5. e.timetouch(r,d)local l=os.startTimer(r)while true do local
  6. u={os.pullEvent()}if(u[1]=="timer")and(u[2]==l)then if d==nil then local
  7. d="timeout"end
  8. return{"timeout",d,1000,1000}elseif(u[1]=="monitor_touch")and(u[2]==d)then
  9. return{u[1],u[2],u[3],u[4]}end end end function e.button(c,f,w,y,p)if f[2]==c
  10. then if f~=nil then
  11. m=peripheral.wrap(c)x=e.API(f,w,y,string.len(p),1)m.setCursorPos(w,y)m.write(p)return
  12. x end end end function e.counter(v,b,g,k,q,j,z,E,T)if v=="db"then if data==nil
  13. then return nil else return data[b]end end if v=="setdb"then if data==nil then
  14. return"no data to edit"else data[b]=g return("value changed too "..type(g))end
  15. end if b[2]==v then if b~=nil then local A=peripheral.wrap(v)if data==nil then
  16. data={}for O=0,1000 do data[O]=0 end end
  17. A.setCursorPos(k,q)A.write("\24".." "..data[g])A.setCursorPos(k,q+1)A.write("\25")if
  18. e.API(b,k,q,1,1)==true then if data[g]<z then data[g]=data[g]+j
  19. 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
  20. data[g]end end end if e.API(b,k,q+1,1,1)==true then if data[g]>E then
  21. data[g]=data[g]-j
  22. 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
  23. data[g]end end end end function e.fill(I,N,S,H,R)local D=peripheral.wrap(I)for
  24. L=0,R-1 do D.setCursorPos(N,S+L)D.write(string.rep(" ",H))end end function
  25. e.switch(U,C,M,F,W,Y,P,V,B)if U=="db"then if data1==nil then return nil else
  26. return data1[C]end end if U=="setdb"then if data1==nil then
  27. return"no data to edit"else data1[C]=M return("value changed too "..type(M))end
  28. end if M[2]==U then if M~=nil then local G=string.len(B)local
  29. K=peripheral.wrap(U)if data1==nil then data1={}for Q=0,1000 do data1[Q]=false
  30. end end local function J()data1[C]=not data1[C]end if
  31. e.API(M,F,W,string.len(B),1)==true then J()end local X=K.getTextColor()local
  32. Z=K.getBackgroundColor()if data1[C]==true then
  33. K.setBackgroundColor(colors[P])else K.setBackgroundColor(colors[Y])end
  34. K.setCursorPos(F,W)K.setTextColor(colors[V])K.write(B)K.setTextColor(X)K.setBackgroundColor(Z)return(data1[C])end
  35. end end function e.switchn(et,tt,at,ot,it,nt,st,ht,rt,dt)if et=="db"then if
  36. data2==nil then return nil else return data2[tt]end end if et=="setdb"then if
  37. data2==nil then return"no data to edit"else data2[tt]=at
  38. return("value changed too "..type(at))end end if at[2]==et then if at~=nil then
  39. local lt=string.len(rt)if string.len(rt)~=string.len(dt)then if
  40. string.len(rt)>string.len(dt)then lt=string.len(rt)else lt=string.len(dt)end
  41. end local ut=peripheral.wrap(et)if data2==nil then data2={}for ct=0,1000 do
  42. data2[ct]=false end end local function mt()data2[tt]=not data2[tt]end if
  43. e.API(at,ot,it,lt,1)==true then mt()end local ft=ut.getTextColor()local
  44. wt=ut.getBackgroundColor()if data2[tt]==true then ut.setCursorPos(ot,it)if
  45. string.len(rt)~=string.len(dt)then ut.write(string.rep(" ",lt))end
  46. ut.setBackgroundColor(colors[st])ut.setCursorPos(ot,it)ut.setTextColor(colors[ht])ut.write(dt)else
  47. ut.setCursorPos(ot,it)if string.len(rt)~=string.len(dt)then
  48. ut.write(string.rep(" ",lt))end
  49. ut.setBackgroundColor(colors[nt])ut.setCursorPos(ot,it)ut.setTextColor(colors[ht])ut.write(rt)end
  50. ut.setTextColor(ft)ut.setBackgroundColor(wt)return(data2[tt])end end end
  51. function
  52. e.bundle(yt,pt,vt)if(type(yt)=="string")and(type(pt)=="number")and(type(vt)=="boolean")then
  53. if vt==true then
  54. rs.setBundledOutput(yt,colors.combine(rs.getBundledOutput(yt),pt))elseif
  55. vt==false then
  56. rs.setBundledOutput(yt,colors.subtract(rs.getBundledOutput(yt),pt))end else
  57. error("please use like this:\nbundle(side:string,colors.(color),state:boolean)")end
  58. end function e.signal(bt,gt,kt,qt)if gt=="clear"then
  59. rs.setBundledOutput(bt,0)else if qt==true then if gt=="on"then gt=true end if
  60. gt=="nil"then gt=false end end if gt~=nil then if gt==true then
  61. bundle(bt,kt,true)elseif gt==false then bundle(bt,kt,false)end end end end
  62. function e.sliderHor(jt,xt,zt,Et,Tt,At,Ot,It)if jt=="db"then if data3==nil then
  63. return nil else return data3[xt]end end if jt=="setdb"then if data3==nil then
  64. return"no data to edit"else data3[xt]=zt
  65. return("value changed too "..type(zt))end end if xt[2]==jt then if xt~=nil then
  66. m=peripheral.wrap(jt)local Nt=m.getBackgroundColor()local
  67. St=m.getTextColor()m.setBackgroundColor(colors[Ot])m.setTextColor(colors[It])m.setCursorPos(Et,Tt)for
  68. Ht=0,At do m.write("-")m.setCursorPos(Et+Ht,Tt)end if data3==nil then
  69. data3={}for Rt=0,1000 do data3[Rt]=0 end end local
  70. Dt=(xt[3])if(xt[4]==Tt)and(xt[3]>=Et)and(xt[3]<=(Et+At)-1)then
  71. m.setCursorPos(Dt,Tt)data3[zt]=Dt m.write("|")else
  72. m.setCursorPos(data3[zt],Tt)m.write("|")end
  73. m.setBackgroundColor(Nt)m.setTextColor(St)if data3[zt]-Et>=0 then
  74. return(data3[zt]-Et)elseif data3[zt]-Et<0 then return 0 end end end end
  75. function e.sliderVer(Lt,Ut,Ct,Mt,Ft,Wt,Yt,Pt)if Lt=="db"then if data10==nil
  76. then return nil else return data10[Ut]end end if Lt=="setdb"then if data10==nil
  77. then return"no data to edit"else data10[Ut]=Ct
  78. return("value changed too "..type(Ct))end end if Ut[2]==Lt then if Ut~=nil then
  79. m=peripheral.wrap(Lt)local Vt=m.getBackgroundColor()local
  80. Bt=m.getTextColor()m.setBackgroundColor(colors[Yt])m.setTextColor(colors[Pt])m.setCursorPos(Mt,Ft)for
  81. Gt=0,Wt do m.write("\124")m.setCursorPos(Mt,Ft-Gt)end if data10==nil then
  82. data10={}for Kt=0,1000 do data10[Kt]=0 end end local
  83. Qt=Ut[4]if(Ut[3]==Mt)and(Ut[4]<=Ft)and(Ut[4]>=(Ft-Wt)+1)then
  84. m.setCursorPos(Mt,Qt)data10[Ct]=Qt m.write("\xad")else
  85. m.setCursorPos(Mt,data10[Ct])m.write("\xad")end
  86. m.setBackgroundColor(Vt)m.setTextColor(Bt)if data10[Ct]-Mt>=0 then
  87. return(data10[Ct]-Mt)elseif data10[Ct]-Mt<0 then return 0 end end end end
  88. function e.render(Jt,Xt,Zt,ea,ta,aa)local oa=peripheral.wrap(Jt)local
  89. ia=oa.getBackgroundColor()local na=oa.getTextColor()local
  90. sa={oa.getCursorPos()}oa.setTextColor(colors[ta])if type(aa)=="string"then
  91. oa.setBackgroundColor(colors[aa])elseif type(aa)=="number"then
  92. oa.setBackgroundColor(aa)end
  93. oa.setCursorPos(Zt,ea)oa.write(Xt)oa.setBackgroundColor(ia)oa.setTextColor(na)oa.setCursorPos(sa[1],sa[2])end
  94. function e.menu(ha,ra,da,la,ua,ca,ma,fa,wa,ya,pa)if ra[2]==ha then if
  95. thisIsUseless==nil then for va=0,1000 do
  96. thisIsUseless={}thisIsUseless[va]=false end end if not thisIsUseless[da]then
  97. e.render(ha,fa,la,ua,ca,oldcol2)end if ra~=nil then local
  98. ba=peripheral.wrap(ha)local ga=ba.getTextColor()local
  99. ka=ba.getBackgroundColor()local qa=string.len(fa)if ra[1]~="timeout"then if
  100. data4==nil then data4={}for ja=0,1000 do data4[ja]=false end end if data5==nil
  101. then data5={}for xa=0,1000 do data5[xa]=false end end if data6==nil then
  102. data6={}for za=0,1000 do data6[za]=false end end if e.API(ra,la,ua,qa,1)==true
  103. then data4[da]=fa data5[da]=la data6[da]=ua local function Ea()for Ta=1,500 do
  104. if data4[Ta]~=false then
  105. ba.setBackgroundColor(ka)ba.setCursorPos(data5[Ta],data6[Ta])ba.setTextColor(colors[ca])ba.write(data4[Ta])end
  106. end local Aa=0 end
  107. 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
  108. if wa==nil then return menuout else if(ya==nil)or(ya==false)then menuout=wa
  109. return menuout else menuout={wa,pa}if menuout==nil then return 0 end return
  110. menuout end end end end end end thisIsUseless[da]=true if ya==true then if
  111. menuout==nil then menuout={wa,"nil"}end end end function e.menudata()if
  112. menuout~=nil then return menuout else return"no output"end end function
  113. e.timeswitch(Oa,Ia,Na,Sa,Ha,Ra,Da,La,Ua,Ca,Ma)if Oa=="db"then if data7==nil
  114. then return nil else return data7[Ia]end end if Oa=="setdb"then if data7==nil
  115. then return"no data to edit"else data7[Ia]=Na
  116. return("value changed too "..type(Na))end end if Ia[2]==Oa then if Ia~=nil then
  117. local Fa=peripheral.wrap(Oa)local Wa=Fa.getTextColor()local
  118. Ya=Fa.getBackgroundColor()Fa.setBackgroundColor(colors[Ua])Fa.setTextColor(colors[La])if
  119. data7==nil then data7={}for Pa=0,1000 do data7[Pa]=false end end if data8==nil
  120. then data8={}for Va=0,1000 do data8[Va]=false end end if data8[Na]==false then
  121. data8[Na]=Da Fa.setCursorPos(Sa+6,Ha)Fa.write(data8[Na])end
  122. Fa.setCursorPos(Sa,Ha)Fa.write("start")if e.API(Ia,Sa,Ha,4,1)==true then
  123. data7[Na]=true end if data7[Na]==true then if data8[Na]>0 then repeat
  124. timeOut=data8[Na]Fa.setBackgroundColor(colors[Ca])data8[Na]=data8[Na]-Ra
  125. Fa.setCursorPos(Sa+6,Ha)sleep(1)Fa.write(data8[Na])until data8[Na]==0
  126. return"ended"end end if Ma==true then data8[Na]=Da end
  127. Fa.setBackgroundColor(colors[Ua])Fa.setCursorPos(Sa+6,Ha)Fa.write(data8[Na])Fa.setTextColor(Wa)Fa.setBackgroundColor(Ya)end
  128. end end function
  129. 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
  130. Xa=0 end if so==nil then local so=false end if Xa~=nil then local
  131. lo=peripheral.wrap(Ba)oldcol=lo.getBackgroundColor()oldcol1=lo.getTextColor()lo.setTextColor(colors[ao])local
  132. function
  133. 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
  134. ro then lo.setBackgroundColor(colors[ao])end if ro then
  135. lo.write(string.rep("\x83",Qa+1))lo.setTextColor(xb)lo.setBackgroundColor(xm)else
  136. lo.write("\159"..string.rep("\143",Qa-1))lo.setTextColor(xb)lo.setBackgroundColor(xm)lo.write("\144")end
  137. if ro then lo.setBackgroundColor(colors[ao])end lo.setCursorPos(Ga-1,Ka+Ja)if
  138. ro then lo.write(string.rep("\x8c",Qa+1))else
  139. lo.write("\130"..string.rep("\131",Qa-1).."\129")end for co=0,(Ja*2)-2 do if
  140. not ro then lo.setTextColor(xm)lo.setBackgroundColor(xb)end
  141. lo.setCursorPos(Ga-1,(Ka+co)-(Ja)+1)if ro then
  142. lo.setBackgroundColor(colors[ao])end
  143. lo.write("\x95")lo.setCursorPos((Ga-2)+(Qa+1),(Ka+co)-(Ja)+1)if not ro then
  144. lo.setTextColor(xb)lo.setBackgroundColor(xm)end lo.write("\x95")end end if
  145. ho~=false then uo()else e.fill(Ba,Ga-1,Ka-Ja,Qa,Ja*2)end local mo=Xa/Za*Qa
  146. local fo=Xa/Za*Ja local wo=math.ceil(fo)local yo=(wo*2)-2 local po=Ka+Ja
  147. lo.setBackgroundColor(colors[to])if(io==false)or(io==nil)then
  148. 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
  149. if oo==true then lo.setCursorPos(Ga,Ka)lo.setTextColor(colors[ao])if io==true
  150. then if so then if Xa>=Za/2 then lo.setBackgroundColor(colors[to])else
  151. lo.setBackgroundColor(colors[eo])end else if Xa>=(Za/2)-(Za/Ja)then
  152. lo.setBackgroundColor(colors[to])else lo.setBackgroundColor(colors[eo])end end
  153. elseif io==false then lo.setCursorPos(Ga,Ka)lo.setTextColor(colors[ao])if
  154. io==true then if Xa>=1 then lo.setBackgroundColor(colors[to])else
  155. lo.setBackgroundColor(colors[eo])end end end if so then
  156. lo.write(Xa.."/"..Za)lo.setCursorPos(Ga,Ka+1)lo.write(no)else
  157. lo.write(Xa.."/"..Za.." "..no)end
  158. lo.setBackgroundColor(oldcol)lo.setTextColor(oldcol1)end
  159. lo.setTextColor(oldcol1)lo.setBackgroundColor(oldcol)end end function
  160. e.frame(vo,bo,go,ko,qo,jo,xo,zo)local Eo=peripheral.wrap(vo)local
  161. To=Eo.getBackgroundColor()local
  162. 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
  163. zo then
  164. Eo.setBackgroundColor(colors[jo])Eo.setTextColor(To)Eo.write(string.rep("\x83",ko+1))Eo.setTextColor(xb)Eo.setBackgroundColor(xm)else
  165. 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
  166. Eo.setCursorPos(bo-1,go+qo)if zo then
  167. Eo.setBackgroundColor(To)Eo.setTextColor(colors[jo])Eo.write(string.rep("\x8f",ko+1))Eo.setBackgroundColor(colors[xo])Eo.setTextColor(colors[jo])else
  168. Eo.write("\130"..string.rep("\131",ko-1).."\129")end for Oo=0,(qo*2)-2 do if
  169. not zo then Eo.setTextColor(xm)Eo.setBackgroundColor(xb)end
  170. Eo.setCursorPos(bo-1,(go+Oo)-(qo)+1)if zo then
  171. Eo.setBackgroundColor(colors[jo])end
  172. Eo.setBackgroundColor(colors[jo])Eo.write("\x95")Eo.setCursorPos((bo-2)+(ko+1),(go+Oo)-(qo)+1)if
  173. not zo then Eo.setTextColor(xb)Eo.setBackgroundColor(xm)end
  174. Eo.setTextColor(colors[jo])Eo.write("\x95")end
  175. Eo.setBackgroundColor(To)Eo.setTextColor(Ao)end function
  176. t.API(Io,No,So,Ho,Ro)if Io==true then Io={os.pullEvent("mouse_click")}end if
  177. Io[3]>=No and Io[3]<=No+Ho-1 then if Io[4]>=So and Io[4]<=So+Ro-1 then return
  178. true else return false end end end function t.touch()local
  179. Do={os.pullEvent("mouse_click")}return Do end function t.timetouch(Lo)local
  180. Uo=os.startTimer(Lo)while true do local
  181. Co={os.pullEvent()}if(Co[1]=="timer")and(Co[2]==Uo)then
  182. return{"timeout","tout",1000,1000}elseif(Co[1]=="mouse_click")then
  183. return{Co[1],Co[2],Co[3],Co[4]}end end end function t.button(Mo,Fo,Wo,Yo,Po)if
  184. Fo[2]==Mo or Fo[2]=="tout"then if Fo~=nil then
  185. x=t.API(Fo,Wo,Yo,string.len(Po),1)term.setCursorPos(Wo,Yo)term.write(Po)return
  186. x end end end function t.counter(Vo,Bo,Go,Ko,Qo,Jo,Xo,Zo,ei)if Vo=="db"then if
  187. data==nil then return nil else return data[Bo]end end if Vo=="setdb"then if
  188. data==nil then return"no data to edit"else data[Bo]=Go
  189. return("value changed too "..type(Go))end end if Bo[2]==Vo or Bo[2]=="tout"then
  190. if Bo~=nil then if data==nil then data={}for ti=0,1000 do data[ti]=0 end end
  191. term.setCursorPos(Ko,Qo)term.write("\24".." "..data[Go])term.setCursorPos(Ko,Qo+1)term.write("\25")if
  192. t.API(Bo,Ko,Qo,1,1)==true then if data[Go]<Xo then data[Go]=data[Go]+Jo
  193. 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
  194. data[Go]end end end if t.API(Bo,Ko,Qo+1,1,1)==true then if data[Go]>Zo then
  195. data[Go]=data[Go]-Jo
  196. 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
  197. data[Go]end end end end function t.fill(ai,oi,ii,ni)for si=0,ni-1 do
  198. term.setCursorPos(ai,oi+si)term.write(string.rep(" ",ii))end end function
  199. t.switch(hi,ri,di,li,ui,ci,mi,fi,wi)if hi=="db"then if data1==nil then return
  200. nil else return data1[ri]end end if hi=="setdb"then if data1==nil then
  201. return"no data to edit"else data1[ri]=di
  202. return("value changed too "..type(di))end end if di[2]==hi or di[2]=="tout"then
  203. if di~=nil then local yi=string.len(wi)if data1==nil then data1={}for pi=0,1000
  204. do data1[pi]=false end end local function vi()data1[ri]=not data1[ri]end if
  205. t.API(di,li,ui,string.len(wi),1)==true then vi()end local
  206. bi=term.getTextColor()local gi=term.getBackgroundColor()if data1[ri]==true then
  207. term.setBackgroundColor(colors[mi])else term.setBackgroundColor(colors[ci])end
  208. term.setCursorPos(li,ui)term.setTextColor(colors[fi])term.write(wi)term.setTextColor(bi)term.setBackgroundColor(gi)return(data1[ri])end
  209. end end function t.switchn(ki,qi,ji,xi,zi,Ei,Ti,Ai,Oi,Ii)if ki=="db"then if
  210. data2==nil then return nil else return data2[qi]end end if ki=="setdb"then if
  211. data2==nil then return"no data to edit"else data2[qi]=ji
  212. return("value changed too "..type(ji))end end if ji[2]==ki or ji[2]=="tout"then
  213. if ji~=nil then local Ni=string.len(Oi)if string.len(Oi)~=string.len(Ii)then if
  214. string.len(Oi)>string.len(Ii)then Ni=string.len(Oi)else Ni=string.len(Ii)end
  215. end if data2==nil then data2={}for Si=0,1000 do data2[Si]=false end end local
  216. function Hi()data2[qi]=not data2[qi]end if t.API(ji,xi,zi,Ni,1)==true then
  217. Hi()end local Ri=term.getTextColor()local Di=term.getBackgroundColor()if
  218. data2[qi]==true then term.setCursorPos(xi,zi)if
  219. string.len(Oi)~=string.len(Ii)then term.write(string.rep(" ",Ni))end
  220. term.setBackgroundColor(colors[Ti])term.setCursorPos(xi,zi)term.setTextColor(colors[Ai])term.write(Ii)else
  221. term.setCursorPos(xi,zi)if string.len(Oi)~=string.len(Ii)then
  222. term.write(string.rep(" ",Ni))end
  223. term.setBackgroundColor(colors[Ei])term.setCursorPos(xi,zi)term.setTextColor(colors[Ai])term.write(Oi)end
  224. term.setTextColor(Ri)term.setBackgroundColor(Di)return(data2[qi])end end end
  225. function
  226. t.bundle(Li,Ui,Ci)if(type(Li)=="string")and(type(Ui)=="number")and(type(Ci)=="boolean")then
  227. if Ci==true then
  228. rs.setBundledOutput(Li,colors.combine(rs.getBundledOutput(Li),Ui))elseif
  229. Ci==false then
  230. rs.setBundledOutput(Li,colors.subtract(rs.getBundledOutput(Li),Ui))end else
  231. error("please use like this:\nbundle(side:string,colors.(color),state:boolean)")end
  232. end function t.signal(Mi,Fi,Wi,Yi)if Fi=="clear"then
  233. rs.setBundledOutput(Mi,0)else if Yi==true then if Fi=="on"then Fi=true end if
  234. Fi=="nil"then Fi=false end end if Fi~=nil then if Fi==true then
  235. bundle(Mi,Wi,true)elseif Fi==false then bundle(Mi,Wi,false)end end end end
  236. function t.sliderHor(Pi,Vi,Bi,Gi,Ki,Qi,Ji,Xi)if Pi=="db"then if data3==nil then
  237. return nil else return data3[Vi]end end if Pi=="setdb"then if data3==nil then
  238. return"no data to edit"else data3[Vi]=Bi
  239. return("value changed too "..type(Bi))end end if Vi[2]==Pi or Vi[2]=="tout"then
  240. if Vi~=nil then local Zi=term.getBackgroundColor()local
  241. en=term.getTextColor()term.setBackgroundColor(colors[Ji])term.setTextColor(colors[Xi])term.setCursorPos(Gi,Ki)for
  242. tn=0,Qi do term.write("-")term.setCursorPos(Gi+tn,Ki)end if data3==nil then
  243. data3={}for an=0,1000 do data3[an]=0 end end local
  244. on=(Vi[3])if(Vi[4]==Ki)and(Vi[3]>=Gi)and(Vi[3]<=(Gi+Qi)-1)then
  245. term.setCursorPos(on,Ki)data3[Bi]=on term.write("|")else
  246. term.setCursorPos(data3[Bi],Ki)term.write("|")end
  247. term.setBackgroundColor(Zi)term.setTextColor(en)if data3[Bi]-Gi>=0 then
  248. return(data3[Bi]-Gi)elseif data3[Bi]-Gi<0 then return 0 end end end end
  249. function t.sliderVer(nn,sn,hn,rn,dn,ln,un,cn)if nn=="db"then if data10==nil
  250. then return nil else return data10[sn]end end if nn=="setdb"then if data10==nil
  251. then return"no data to edit"else data10[sn]=hn
  252. return("value changed too "..type(hn))end end if sn[2]==nn or sn[2]=="tout"then
  253. if sn~=nil then local mn=term.getBackgroundColor()local
  254. fn=term.getTextColor()term.setBackgroundColor(colors[un])term.setTextColor(colors[cn])term.setCursorPos(rn,dn)for
  255. wn=0,ln do term.write("\124")term.setCursorPos(rn,dn-wn)end if data10==nil then
  256. data10={}for yn=0,1000 do data10[yn]=0 end end local
  257. pn=sn[4]if(sn[3]==rn)and(sn[4]<=dn)and(sn[4]>=(dn-ln)+1)then
  258. term.setCursorPos(rn,pn)data10[hn]=pn term.write("\xad")else
  259. term.setCursorPos(rn,data10[hn])term.write("\xad")end
  260. term.setBackgroundColor(mn)term.setTextColor(fn)if data10[hn]-rn>=0 then
  261. return(data10[hn]-rn)elseif data10[hn]-rn<0 then return 0 end end end end
  262. function t.render(vn,bn,gn,kn,qn)local jn=term.getBackgroundColor()local
  263. xn=term.getTextColor()local
  264. zn={term.getCursorPos()}term.setTextColor(colors[kn])if type(qn)=="string"then
  265. term.setBackgroundColor(colors[qn])elseif type(qn)=="number"then
  266. term.setBackgroundColor(qn)end
  267. term.setCursorPos(bn,gn)term.write(vn)term.setBackgroundColor(jn)term.setTextColor(xn)term.setCursorPos(zn[1],zn[2])end
  268. function t.menu(En,Tn,An,On,In,Nn,Sn,Hn,Rn,Dn,Ln)if Tn[2]==En or
  269. Tn[2]=="tout"then if thisIsUseless==nil then for Un=0,1000 do
  270. thisIsUseless={}thisIsUseless[Un]=false end end if not thisIsUseless[An]then
  271. t.render(Hn,On,In,Nn,oldcol2)end if Tn~=nil then local
  272. Cn=term.getTextColor()local Mn=term.getBackgroundColor()local
  273. Fn=string.len(Hn)if Tn[1]~="timeout"then if data4==nil then data4={}for
  274. Wn=0,1000 do data4[Wn]=false end end if data5==nil then data5={}for Yn=0,1000
  275. do data5[Yn]=false end end if data6==nil then data6={}for Pn=0,1000 do
  276. data6[Pn]=false end end if t.API(Tn,On,In,Fn,1)==true then data4[An]=Hn
  277. data5[An]=On data6[An]=In local function Vn()for Bn=1,500 do if
  278. data4[Bn]~=false then
  279. term.setBackgroundColor(Mn)term.setCursorPos(data5[Bn],data6[Bn])term.setTextColor(colors[Nn])term.write(data4[Bn])end
  280. end local Gn=0 end
  281. 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
  282. if Rn==nil then return menuout else if(Dn==nil)or(Dn==false)then menuout=Rn
  283. return menuout else menuout={Rn,Ln}if menuout==nil then return 0 end return
  284. menuout end end end end end end thisIsUseless[An]=true if Dn==true then if
  285. menuout==nil then menuout={Rn,"nil"}end end end function t.menudata()if
  286. menuout~=nil then return menuout else return"no output"end end function
  287. t.timeswitch(Kn,Qn,Jn,Xn,Zn,es,ts,as,is,ns,ss)if Kn=="db"then if data7==nil
  288. then return nil else return data7[Qn]end end if Kn=="setdb"then if data7==nil
  289. then return"no data to edit"else data7[Qn]=Jn
  290. return("value changed too "..type(Jn))end end if Qn[2]==Kn or Qn[2]=="tout"then
  291. if Qn~=nil then local hs=term.getTextColor()local
  292. ds=term.getBackgroundColor()term.setBackgroundColor(colors[is])term.setTextColor(colors[as])if
  293. data7==nil then data7={}for ls=0,1000 do data7[ls]=false end end if data8==nil
  294. then data8={}for us=0,1000 do data8[us]=false end end if data8[Jn]==false then
  295. data8[Jn]=ts term.setCursorPos(Xn+6,Zn)term.write(data8[Jn])end
  296. term.setCursorPos(Xn,Zn)term.write("start")if t.API(Qn,Xn,Zn,4,1)==true then
  297. data7[Jn]=true end if data7[Jn]==true then if data8[Jn]>0 then repeat
  298. timeOut=data8[Jn]term.setBackgroundColor(colors[ns])data8[Jn]=data8[Jn]-es
  299. term.setCursorPos(Xn+6,Zn)sleep(1)term.write(data8[Jn])until data8[Jn]==0
  300. return"ended"end end if ss==true then data8[Jn]=ts end
  301. term.setBackgroundColor(colors[is])term.setCursorPos(Xn+6,Zn)term.write(data8[Jn])term.setTextColor(hs)term.setBackgroundColor(ds)end
  302. end end function
  303. 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
  304. end if xs==nil then local xs=false end if ys~=nil then
  305. oldcol=term.getBackgroundColor()oldcol1=term.getTextColor()term.setTextColor(colors[gs])local
  306. function
  307. 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
  308. Es then term.setBackgroundColor(colors[gs])end if Es then
  309. term.write(string.rep("\x83",fs+1))term.setTextColor(xb)term.setBackgroundColor(xm)else
  310. term.write("\159"..string.rep("\143",fs-1))term.setTextColor(xb)term.setBackgroundColor(xm)term.write("\144")end
  311. if Es then term.setBackgroundColor(colors[gs])end
  312. term.setCursorPos(cs-1,ms+ws)if Es then term.write(string.rep("\x8c",fs+1))else
  313. term.write("\130"..string.rep("\131",fs-1).."\129")end for As=0,(ws*2)-2 do if
  314. not Es then term.setTextColor(xm)term.setBackgroundColor(xb)end
  315. term.setCursorPos(cs-1,(ms+As)-(ws)+1)if Es then
  316. term.setBackgroundColor(colors[gs])end
  317. term.write("\x95")term.setCursorPos((cs-2)+(fs+1),(ms+As)-(ws)+1)if not Es then
  318. term.setTextColor(xb)term.setBackgroundColor(xm)end term.write("\x95")end end
  319. if zs~=false then Ts()else t.fill(cs-1,ms-ws,fs,ws*2)end local Os=ys/ps*fs
  320. local Is=ys/ps*ws local Ns=math.ceil(Is)local Ss=(Ns*2)-2 local Hs=ms+ws
  321. term.setBackgroundColor(colors[bs])if(qs==false)or(qs==nil)then
  322. t.fill(cs,(ms-ws)+1,Os-1,(ws*2)-1)else t.fill(cs,(Hs-1)-Ss,fs-1,Ss+1)end if
  323. ks==true then term.setCursorPos(cs,ms)term.setTextColor(colors[gs])if qs==true
  324. then if xs then if ys>=ps/2 then term.setBackgroundColor(colors[bs])else
  325. term.setBackgroundColor(colors[vs])end else if ys>=(ps/2)-(ps/ws)then
  326. term.setBackgroundColor(colors[bs])else term.setBackgroundColor(colors[vs])end
  327. end elseif qs==false then
  328. term.setCursorPos(cs,ms)term.setTextColor(colors[gs])if qs==true then if ys>=1
  329. then term.setBackgroundColor(colors[bs])else
  330. term.setBackgroundColor(colors[vs])end end end if xs then
  331. term.write(ys.."/"..ps)term.setCursorPos(cs,ms+1)term.write(js)else
  332. term.write(ys.."/"..ps.." "..js)end
  333. term.setBackgroundColor(oldcol)term.setTextColor(oldcol1)end
  334. term.setTextColor(oldcol1)term.setBackgroundColor(oldcol)end end function
  335. t.frame(Rs,Ds,Ls,Us,Cs,Ms,Fs)local Ws=term.getBackgroundColor()local
  336. 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
  337. Fs then
  338. term.setBackgroundColor(colors[Cs])term.setTextColor(Ws)term.write(string.rep("\x83",Ls+1))term.setTextColor(xb)term.setBackgroundColor(xm)else
  339. 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
  340. term.setCursorPos(Rs-1,Ds+Us)if Fs then
  341. term.setBackgroundColor(Ws)term.setTextColor(colors[Cs])term.write(string.rep("\x8f",Ls+1))term.setBackgroundColor(colors[Ms])term.setTextColor(colors[Cs])else
  342. term.write("\130"..string.rep("\131",Ls-1).."\129")end for Ps=0,(Us*2)-2 do if
  343. not Fs then term.setTextColor(xm)term.setBackgroundColor(xb)end
  344. term.setCursorPos(Rs-1,(Ds+Ps)-(Us)+1)if Fs then
  345. term.setBackgroundColor(colors[Cs])end
  346. term.setBackgroundColor(colors[Cs])term.write("\x95")term.setCursorPos((Rs-2)+(Ls+1),(Ds+Ps)-(Us)+1)if
  347. not Fs then term.setTextColor(xb)term.setBackgroundColor(xm)end
  348. term.setTextColor(colors[Cs])term.write("\x95")end
  349. term.setBackgroundColor(Ws)term.setTextColor(Ys)end
  350. return{monitor=e,terminal=t}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement