Advertisement
Guest User

test2

a guest
Mar 31st, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.89 KB | None | 0 0
  1. local mon = peripheral.wrap("right")
  2. local bal = 100
  3. function touchScreen()
  4.   event, side, xPos, yPos = os.pullEvent("monitor_touch")
  5.   print(event .. " => Side: " .. tostring(side) .. ", " ..
  6.     "X: " .. tostring(xPos) .. ", " ..
  7.     "Y: " .. tostring(yPos))
  8. end
  9.  
  10. function compVersion()
  11.   mon.clear()
  12.   mon.setCursorPos(2,1)
  13.   mon.setTextColor(colors.yellow)
  14.   mon.write("Prep Computer v1.25")
  15. end
  16.  
  17. function backButton()
  18.  
  19.   --MainProgram
  20. compVersion()
  21. mon.setCursorPos(24,6)
  22. mon.setTextColor(colors.red)
  23. mon.write("WELCOME FIGHTER!")
  24. mon.setCursorPos(9,8)
  25. mon.setTextColor(colors.blue)
  26. mon.write("Before entering the arena let's buy some gear!")
  27. mon.setCursorPos(11,9)
  28. mon.write("To get started simply right click [Shop]")
  29. mon.setCursorPos(29,16)
  30. mon.setBackgroundColor(colors.green)
  31. mon.write("[Shop]")
  32. mon.setBackgroundColor(colors.black)
  33. while true do
  34. touchScreen()
  35.   if (xPos > 28 and xPos < 36) and (yPos > 15 and yPos < 17) then
  36.    compVersion()
  37.    mon.setCursorPos(21,6)
  38.    mon.setTextColor(colors.red)
  39.    mon.write("Welcome to the shop!")
  40.    mon.setCursorPos(13,8)
  41.    mon.setTextColor(colors.blue)
  42.    mon.write("You're given $100 dollars use it wisely")
  43.    mon.setCursorPos(13,9)
  44.    mon.write("Your balance is in the top right corner")
  45.    mon.setCursorPos(54,3)
  46.    mon.setTextColor(colors.green)
  47.    mon.write("$" .. tostring(bal))
  48.    mon.setTextColor(colors.blue)
  49.    mon.setCursorPos(24,10)
  50.    mon.write("Select a category")
  51.    mon.setCursorPos(18,11)
  52.    mon.write("Note items are non refundable")
  53.    mon.setCursorPos(13,18)
  54.    mon.setBackgroundColor(colors.green)
  55.    mon.write("[Armor]")
  56.    mon.setCursorPos(24,18)
  57.    mon.write("[Bow & Arrows]")
  58.    mon.setCursorPos(42,18)
  59.    mon.write("[Swords]")
  60.    mon.setBackgroundColor(colors.black)
  61.    touchScreen()
  62.    if (xPos > 12 and xPos < 20) and (yPos > 17 and yPos < 19) then
  63.      compVersion()
  64.    end
  65.   end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement