E2 And Plugs with Buttons
From GMod Wiki
Contents |
E2 + Plugs and Buttons
- (NOTE! You dont need to use E2 to achieve the same result as in this, but this tutorial will help you on your way to the wonderful world of E2)
- Using plugs in E2 is very much fun! And if you add buttons to it, its even more fun!
- This tutorial will tell you how to connect E2 with plugs and buttons.
Creating E2 with Plugs and Buttons
- Building:
- 1. Start by creating a PHX 1X1 plate.
- 2. Choose the Button tool. Choose any button you would like
- 3. Buttons values: Value On = 1, Value Off = 0, Toggle ON
- 4. Place the Button somewhere in the PHX plate.
- 5. Choose the Plug tool.
- 6. Place the Socket somewhere in the PHX plate.
- 7. Attach the Plug to the Socket. Make sure the Plug is getting a value of 1!.
- 8. Choose the Screen tool.
- 9. Screen true values: Only one value, Use Bigger font on single value screen
- 10. Place the Screen somewhere in the PHX plate.
- 11. Choose the Expression2 tool under Wire tab.
- 12. Choose New Expression
- 13. Copy and Paste this code to it:
- The Expression 2 Code
- 1@name Plug and Button
- 2@inputs Plug Button
- 3@outputs IsOn
- 4@persist
- 5if(Plug & Button == 1) {IsOn = 1}
- 6else {IsOn = 0}
- Wiring:
- 1. Wire the E2 Plug to the Socket.
- 2. Wire the E2 Button to the Button.
- 3. Wire the E2 IsOn to the Screen
- You are finished! Test it by attaching the Plug to the Socket and pushing the button. Does the screen show the number 1? Try de-attaching the Plug from the Socket. Is the screen showing 1 anymore?
Ending
- Here is some Plug related tutorials made by me
--Funley--