Go Back   Wiremod Forums > Wiremod Skills > Wiremod Tutorials

Wiremod Tutorials Post your wiremod tutorials/guides here.

Reply
 
LinkBack Thread Tools Display Modes
Old 11-19-2008   #1 (permalink)
Newbie
 
Alchemise's Avatar
 

Join Date: Oct 2008
Posts: 7
Alchemise is on a distinguished road
Default Expression Help - Gearbox

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 =/
Alchemise is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 11-19-2008   #2 (permalink)
Kanguru

 
l3ulletje's Avatar
 
Disco Racer Champion!
Join Date: Jun 2008
Posts: 742
l3ulletje has a spectacular aura aboutl3ulletje has a spectacular aura about
Default Re: Expression Help - Gearbox

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--
The clutch is now working loose from the gears.
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 0 being reverse.
State 1-3 being the gears.

And the inputs of course.
__________________
My signature has a point.
Quote:
Originally Posted by Squeakyneb View Post
when l3ulletje says do it, do it.
That

Last edited by l3ulletje; 11-19-2008 at 12:48 PM..
l3ulletje is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-20-2008   #3 (permalink)
Newbie
 
Alchemise's Avatar
 

Join Date: Oct 2008
Posts: 7
Alchemise is on a distinguished road
Default Re: Expression Help - Gearbox

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)
Alchemise is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -7. The time now is 12:24 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.

Page top