Simple Circuits and Inputs/Outputs
Wiremod, a powerful addon for Garry's Mod, allows players to create complex logic circuits and interactive machines. This section introduces the basics of simple circuits, focusing on inputs, outputs, and fundamental logic gates.
Wiremod transforms Garry's Mod into a virtual electronics lab. By connecting various components with virtual wires, You can create everything from simple light switches to complex automated systems. The core concept revolves around inputs (sals that trigger actions) and outputs (sals that represent states or results), linked together by logic gates and other functional entities.
Core Wiremod Components:
- Inputs: Entities that provide sals. Examples include:
- Button: Outputs a pulse when pressed.
- Lever: Outputs a continuous state (on/off).
- Timer: Outputs a pulse after a set delay.
- Constant: Outputs a fixed value (e.g., 0 or 1).
- Outputs: Entities that react to sals or represent states. Examples include:
- Light: Turns on or off based on input.
- Speaker: Plays a sound when activated.
- Screen: Displays information or images.
- Motor: Rotates or moves when powered.
- Logic Gates: These are the fundamental building blocks of digital circuits. They perform logical operations on binary inputs (0 or 1) to produce an output.
- AND Gate: Output is 1 only if ALL inputs are 1.
- OR Gate: Output is 1 if ANY input is 1.
- NOT Gate: Inverts the input (0 becomes 1, 1 becomes 0).
- XOR Gate: Output is 1 if the inputs are DIFFERENT.
Connecting Components:
The Wiremod Tool Gun is used to connect components. You typically:
- Select the Wiremod Tool Gun.
- Left-click on the input or output of one component.
- Right-click on the input or output of another component.
- A virtual wire will connect them, allowing sals to flow.
Building a Simple Circuit: Controlling a Light with a Button
- Spawn a Button: Find the "Button" entity in the Wiremod tab of the spawn menu.
- Spawn a Light: Find the "Light" entity.
- Connect: Use the Wiremod Tool Gun to connect the Button's "Pressed" output to the Light's "On" input.
- Test: Press the button. The light should turn on while the button is held or briefly, depending on the button type.
Building a Simple Circuit: Using a Timer to Activate a Speaker
- Spawn a Timer: Find the "Timer" entity.
- Spawn a Speaker: Find the "Speaker" entity.
- Configure Timer: Use the timer's properties to set a delay (e.g., 5 seconds).
- Connect: Connect the Timer's "Triggered" output to the Speaker's "Play" input.
- Test: Activate the timer (often by giving it a sal, or it might run automatically). After the set delay, the speaker should play a sound.
Tips for Beginners:
- Start Small: Master basic circuits before attempting complex machines.
- Understand Logic: Familiarize yourself with how logic gates work.
- Use the Console: Wiremod often outputs debugging information to the console.
- Experiment: Don't be afraid to try different combinations of components.
Wiremod's input/output system and logic gates provide a powerful foundation for creating interactive elements and complex machinery within Garry's Mod.