Advertisement
9551

small LTDZZZEJ backup

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