Nike622000

Jobcenter

Jun 3rd, 2016
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.86 KB | None | 0 0
  1. -- Variablen
  2. redstone.setOutput("bottom", false)
  3. os.loadAPI("ocs/apis/sensor")
  4. senP = sensor.wrap("right")
  5. senI = sensor.wrap("left")
  6. bcol = colors.white
  7. tcol = colors.white
  8. tbcol = colors.black
  9. bcolagb = colors.black
  10. tcolagb = colors.white
  11. monSide = "back"
  12. agb = false
  13.  
  14. anzeigeuu = 0
  15.  
  16. mon = peripheral.wrap(monSide)
  17. xMax,yMax = mon.getSize()
  18.  
  19.  
  20. -- Funktionen
  21. function screen()
  22.  mon.setBackgroundColor(bcol)
  23.  for i=1,yMax do
  24.   mon.setCursorPos(1,i)
  25.   for j=1,xMax do
  26.    mon.write(" ")
  27.   end
  28.  end
  29. end
  30.  
  31. function AGB()
  32. mon.setBackgroundColor(bcolagb)
  33. for i=4,15 do
  34.   mon.setCursorPos(1,i)
  35.   for j=1,xMax do
  36.    mon.write(" ")
  37.   end
  38. end
  39. -- AGB Text
  40.  mon.setTextColor(tcolagb)
  41.  mon.setCursorPos(1,5)
  42.  mon.write("Allgemeine Geschäftsbedinungen:")
  43.  mon.setCursorPos(1,7)
  44.  mon.write("blablabla")
  45.  mon.setCursorPos(1,13)
  46.  mon.write("Um zu bestätigen klicke auf den Bildschirm")
  47.  mon.setCursorPos(1,15)
  48.  mon.write("lg bla bla")
  49. end
  50.  
  51. function start()
  52. mon.clear()
  53. screen()
  54. AGB()
  55. end
  56.  
  57. function Bclear()
  58. mon.clear()
  59. screen()
  60. end
  61.  
  62. start()
  63.  
  64. event,side,xPos,yPos = os.pullEvent("monitor_touch")
  65. if event == "monitor_touch" then
  66.  agb = true
  67.  end
  68.  
  69. function h()
  70.  while false do
  71.   mon.setCursorPos(1,1)
  72.   for i=1,xMax do
  73.    mon.setBackgroundColor(tbcol)
  74.    mon.write(" ")
  75.   end
  76.   t = textutils.formatTime(os.time())
  77.   mon.setCursorPos(1,1)
  78.   mon.setTextColor(tcol)
  79.   mon.setBackgroundColor(tbcol)
  80.   mon.write("Jobcenter")
  81.   mon.setCursorPos((xMax-#t)+1,1)
  82.   mon.write(t)
  83.   sleep(0.8)
  84.  end
  85. end
  86.  
  87. function main()
  88. Bclear()
  89. player = " "
  90. playerp = " "
  91. while true do
  92.  
  93. proximity = sensor.wrap("right")
  94. targets = proximity.getTargets()
  95. for k,v in pairs(targets) do
  96.   if v.Name == "Player"
  97.   and v.Position.X<=3 and v.Position.X>=-3
  98.   and v.Position.Z<=9 and v.Position.Z>=3
  99.   and v.Position.Y>=-3 and v.Position.Y<=4  
  100.   then
  101.   player = k
  102.  
  103. mon.setCursorPos(3,5)
  104. mon.setBackgroundColor(colors.black)
  105. mon.write("                                              ")
  106. mon.setCursorPos(3,5)
  107. mon.write("Willkommen "..player.." ")
  108. mon.setCursorPos(3,6)
  109. mon.setBackgroundColor(colors.black)
  110. mon.write("Du befindest dich im Hauptmenue des Jobcenters")
  111.  
  112.  
  113. mon.setCursorPos(3,8)
  114. mon.setBackgroundColor(colors.red)
  115. mon.write("o")
  116. mon.setCursorPos(5,8)
  117. mon.setBackgroundColor(colors.black)
  118. mon.write("Angebot schreiben")
  119.  
  120.  event,side,xPost,yPost = os.pullEvent("monitor_touch")
  121.  
  122. if xPost == 3 and yPost == 8 then
  123. screen()
  124. mon.setCursorPos(3,5)
  125. mon.setTextColor(colors.black)
  126. mon.write("Kategorie angeben: ")
  127.  
  128. mon.setCursorPos(3,8)
  129. mon.setBackgroundColor(colors.red)
  130. mon.setTextColor(colors.black)
  131. mon.write("o")
  132. mon.setCursorPos(5,8)
  133. mon.setBackgroundColor(colors.black)
  134. mon.setTextColor(colors.green)
  135. mon.write("Terraforming")
  136.  
  137. mon.setCursorPos(3,10)
  138. mon.setBackgroundColor(colors.red)
  139. mon.setTextColor(colors.black)
  140. mon.write("o")
  141. mon.setCursorPos(5,10)
  142. mon.setBackgroundColor(colors.black)
  143. mon.setTextColor(colors.brown)
  144. mon.write("Crafting")
  145.  
  146. mon.setCursorPos(3,12)
  147. mon.setBackgroundColor(colors.red)
  148. mon.setTextColor(colors.black)
  149. mon.write("o")
  150. mon.setCursorPos(5,12)
  151. mon.setBackgroundColor(colors.black)
  152. mon.setTextColor(colors.cyan)
  153. mon.write("Gestaltung")
  154.  
  155. kategorie = true
  156. Beschreibung = true
  157. katwaehlen = false
  158. end
  159. while kategorie do
  160. event,side,xPost,yPost = os.pullEvent("monitor_touch")
  161. if xPost == 3 and yPost == 8 then
  162. kategorie = false
  163. kat = "Terraforming"
  164. screen()
  165. katwaehlen = true
  166. end
  167. if xPost == 3 and yPost == 10 then
  168. kategorie = false
  169. kat = "Crafting"
  170. screen()
  171. katwaehlen = true
  172. end
  173. if xPost == 3 and yPost == 12 then
  174. kategorie = false
  175. kat = "Gestaltung"
  176. screen()
  177. katwaehlen = true
  178. end
  179. end
  180. if katwaehlen == true then
  181. mon.setCursorPos(2,3)
  182. mon.setBackgroundColor(colors.white)
  183. mon.setTextColor(colors.black)
  184. mon.write("Kategorie: ")
  185. mon.setCursorPos(13,3)
  186. mon.setTextColor(colors.cyan)
  187. mon.write(kat)
  188. mon.setCursorPos(2,6)
  189. mon.setTextColor(colors.black)
  190. mon.write("Nun gebe im unteren Computer eine Beschreibung")
  191. mon.setCursorPos(2,7)
  192. mon.write("an, was genau getan werden soll.")
  193. while Beschreibung do
  194. rednet.open("front")
  195. rednet.send(8949,"Tastatur start")
  196. id,message = rednet.receive()
  197. print(id)
  198. print(message)
  199. if id == 8949 and message == "Tastatur stopp" then
  200. id,message = rednet.receive()
  201. if id == 8949 and message == "Nachricht wird übermittelt" then
  202. id,message = rednet.receive()
  203. if id == 8949 then
  204. str = message
  205. print(message)
  206. id,message = rednet.receive()
  207. if id == 8949 and message == "Nachricht wurde übermittelt" then
  208. mon.setTextColor(colors.black)
  209. mon.setBackgroundColor(colors.white)
  210. mon.setCursorPos(5,2)
  211. mon.write("Beschreibung wurde erfolgreich gespeichert!")
  212. sleep(5)
  213. screen()
  214.  mon.setBackgroundColor(colors.black)
  215.  for i=5,yMax-3 do
  216.   for j=3,xMax-2 do
  217.     mon.setCursorPos(j,i)
  218.    mon.write(" ")
  219.   end
  220.  end
  221. end
  222. mon.setCursorPos(2,3)
  223. mon.setBackgroundColor(colors.white)
  224. mon.setTextColor(colors.black)
  225. mon.write("Kategorie: ")
  226. mon.setCursorPos(2,4)
  227. mon.setBackgroundColor(colors.white)
  228. mon.setTextColor(colors.black)
  229. mon.write("Beschreibung: ")
  230. mon.setCursorPos(13,3)
  231. mon.setTextColor(colors.cyan)
  232. mon.write(kat)
  233.  
  234. pos = 1
  235.  
  236. mon.setTextColor(colors.white)
  237. mon.setBackgroundColor(colors.black)
  238. abbruch = false
  239. xPos=3
  240. yPos=5
  241. mon.setCursorPos(xPos,yPos)
  242. while true do
  243.   stelleA = string.find(str,"<",pos,true)
  244.  
  245.   if stelleA == nil then
  246.     substr = string.sub(str,pos)
  247.   else
  248.     substr = string.sub(str,pos,stelleA-1)
  249.   end
  250.   mon.write(substr)
  251.  
  252.  
  253.   if abbruch==true then
  254.     break
  255.   end
  256.  
  257.  
  258.   stelleE = string.find(str,">",pos)
  259.  
  260.   if stelleE then
  261.     col = string.sub(str,stelleA+1,stelleE-1)
  262.   else
  263.     abbruch = true
  264.   end
  265.  
  266.   if not string.match(col,"[a-zA-Z]+") then
  267.     mon.setTextColor(tonumber(col))
  268.   elseif col == "E" then
  269.     yPos = yPos+1
  270.     mon.setCursorPos(xPos,yPos)
  271.   end
  272. print(col)
  273.  
  274.   if stelleE then
  275.     pos = stelleE+1
  276.   end
  277.  
  278.   sleep(0.1)
  279. end
  280. while true do
  281.         mon.setCursorPos(3,17)
  282.         mon.setBackgroundColor(colors.white)
  283.         mon.setTextColor(colors.black)
  284.         mon.write("Lohn fuer den Spieler in Form von ")
  285.         mon.setTextColor(colors.pink)
  286.         mon.write("UU")
  287.         mon.setCursorPos(3,18)
  288.         mon.setTextColor(colors.black)
  289.         mon.write("in die Diamanttruhe legen")
  290.         mon.setCursorPos(3,19)
  291.         mon.setBackgroundColor(colors.red)
  292.         mon.setTextColor(colors.black)
  293.         mon.write("o")
  294.         mon.setCursorPos(5,19)
  295.         mon.setBackgroundColor(colors.black)
  296.         mon.setTextColor(colors.cyan)
  297.         mon.write("Angebot abgeben")
  298.         event,side,xPost,yPost = os.pullEvent("monitor_touch")
  299.                 if xPost == 3 and yPost == 19 then
  300.                 mon.setCursorPos(3,19)
  301.                 mon.setBackgroundColor(colors.white)
  302.                 mon.setTextColor(colors.red)
  303.                 mon.write("Truhe wird abgepumpt!           ")
  304.                 for i = 1,108 do
  305.                 redstone.setOutput("bottom", true)
  306.                 sleep(0.1)
  307.                 redstone.setOutput("bottom", false)
  308.                 end
  309.                 break
  310.                 end
  311.            
  312. end
  313.      
  314. while true do
  315.     menge = 0
  316.     anzeigeuu = 0
  317.     sleep(2)
  318.  
  319.     zieleinv = senI.getTargets()
  320.  
  321.         for k,v in pairs(zieleinv) do
  322.             if v.Name == "Diamond Chest"
  323.             and v.Position.X==-5
  324.             and v.Position.Y==-1
  325.             and v.Position.Z==-2
  326.             then
  327.             print("Chest detected")
  328.             details = senI.getTargetDetails(k)
  329.                 for i = 1,108 do
  330.                     if details.Slots[i].Name == "UU-Matter" then
  331.                     menge = details.Slots[i].Size
  332.                     anzeigeuu = anzeigeuu+menge
  333.                         for j = 17,20 do
  334.                             for g = 1,xMax do
  335.                             mon.setBackgroundColor(colors.white)
  336.                             mon.setCursorPos(g,j)
  337.                             mon.write(" ")
  338.                             end
  339.                     end
  340.                     mon.setCursorPos(3,18)
  341.                     mon.setBackgroundColor(colors.white)
  342.                     mon.setTextColor(colors.black)
  343.                     mon.write("Lohn: ")
  344.                     mon.setTextColor(colors.pink)
  345.                     mon.write(anzeigeuu.." UU")
  346.                     end
  347.             end
  348.             end
  349. end
  350. end
  351.  
  352. end
  353. end
  354.  
  355. end
  356. sleep(10)
  357. end
  358.  
  359. sleep(1)
  360. end
  361.  
  362.  
  363. end
  364. end
  365. end
  366. end
  367. parallel.waitForAll(main,h)
Advertisement
Add Comment
Please, Sign In to add comment