Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Credit to Pepijn96 for the original scripts, I just compiled them into one
- -- Requirements:
- -- Rain Detector
- -- Daylight sensor
- -- Bundled Cable
- -- Insulated wire (different colors, minimum is 3)
- c = peripheral.wrap("left") -- This wraps the chatbox, change variable and side to whatever you use.
- s = peripheral.wrap("right") -- This wraps the speaker, change variable and side to whatever you use.
- range = 100000
- lang = "en"
- name = "Jacklin" -- Name/Prefix used for the chat messages, if it doesn't work check your config!
- events = {}
- -- Config
- events[".weather"] = function() -- Command to get weather data, requires daylight sensor and rain detector
- if redstone.testBundledInput("back",rainDetector) then -- Change side to wherever the bundled cable with the rain detector is located. Note that this expects a positive output when it's raining.
- c.say("It's raining, how depressing :(",range,false,name)
- s.speak("It's raining, how depressing :(",range,lang)
- elseif redstone.testBundledInput("back",dayLightDetector) then
- c.say("The sun is shining :)!",range,false,name)
- s.speak("The sun is shining :)!",range,lang)
- else
- c.say("The skies are clear!",range,false,name)
- s.speak("The skies are clear!",range,lang)
- end
- end
- events[".output1 on"] = function() -- Command to enable a redstone output. Change the command to whatever you enable.
- redstone.setBundledOutput("back",colors.combine(redstone.getBundledOutput("back"),output1))
- c.say("Output 1 Enabled!",range,false,name) -- Change message to whatever
- s.speak("Output 1 Enabled!",range,lang)
- end
- events[".output1 off"] = function() -- Command to disable a redstone output.
- redstone.setBundledOutput("back",colors.subtract(redstone.getBundledOutput("back"),output1))
- c.say("Output 1 Disabled!",range,false,name) -- Change message to whatever
- s.speak("Output 1 Disabled!",range,lang)
- end
- events[".time"] = function() -- for giving the time in your minecraft world
- local time = os.time()
- local formattedTime = textutils.formatTime(time, false) -- This is to convert the time into something that makes more sense
- c.say("It is "..formattedTime,range,false,name)
- s.speak("It is "..formattedTime,range,lang)
- end
- events[".played"] = function() -- for giving the amount of ingame days you have played in your world
- day = os.day()
- if day == 1 then
- c.say("You have only been playing for 1 day and you already made me. Good job!",range,false,name)
- s.speak("You have only been playing for 1 day and you already made me. Good job!",range,lang)
- elseif day == 7 then
- c.say("You have been playing for 1 week now!",range,false,name)
- s.speak("You have been playing for 1 week now!",range,false,name)
- elseif day == 365 then
- c.say("You have been playing for 1 year?! You are truly amazing!",range,false,name)
- s.speak("You have been playing for 1 year?! You are truly amazing!",range,false,name)
- else
- c.say("You have been playing for "..day.." days",range,false,name)
- s.speak("You have been playing for "..day.." days",range,lang)
- end
- end
- events[".exit"] = function() -- Not really necessary, this will terminate the main loop. Can be useful if you wish to terminate the program from a distance.
- c.say("Shutting Down",range,false,name)
- s.speak("Shutting Down",range,lang)
- do return end
- end
- events[".trigger"] = function() -- Listens for a trigger then for a response as separate messages and saves them to temporary memory
- local e1,player1,msg1 = os.pullEvent("chat")
- local e2,player2,msg2 = os.pullEvent("chat")
- events[msg1] = function()
- c.say(msg2,range,false,name)
- s.speak(msg2,range,lang)
- end
- end
- -- Create more output commands when needed
- rainDetector = colors.white -- Check http://computercraft.info/wiki/Colors_%28API%29 for the name of each color
- dayLightDetector = colors.orange
- ouput1 = colors.magenta
- while true do
- e,player,msg = os.pullEvent("chat")
- local f = events[msg] and events[msg] or function() end
- f()
- end
Advertisement
Add Comment
Please, Sign In to add comment