Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Mob Farm Chatty Turtle Script
- --v1.1 by SemlerPDX Sept2024
- -- pastebin get mzzf4cw1 startup
- local farmOnline = false
- local currentState = true
- local playerRange = 10
- local chatBox = peripheral.find("chatBox")
- local detector = peripheral.find("playerDetector")
- local titleOn = {
- { text = "Spawner ON", color = "green"}
- }
- local titleOff = {
- { text = "Spawner OFF", color = "red"}
- }
- local messageOn = {
- { text = "I will kill any "},
- { text = "Escaped Mobs ", color = "green"},
- { text = "- you just focus on the murder hole!"}
- }
- local messageOff = {
- { text = "I will now kill "},
- { text = "ALL Mobs ", color = "red"},
- { text = "that continue spawning - go play, have fun!"}
- }
- local titleOnJson = textutils.serializeJSON(titleOn)
- local titleOffJson = textutils.serializeJSON(titleOff)
- local messageOnJson = textutils.serialiseJSON(messageOn)
- local messageOffJson = textutils.serialiseJSON(messageOff)
- local function SendNotice(online, playerName)
- if online then
- successful, error = chatBox.sendFormattedToastToPlayer(messageOnJson, titleOnJson, playerName, "&4&oMobBot", "()", "&4&o")
- else
- successful, error = chatBox.sendFormattedToastToPlayer(messageOffJson, titleOffJson, playerName, "&4&oMobBot", "()", "&4&o")
- end
- end
- while true do
- sleep(1)
- farmOnline = turtle.detectUp()
- if not farmOnline == currentState then
- playerNames = detector.getPlayersInRange(playerRange)
- for key,value in pairs(playerNames) do
- SendNotice(currentState, value)
- end
- end
- currentState = farmOnline
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement