I've writen 2 programs that are made for the chatbox and teh speaker but i have 2 issues.
The miner program does not actually understand what number the message is for example:"if my message is "5" it would not stop at 5 but keep going."
2 but thats a small thing the name of the computer doesn't go in chat.
This is the core program
os.loadAPI("cleverbot")
bot = cleverbot.Cleverbot.new()
a = peripheral.wrap("speaker_0")
b = peripheral.wrap("chatBox_0")
range = 10000
lang = "en"
while true do
rs.setOutput("back", true)
event, player, message = os.pullEvent("chat")
if player == "jarifle" then
if message == "door" then
b.say("The door is open master.", range, true, "GladOs")
a.speak("The door is open master.", range, lang)
sleep(0.5)
rs.setOutput("back", false)
sleep(2)
rs.setOutput("back", true)
elseif message == "miner" then
b.say("Miner program is booting.", range, true, "GladOs")
a.speak("Miner program is booting.", range, lang)
sleep(3)
shell.run("miner")
elseif message ~= nil then
response = bot:send(message)
if response ~= nil then
b.say(response, range, true, "GladOs")
a.speak(response, range, lang)
end
end
elseif message == "bitch" then
b.say("Fack you!", range, true, "GladOs")
a.speak("Fack you!", range, lang)
elseif message == "BITCH" then
b.say("Fack you!", range, true, "GladOs")
a.speak("Fack you!", range, lang)
else
b.say("You are not my master!", range, true, "GladOs")
a.speak("You are not my master", range, lang)
end
end
And this is the subprogram for the miner
a = peripheral.wrap("speaker_0")
b = peripheral.wrap("chatBox_0")
b.say("How far do you want to mine?", range, true, "GladOs")
a.speak("How far do you want to mine?", range, lang)
i = 0
while true do
event, player, message = os.pullEvent("chat")
if player == "jarifle" then
m = message
if m then
repeat
print(m)
print(i)
rs.setOutput("right", true)
sleep(0.5)
rs.setOutput("right", false)
sleep(3)
rs.setOutput("left", true)
sleep(10)
rs.setOutput("left", false)
i = i + 1
until i == m
os.reboot()
end
end
end
Thank you!