This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Raythornious's profile picture

Tier 5 Soulshard Mobgrinder [V1.0] -Chatbox Controlled

Started by Raythornious, 14 September 2013 - 06:40 PM
Raythornious #1
Posted 14 September 2013 - 08:40 PM
Soulshard Mobgrinder

V1.0

This program is very simple it utilizes the chatbox peripheral to make a wireless mobspawner.


Requirements:

This requires at least the Soulshards, Computercraft(of course) and MiscPeripherals.

All the Soulshards must be at tier 5.


What it does:

Picks up chat messages such as:

Blaze on

Blaze off

To toggle on and off the spawners.

If it worked it will reply with:

Blazes Initiated

Blazes Deinitiated


How it does it:

Using the chatbox peripheral it reads what is said in chat.

In accordance to what is said it will toggle a redstone signal.

IE:

Blazes on – turns off redstone signal going to the "Blaze" side.


Downside:

As of right now with this code anyone can initiate the spawners from any distance.

(As long as chunk is loaded.)

(If you know how to secure it to 1 person or a group of people please post how to do so)


Code (Because everyone loves it.):

Spoiler


rs.setOutput("front", true)
rs.setOutput("back", true)
rs.setOutput("left", true)
rs.setOutput("right", true)
	  m = peripheral.wrap("bottom")
		while true do
		event, player, message = os.pullEvent("chat")
		  if message == "Zombie on" then
		  rs.setOutput("front", false)
		  m.say("Zombies Initiated")
		end
		  if message == "Zombie off" then
		  rs.setOutput("front", true)
		  m.say("Zombies Deinitiated")
		end
		  if message == "Skeleton on" then
		  rs.setOutput("left", false)
		  m.say("Skeletons Initiated")
		end
		  if message == "Skeleton off" then
		  rs.setOutput("left",true)
		  m.say("Skeletons Deinitiated")
		end
		  if message == "Blaze on" then
		  rs.setOutput("right", false)
		  m.say("Blazes Initiated")
		end
		  if message == "Blaze off" then
		  rs.setOutput("right", true)
		  m.say("Blazes Deinitiated")
		end
		  if message == "Creeper on" then
		  rs.setOutput("back", false)
		  m.say("Creepers Initiated")
		end
		  if message == "Creeper off" then
		  rs.setOutput("back", true)
		  m.say("Creepers Deinitiated")
		end
	  end



Credits:

Demicreator - The idea

bimmybear - testing

DjIvor - testing

JoshTim - testing


How to get it:

Typing

pastebin get 863PDeaN startup

into a CC computer.


Screenshots:

Spoiler



(If you know how to post actual pictures and not links please tell me so. I will update)



Please post ANY feedback or suggestions (what I can add or improve) here.
apemanzilla #2
Posted 15 September 2013 - 09:57 AM
The "chat" event returns the player's name as an argument, you can use that to make it only work for certain people.
Raythornious #3
Posted 15 September 2013 - 07:10 PM
I've messed around trying change the argument from "message" to "player"


m = peripheral.wrap("bottom")
  while true do
	event, player, message = os.pullEvent('chat")
	  if player = "bimmybear" then
		m.say("Hi bimmybear")
	  end
  end

This returned no results. I also don't know if in order to specify the player I must specify a message, if so would

if player, message = "bimmybear, Hello" then
  m.say("Hello bimmybear")
work?
TDarkShadow #4
Posted 17 September 2013 - 05:44 PM
Or you could make it like this, so no one but yourself will activate it.


m = peripheral.wrap("bottom")
			    while true do
			    event, player, message = os.pullEvent("chat")
				  if player == "nickname" and message == "Zombie on" then
				  rs.setOutput("front", false)
				  m.say("Zombies Initiated")
			    end
		  end
Knux14 #5
Posted 18 September 2013 - 01:10 AM
use openperipheral's glasses would be better
Raythornious #6
Posted 18 September 2013 - 03:54 AM
Hmmm I may make a second version of this using the openperipheral glasses. Guess its time to learn a new peripheral. Don't they use "$$" before each message?
Knux14 #7
Posted 18 September 2013 - 06:32 AM
Yep, it's an event which is called. You type $$something in the chat, and the event will receive the message "something" ;)/>
Raythornious #8
Posted 20 September 2013 - 09:53 AM
Very nice. I'll definitely check it out. >.> I blew up my base editing the first spawner system. Next time ill test code in my test world.