Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- deposit = true,
- capToDeposit = 400
- }
- local talkState = 1
- function onInput(c, msg)
- c:SendYellowMessage(Self.Name(), msg)
- if(talkState == 0)then -- denied configure earlier
- if(msg == "configure")then
- c:SendOrangeMessage("", "Would you like to configure the script?")
- talkState = 1
- end
- elseif(talkState == 1)then -- prompted for configure
- if(msg == "yes")then
- c:SendOrangeMessage("", "Do you want the depositer on or off?")
- talkState = 2
- elseif(msg == "no")then
- c:SendOrangeMessage("", "If you would like to set up the script later, just type 'configure'.")
- talkState = 0
- else
- c:SendOrangeMessage("", "Please say either 'yes' or 'no'.")
- end
- elseif(talkState == 2)then -- prompted for configure
- if(msg == "on")then
- print("Depositer: enabled")
- c:SendOrangeMessage("", "At what capacity would you like to deposit?")
- config.deposit = true
- talkState = 3
- elseif(msg == "off")then
- print("Depositer: disabled")
- c:SendOrangeMessage("", "At what capacity would you like to deposit?")
- config.deposit = false
- talkState = 3
- else
- c:SendOrangeMessage("", "Please say either 'on' or 'off'.")
- end
- elseif(talkState == 3)then -- prompted for configure
- if(tonumber(msg))then
- print("Cap to Deposit: " .. msg)
- config.capToDeposit = tonumber(msg)
- c:SendOrangeMessage("", "Configuration complete. Say 'configure' to set the script up again.")
- talkState = 0
- else
- c:SendOrangeMessage("", "Please enter a valid number.")
- end
- end
- end
- function onClose(c)
- print("%s closed.", c:Name())
- end
- commander = Channel.Open("Console", onInput, onClose)
- commander:SendOrangeMessage("", "Would you like to configure the script?")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement