Guest User

Useful Things v3.1

a guest
Apr 6th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. local TextThingy = Textbox:new(65, 5, 100, 15,"","Material")
  2. local DoItButton = Button:new(613, 97, 15, 15, "I")
  3. local ItButton = Button:new(5, 5, 35, 15, "Fill", "Fills Whole Screen With Given Material")
  4. local CloseButton = Button:new(195, 5, 15, 15,"X")
  5. local stuffLabel = Label:new(155 , 8, 50, 10,"")
  6. local ResetSpark = Button:new(5, 25, 15, 15, "R")
  7. local StuffWindow = Window:new(150, 100, 215, 45)
  8. local setButton = Button:new(25, 25, 15, 15, "S", "Sets given property of Everything on screen to given number")
  9. local PropText = Textbox:new(65, 25, 100, 15,"","Property")
  10. local SetNumText = Textbox:new(170, 25, 40, 15,"","Number")
  11. local resetStuffButton = Button:new(45, 25, 15, 15, "E")
  12. local replaceAllButton = Button:new(45, 5, 15, 15, "T")
  13.  
  14. function Initi(initIt)
  15. StuffWindow:addComponent(initIt)
  16. end
  17.  
  18. ItButton:action(function(sender)
  19. generatetext()
  20. sim.createBox(0, 0, 620, 400, tpt.element(textstuff))
  21. stuffLabel:text("Done")
  22. end)
  23.  
  24. ResetSpark:action(function(sender)
  25. tpt.reset_spark()
  26. stuffLabel:text("Done")
  27. end)
  28.  
  29. function generatetext()
  30. textstuff = TextThingy:text()
  31. end
  32.  
  33. function setGenerate()
  34. stringset = PropText:text()
  35. numset = SetNumText:text()
  36. end
  37.  
  38. setButton:action(function(sender)
  39. setGenerate()
  40. tpt.set_property(stringset, numset)
  41. stuffLabel:text("Done")
  42. end)
  43.  
  44. resetStuffButton:action(function(sender)
  45. simulation.resetPressure()
  46. simulation.resetTemp()
  47. tpt.reset_velocity()
  48. stuffLabel:text("Done")
  49. end)
  50.  
  51. StuffWindow:onTryExit(function()
  52. interface.closeWindow(StuffWindow)
  53. end)
  54.  
  55. DoItButton:action(function(sender)
  56. stuffLabel:text("")
  57. interface.showWindow(StuffWindow)
  58. end)
  59.  
  60. replaceAllButton:action(function(sender)
  61. generatetext()
  62. tpt.set_property("type", textstuff)
  63. end)
  64.  
  65. CloseButton:action(function()
  66. interface.closeWindow(StuffWindow)
  67. end)
  68.  
  69. Initi(TextThingy)
  70. interface.addComponent(DoItButton)
  71. Initi(ItButton)
  72. Initi(CloseButton)
  73. Initi(stuffLabel)
  74. Initi(ResetSpark)
  75. Initi(setButton)
  76. Initi(PropText)
  77. Initi(SetNumText)
  78. Initi(resetStuffButton)
  79. Initi(replaceAllButton)
  80. TextThingy:readonly(false)
Advertisement
Add Comment
Please, Sign In to add comment