Introduction to Wire

From GMod Wiki

Jump to: navigation, search



Contents

An Introduction to Wire

Introduction to Wire: An Introduction to Wire
Page white text.png Description:A simple, brief introduction into the world of Wire.
link=User:Entoros Original Author:Entoros
Calendar.png Created:February 9, 2009
Page white text.png Notes:While this isn't really a contraption in itself, there technically is one involved, so it counts.


Getting Started

First of all, welcome to Wiremod! This modification is the most popular Garry's Mod addon to date, so learning how to wire is increasingly key to any GMod player's experience. Understandbly, Wire can be confusing to those who are just starting out (god, I was so confused when I started), but the tutorial should move at a pace that matches your skill level.

A quick note: I assume you already have the wire and wire model packs in your addons folder. If you've had trouble doing this, check out "www.wiremod.com". You should be able to follow the tutorial accurately if your wire is installed correctly.

Let's get started.

To the Menu!

First, we need to get to the Wiremod tool menu before we can do anything else. Press "Q" to open your Spawn Menu, then on the right side (tool side) of your menu, scroll over until you see the tab at the top that says "Wire" with a little wrench next to it. Click on the menu.

When you open up the menu, it should look something like this:

Wiremenu.jpg

If you can't find the menu on the right, or it doesn't open, that's a bit of a problem. Go back to wiremod.com and check the help section.

Now that we're here, let's explore a little bit. Feel free to scroll up and down, and soak up as much as you can. There's a LOT of different tools, but don't be intimidated; we're just going to use a couple for your first contraption.

How Wire Works

The screen described.

Before you dive headfirst into building with wire, let me give you a little nugget of information. The Wiremod addon is based on the premise of its name: wires. The idea of wire is connecting the inputs and outputs of different devices. I'm sure some of you may be asking yourself "So what's an input and an output?" Well, it's pretty simple really. An input is anything that you, well, put in a device. For example, a keyboard is a type of input. You put in letters to the computer, and it does a bunch of fancy processes to translate it.

The monitor you're reading this off of is an example of an output. An output is whatever comes out of the device; a picture, a number, anything. In the whole input/output combination, wires are simply a way to link the inputs and the outputs. If I have a device that outputs 1, I can wire the input of a "Wire Screen" to the output of that device, so the 1 inputted to the screen is then shown (an output of 1).

Now that you have a decent grasp of how wire functions, let's build a contraption!

Your First Contraption

This is the moment you've all been waiting for; the chance to build some fancy, elaborate contraption to dazzle all of your friends with your amazing wire knowledge. Well, sorry, that's not gonna happen. Let's start out with some nice, easy wiring, and who knows, maybe you can soon build that amazing contraption you've always wanted.

Getting the Parts

The basic look of the contraption.

To start out, let's get everything together first. Make sure to finish the whole contraption before asking questions, and make sure you follow the steps exactly.

  1. Find some sort of doorway or entranceway. If you can't find one, enter the term "doorframe002a.mdl" in the search bar and spawn that prop.
  2. Weld the prop upright so that it forms a doorway.
  3. Open the wire menu, find the "Wire - Detection" category, and select the 'Ranger'.
  4. Set the ranger properties as follows:
    1. Check the "Default to zero"
    2. Check "Show Beam"
    3. Check "Output Distance" boxes.
  5. Close the menu. Aim at the inside base of your doorway and click to spawn a ranger. Its beam should cross the doorway and stop when it hits the opposite side.
  6. Hover over the ranger and you should see a value for 'Range'. This is the distance the ranger is currently recording (across the width of your doorway). Make a note of this number.
  7. Open the menu. Find the 'Range' slider option for the ranger. Set it to the value you noted, minus a bit. For example, if your value was 96, set the slider to 95.
  8. Exit the menu and left-click on the ranger again. This will update it with the adjusted setting.
  9. Open the menu. Locate "Wire - Control" section then "Gate - Comparison" and select the 'Greater Than' gate.
  10. Spawn one of these just above the ranger on the same upright.
  11. Open the menu. Locate "Wire - Physics" and select a 'Turret'.
  12. Spawn one of these above the gate, at eye-level pointing across the doorway.

Wiring the Components

Now that everything's spawned and ready, let's start wiring things up. If you get confused, refer back to the image of the finished product.

This is what the Adv. Wire Tool menu should look like.
  1. First, scroll down to the bottom of your Wire menu. Select either the "Wire" or the "Wire Advanced" tool (I personally prefer the Wire Advanced, as the menu is easier. There's not really much difference."
  2. Once you have the tool selected and equipped, exit out of the menu and look directly at the "Greater Than" gate. You should see a little menu pop up, displaying the letter "A" (or "A" and "B" if you're using Wire Advanced).
  3. With "A" showing in the menu, left click ONLY once on the "Greater Than" gate. You should still have the "A" on your screen, which is good.
  4. Look directly at the ranger now, and left click. What you just did was tell the "Greater Than" gate's "A" input to go to the ranger's output. This is what we call "wiring".
  5. Now, do the same thing with the Turret. Look directly at it with your Wire tool, and once the word "Fire" appears, left click once.
  6. Then look down at your "Greater Than" gate, and left click again. This wired your Turret's "Fire" input to the "Greater Than" gate's output.
A shitty MSPaint diagram of the wiring.

The Finished Product

And now your contraption is complete! By now, you may have an inkling of what it does, but try spawning a zombie in front of it and let it walk through the doorway. You'll be pleased with the results if you wired it right.


Zombiekill1.jpg Zombiekill2.jpg


What happens is whenever something goes across the ranger, the turret fires. Pretty cool, eh? A quick note: If you try and sprint across the ranger and see if it shoots you, it probably won't. It takes a second for the ranger and the turret to react.

The Explanation

There's probably some of you going "What on earth did I just do, and how does this work?" Well, if you do a little math, it's pretty simple. Let's start with the Turret; the Wire Turret is just like a regular turret, except it takes a "Fire" input. This input tells the turret when to start firing and when to stop. A very important thing to remember is that many inputs and outputs are 0/1 outputs, also known as true/false. Essentially, they say if something is true, then output 1, else, output 0. For the turret, if it's "Fire" input is 1, it fires the turret. Else, it doesn't.

As you probably noticed, we wired the Turret's "Fire" input to a "Greater Than" gate. First, let's talk about the ranger. A Wire Ranger is a device that sends a beam as far as you want, and detects whenever that beam is crossed (a lot like a fancy security system). When that beam is crossed, it can all sorts of information about the thing that crossed the beam. In our case, we checked "Output Distance" for the Ranger; this setting tells the Ranger to show how far an object is from the ranger once it crosses the beam. By checking "Default to zero", this sets the default Distance output as 0. So now, if nothing is crossing the beam, it outputs 0. If something DOES cross the beam, it outputs something greater than 0.

I'm guessing the gears are probably turning; it's starting to make sense, no? See, the "Greater Than" gate is one of those 0/1 and true/false devices I told you about earlier. The gate checks whether something is greater than something else. If something IS greater than the other (A>B), then it returns true, or 1. If not, (A<B) then it returns false, or 0. A and B default values are 0. So what we do is wire the "A" of the Greater Than to the "Distance" output of the ranger. Remember, the ranger defaults to zero unless something crosses the line. So what we're doing is saying "when something crosses the beam, Distance becomes greater than zero. When it's greater than zero (or B, because B = 0), then the Greater Than chip outputs one, thus firing the turret." So now, you have an autofiring turret.

Wrapping Up

This is pretty much all I have to offer for now. Hopefully the door to using wire is at least slightly cracked, and you can begin using the greatest GMod addon ever. One important thing; make sure to keep trying to get better with wiremod. If you can make all of the easy level things, move on to the medium level contraptions. If that's not hard enough, try the advanced. And if you're REALLY bright, make the tutorials! Help out those guys just like you!

I don't have any other tutorials in the "Easy" section, but I currently have four different tutorials (two medium, two advanced), which are:

Medium

Advanced


Video

Baked's Video Tutorial

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox