Advertisement
RamiLego

PowderToyCCM

Nov 6th, 2013
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.99 KB | None | 0 0
  1. -- By Rami4444 -- Email : ramilego4game@gmail.com --
  2.  
  3. -- options --
  4. local CloseAfterSet = true
  5. -------------
  6. local Ver = "1" --define the version
  7. local CCM = Window:new(-1,-1,200,200) --creates a new window
  8. local FTL = Label:new(10,10,80,16, "Current mode :") --create a new text label
  9. local STL = Label:new(10,60,60,16, "Element :") --create a new text label
  10. local TTL = Label:new(10,100,60,16, "Change to :") --create a new text label
  11. local FOTL =    Label:new(135,40,60,16, ("CCM V"..Ver)) --create a new text label
  12.  
  13. -- Close button
  14. local closeButton = Button:new(10, 174, 60, 16, "Close") --creates close button
  15.  
  16. closeButton:action(function() interface.closeWindow(CCM) end) --set the function to call after clicking close button
  17.  
  18. CCM:onTryExit(function() interface.closeWindow(CCM) end) -- Allow the default exit events
  19.  
  20. CCM:addComponent(closeButton); --add the close button to the window
  21.  
  22. --local ccmButton = Button:new(1, 1, 15, 15, "T", "Open Command Cheat Menu") --Set The Button In The Up Right Corner.
  23. local ccmButton = Button:new(613, 97, 15, 15, "T", "Open Command Cheat Menu") --Set The Button In The Up Right Corner.
  24. --local ccmButton = Button:new(613, 113, 15, 15, "T", "Open Command Cheat Menu") --Set The Button Under Restart Button.
  25. ccmButton:action(function() interface.showWindow(CCM) end)--set the function to call after clicking T button
  26.  
  27. local modeButton = Button:new(130,10,60,16, "Type", "Change The Mode")--adds mode Button
  28.  
  29. local curMode = modeButton:text(); --get the text of the button (Mode)
  30.  
  31. function changeMode() --creats changeMode function
  32.     curMode = modeButton:text(); --update the current mode
  33.     if curMode=="Type" then --checks if the current mode is "Type"
  34.         modeButton:text("Temp")--Change to Temp mode
  35.         TTL:text("Set temp to :")--Set the Text Lebel "TTL"
  36.     end
  37.     if curMode=="Temp" then --checks if the current mode is "Temp"
  38.         modeButton:text("Type")--Change to Type mode
  39.         TTL:text("Change to :")--Set the Text Lebel "TTL"
  40.     end
  41. end
  42.  
  43. modeButton:action(function() changeMode() end) --set the function to call after clicking mode button
  44.  
  45. ftxt = Textbox:new(10, 80, 180, 16)--adds Textbox
  46. stxt = Textbox:new(10, 120, 180, 16)--adds Textbox
  47. setButton = Button:new(130,174,60,16, "Set")--adds Textbox
  48.  
  49. function setMode()--creates setMode function
  50.     curMode = modeButton:text();--update the current mode
  51.     if curMode=="Type" then
  52.         --print (curMode)--used for debugging
  53.         typeMode()--do the typeMode function
  54.     end
  55.     if curMode=="Temp" then
  56.         --print (curMode)--used for debugging
  57.         tempMode()--do the tempMode function
  58.     end
  59.     if CloseAfterSet then --checks if user need to close after set
  60.     interface.closeWindow(CCM) --close window
  61.     end
  62. end
  63.  
  64. function typeMode()--creates typeMode function
  65.     --print (curMode)--used for debugging
  66.     ftext = ftxt:text()-- checks for "ftxt" text
  67.     stext = stxt:text()-- checks for "stxt" text
  68.     if ftext=="" then-- used to fix don't close by pressing set when there is no think in the spaces
  69.         ftext = "metl"
  70.         stext = "metl"
  71.     end
  72.     tpt.set_property("type", stext, ftext) --set the type
  73. end
  74.  
  75. function tempMode()--creates tempMode function
  76.     --print (curMode)--used for debugging
  77.     ftext = ftxt:text()-- checks for "ftxt" text
  78.     stext = stxt:text()-- checks for "stxt" text
  79.     if ftext=="" then-- used to fix don't close by pressing set when there is no think in the spaces
  80.         ftext = "metl"
  81.         stext = "0"
  82.     else
  83.     tpt.set_property("temp", stext, ttext) --set the temp
  84.     end
  85. end
  86.  
  87. setButton:action(function() setMode() end) --set the function to call after clicking set button
  88.  
  89. CCM:addComponent(modeButton)--adds modeButton to the window
  90. CCM:addComponent(ftxt)--adds ftxt to the window
  91. CCM:addComponent(stxt)--adds stxt to the window
  92. CCM:addComponent(setButton)--adds setButton to the window
  93. CCM:addComponent(FTL)--adds FTL to the window
  94. CCM:addComponent(STL)--adds STL to the window
  95. CCM:addComponent(TTL)--adds TTL to the window
  96. CCM:addComponent(FOTL)--adds FOTL to the window
  97.  
  98. interface.addComponent(ccmButton)--adds menu button to PowderToy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement