|
| |||||||
| Wiremod Tutorials Post your wiremod tutorials/guides here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Newbie ![]() Join Date: Oct 2008
Posts: 7
![]() | Howdy. I'm just about finished making my gearbox for a little engine I made. Slapper style, just made to fit inside a PHX Wire Metal 1x1x2b Box. Works nice, needs another couple of slappers but hey, its a trial run. I made a gearbox from the same sized box and slapped it underneath. It all worked fine, but I decided to remake the gearbox to have more gears. So I remade it, and its all fine and dandy - but now I have too many gears to easily swap. I've got 3 forward speed gears, a reverse and a clutch. These are all controlled by weld latches, and I'm sratching me head working out how to wire this up. Essential, the expression needs to be thus: Inputs: 1st Gear 2nd Gear 3rd Gear Reverse Clutch Outputs: Latch 1 Latch 2 Latch 3 Latch 4 Latch 5 Latch 6 By pulling any of the inputs high momentarily, you put the system into a different state. The system stays in that state untill another input goes high etc. Toggle effect. Only exception is the clutch, where the one input clutch toggles the clutch on and off. But that one isn't too bad since it only controls one latch The Latches need to be like this for each state: Clutch Off 1 - X 2 - X 3 - X 4 - X 5 - X 6 - 1 Clutch On 1 - X 2 - X 3 - X 4 - X 5 - X 6 - 1 1st Gear 1 - 0 2 - 1 3 - 0 4 - 0 5 - 1 6 - X 2nd Gear 1 - 1 2 - 0 3 - 0 4 - 0 5 - 1 6 - X 3rd Gear 1 - 0 2 - 0 3 - 0 4 - 1 5 - 0 6 - X Reverse 1 - 0 2 - 0 3 - 1 4 - 0 5 - 1 6 - X (X means indeterminate/doesn't matter) I think that about covers everything. It isn't essential to clutch whilst changing gears (at least I don't think it is yet) but it might help. At anyrate, I can sort that out with other logic. Any help would be greatly appreciated. >Alch (see me on Sax's Server =P) Last edited by Alchemise; 11-19-2008 at 11:42 AM.. Reason: Another damn mistake =/ |
| | |
| Sponsored Links | |
| | #2 (permalink) |
| Kanguru ![]() ![]() | Inputs: 1st Gear 2nd Gear 3rd Gear Reverse Clutch = 5 in total Outputs: Latch 1 Latch 2 Latch 3 Latch 4 Latch 5 Latch 6 = 6 in total I assume that 6th isn't needed? Clutch Off 1 - X 2 - X 3 - X 4 - X 5 - X 6 - 1 Clutch On 1 - X 2 - X 3 - X 4 - X 5 - X 6 - 1 Exactly the same. I guess Clutch off should be 6 - 0 ? Anyway, I'll give you a headstart with the diagrams you have. I don't think you'll have any problems changing it. Code: @name GearBox
@inputs Gear1 Gear2 Gear3 Reverse Clutch
@outputs Latch1 Latch2 Latch3 Latch4 Latch5 Latch6
@persist State
if (~Clutch&Clutch) {Latch6=!Latch6}
if (~Gear1&Gear1) {State=1}
if (~Gear2&Gear2) {State=2}
--Add the rest--
if (State==1) {
Latch1=0 Latch2=1 Latch3=0 Latch4=0 Latch5=1
}
if (State==2) {
Latch1=1 Latch2=0 Latch3=0 Latch4=0 Latch5=1
}
--Add the rest--
You might want to delete everything relating to clutch in this expression. Now you are toggling the clutch on and off. Holding a button to unclutch change gear seems a lot more handy and life like to me. (I don't need to tap my clutch pedal, change gear, and tap the clutch pedal in my car anyway) Good luck! Big edit: On second thought. I think the whole Gear1-3 and Reverse input are a bit strange. Why not use GearUp and GearDown? In that case replace the first part with: Code: if (~Clutch&Clutch) {Latch6=!Latch6}
if (~GearUp&GearUp&State<3) {State+=1}
if (~GearDown&GearDown&State>0) {State-=1}
State 1-3 being the gears. And the inputs of course.
__________________ My signature has a point. That Last edited by l3ulletje; 11-19-2008 at 12:48 PM.. |
| | |
| | #3 (permalink) |
| Newbie ![]() Join Date: Oct 2008
Posts: 7
![]() | The moment I posted this someone on Sax's Server made it for me anyways but thanks. Its nice to see it in code, not just a chip. I'm having some problems at the moment, but its producing the correct tables; which leads me to believe I've given the wrong tables or something. I'll go over it again soon and work it out. The mechanical side was always easier =/ As for the clutch, the gearbox isn't strictly the same as a car gearbox in that you can change gear without engaging the clutch. Its more of a neutral gear in car terms, but strictly speaking to disengages the drive so its a clutch =P. Designing gearboxs in gmod is somewhat easier than in RL though, since last time I looked weld latch wasn't in my toolbox =P. Anyways, its quite a tidy little system and ocne the expression is sorted it will be all nice. If anyone is interested/thinks its a good idea I can make a tutorial vid on putting it together. rawr, >Alch (Sax's Server FTW) |
| | |
| Sponsored Links | |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|