Advertisement
MagmaLP

Item-Bank PC

Nov 8th, 2023 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.22 KB | None | 0 0
  1. --This Computer will stay at Trading Townspawn
  2. --x:-7864 y:68 z:13718
  3. --MInecraft(1.4.7) Tekkit Lite Modepack
  4. --ServerIP: server.lycodon.com
  5.  
  6. fs.delete("local-name")
  7. os.loadAPI("ocs/apis/sensor")
  8. mon = peripheral.wrap("back")
  9. term.setBackgroundColor(32768)
  10. term.setCursorPos(1,1)
  11. term.clear()
  12.  
  13. ------------------------------------------------------------
  14. term.setTextColor(colors.yellow)
  15. print("Trading-City Bank")
  16. print("~~~~~~~~~~~~~~~~~")
  17. print(" ")
  18. term.setTextColor(colors.red)
  19. print(" ")
  20. print("please come closer !!!")
  21. print("please come closer !!!")
  22. print("please come closer !!!")
  23. print(" ")
  24. print("Always stand inside the white circle")
  25. print("on the floor, that goes around the Computer.")
  26. print(" ")
  27. print(" ")
  28. print(" ")
  29. print(" ")
  30. term.setTextColor(colors.lightGray)
  31. print("System programmed by MagmaLP")
  32. print("01.12.2023")
  33. print("In case of errors please report to MagmaLP")
  34. ------------------------------------------------------------
  35.  
  36. function calc_color(color)
  37.     return math.pow(2, color - 1)
  38. end
  39.  
  40. function msg(gap, line, color, groundb, text)
  41.     term.setBackgroundColor(calc_color(groundb))
  42.     term.setCursorPos(gap,line)
  43.     term.setTextColor(calc_color(color))
  44.     text = term.write(text)
  45. end
  46.  
  47. function clear()
  48.     for yPos = 1,20 do
  49.         msg(1,yPos,16,16,"                                                   ")
  50.     end
  51. end
  52.  
  53. function getS()
  54.     for v, k  in pairs(s) do
  55.         if k.Name == "ME Wireless Access Point" then  
  56.             target = v
  57.         end
  58.     end
  59.     sleep(0.5)
  60.     return target
  61. end
  62.  
  63. Adjustable_Emitter_Amount = 0
  64.  
  65.  
  66. while true do
  67.     sen = sensor.wrap("back")
  68.     for targetName,targetInfo in pairs(sen.getTargets()) do     --detect targets
  69.         name = targetName
  70.         if targetInfo.Name == "Player" then                     --detect if target is a player
  71.             if fs.exists("Users/" ..name) == false then         --create user
  72.                 file = fs.open("Users/" .. name, "w")
  73.                 file.write("Adjustable Emitter= 0\n")
  74.                 file.write("Shiny Ingot= 0\n")
  75.                 file.write("Tungsten Ore= 0")
  76.                 file.close()
  77.             end
  78.        
  79.             file = fs.open("local-name", "w")                               --name local speichern
  80.             file.write(name)
  81.             file.close()
  82.            
  83.             clear()
  84.             msg(01,01,02,16," Account: "..name)                             --überschrift
  85.             msg(01,02,08,16,"---------------------------------------------------")
  86.  
  87.             msg(06,07,01,15,"                  ")   msg(30,07,01,15,"                ")
  88.             msg(06,08,01,15,"  deposit items   ")   msg(30,08,01,15," withdraw items ")
  89.             msg(06,09,01,15,"                  ")   msg(30,09,01,15,"                ")
  90.  
  91.             msg(14,04,06,16,"$$$                   $$$")
  92.             msg(18,04,05,16,"Trading-City Bank")
  93.             msg(18,05,01,16,"~~~~~~~~~~~~~~~~~")
  94.             msg(02,13,09,16,"After 1 year offline, your account will be")
  95.             msg(02,14,09,16,"deleted, along with all your things!")
  96.             msg(02,15,09,16,"Save your valuable items here so you can")
  97.             msg(02,16,09,16,"get them back even after a player reset.")
  98.            
  99.             msg(01,18,08,16,"---------------------------------------------------")
  100.  
  101.             local event, button, X, Y = os.pullEvent("mouse_click")
  102.             if X >= 06 and X <= 23 and Y >= 07 and Y <= 09 then                                 --deposit items
  103.                 clear()
  104.                
  105.                 msg(01,01,02,16," Account: "..name)                             --überschrift
  106.                 msg(01,02,08,16,"---------------------------------------------------")
  107.                 msg(14,04,06,16,"$$$                   $$$")
  108.                 msg(18,04,05,16,"Trading-City Bank")
  109.                 msg(18,05,01,16,"~~~~~~~~~~~~~~~~~")
  110.                
  111.                 msg(02,07,01,16,"Insertable Items:")
  112.                 msg(02,08,01,16,"~~~~~~~~~~~~~~~~~")
  113.                 msg(24,07,09,16,"-> Adjustable Emitters")  
  114.                 msg(24,08,09,16,"-> Tungste Ore")
  115.                 msg(24,09,09,16,"-> Shiny Ingot")
  116.  
  117.                 msg(02,13,09,16,"Insert all items on the left and then")
  118.                 msg(02,14,09,16,"confirm here with the red button.")
  119.                 msg(02,15,09,16,"Your items will remain saved until")
  120.                 msg(02,16,09,16,"you retrieve them.")
  121.                
  122.                 msg(40,13,01,15,"          ")
  123.                 msg(40,14,01,15," confirm  ")
  124.                 msg(40,15,01,15,"          ")
  125.                
  126.                 msg(01,18,08,16,"---------------------------------------------------")
  127.                 msg(47,19,16,01," back")
  128.                
  129.                 local event, button, X, Y = os.pullEvent("mouse_click")
  130.                 if X >= 40 and X <= 49 and Y >= 13 and Y <= 15 then     --confirm button
  131.                     shell.run("Addieren")
  132.                 elseif X >= 47 and X <= 52 and Y == 19 then             --back button
  133.                     os.reboot()
  134.                 else
  135.                     --nix
  136.                 end
  137.             elseif X >= 30 and X <= 45 and Y >= 07 and Y <= 09 then                                 --withdraw items
  138.                 shell.run("Subtrahieren")
  139.             else
  140.                 os.reboot()
  141.             end
  142.         end
  143.     end
  144. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement