[wiremod] turn off turrets with expession 2

I’ve got a ton of turrets that auto sense and then shoot.
Any way to say !stopitnowyoudumbturrets to shut them off and then !okayyoucanstartupagainturrets?

@name Chat Detector
@outputs Fire
@trigger all
if (owner():lastSaid() == "fire") {Fire = 1}
if (owner():lastSaid() == "stop firing") {Fire = 0}


Alternatively, if you want your chat command to not show up in chat, try this: (Only works if the server uses a relatively new version of wire.)

@name Chat Detector 2
@outputs Fire
@trigger all
if (chatClk(owner())) {
      M = lastSaid()
      if (M == "fire") {Fire = 1, hideChat(1)}
      if (M == "stop firing") {Fire = 0, hideChat(1)}

I’m not 100% sure you need to use chatClk but I think so.

Both didn’t work.

I’ve got a target finder, beacon sensor, and about 5 turrets all wired up. I just want to turn those off by saying !tstop and !tstart

ORLY! I’m gonna test them. (By the way, no need to quote my post since I already know you are answering to it. Just makes your post HUGE for no reason)


TESTED. Both worked PERFECTLY fine for me. I’ll prove it! Wait a minute…
Here we go: http://www.xfire.com/video/102a8d/
NOTE: Use fullscreen so you can see what I am typing!

I think it doesn’t work for you because you don’t have the latest version of Wire. To get it, use this tutorial: http://www.facepunch.com/showthread.php?t=688324

What you had wasn’t the same setup as mine.

Well you wanted an E2 that fired your turrets. It does that. You can change the code to your liking.

Edit: Just noticed the edit you did in the other post. You want the turrets to fire when the target finders have a target + when you write the chat command? Just use an and(all) gate.

All I want is my turrets to stop firing when I tell them to. Then I want them to start firing when I tell them to.

Then wire “Fire” of the turrets to the Expression 2.

How? I am new with wire. I try but it doesn’t want to work.
And when I do that, the wire doesn’t wire to the beacon sensor!

The above should work, if you had any clue about wire.

Divran, you could probably guide him through a setup via xfire videos, that’d help.

Okay, I have a different dilemma now. How can I make it start firing if I say !fire followed by anything?

so if I say !fire afkldnmlybh it still fires

Give me a minute to edit Divran’s code slightly


@name Chat Detector
@outputs Fire
@persist ChatCommand:array
@trigger all


# Puts the words into an array
ChatCommand = owner():lastSaid():explode(" ")

# In this instance, ChatCommand:string(1) means "the first word you said"
# Note that with this method, other words are ignored. So if you set a command to more than one word, it will never trigger without even more editing.
if (ChatCommand:string(1) == "fire") {Fire = 1}
if (ChatCommand:string(1) == "cease") {Fire = 0}

Wire the and(all) gate to the E2 and the beacon sensor/target finder like you would with the turrets.

Then, wire the turrets to the and(all) gate.

With and(all), if you say “fire” the and(all) will activate, thus making the turrets fire. If the target finder is activated, the and(all) will make the turrets fire.

If the target finder has a target, and you say “fire,” the turrets will fire.

EDIT: It might be if you say “fire” and the target finder has a target, it fires. I get my chips mixed up when I’m not actually building something

I got pretty much everything working how I needed it. Thanks guys. By the way, would anyone know how to make something not collide with me, but to collide with everything and everyone else?

I knew about explode. In this case it wasn’t needed since we have no use for the other words. It just overcomplicates things for no reason.
Edit: Oh wait he asked for something like that. Okay.