Forums » Technology » Flight Sim Controllers » Control Manager (CH Products) » Doing something based on current mode Active Topics You are not logged in. [Log In] [Register User]
Page 1 of 2 1 2 >
Topic Options
Rate This Topic
Hop to:
#3427036 - 11/05/11 09:39 PM Doing something based on current mode
WileECoyote Offline
Member

Registered: 01/09/11
Posts: 871
Loc: Argentina
Hello gentlemen.

I'm trying to do something pretty easy... but I don't seem to be able to.

What I want is combine the mode switch (button 3) with a keypress, so I can send a keystroke to the sim and at the same time switch to another mode on the stick.

So, for example:

Im in mode 1 (NAV), and then press button3, to go to my AG mode, then stick not only switches to mode 2, but also sends Shift-6 to my sim. Obviously, to be able to know what key to send, I first need to know what mode I'm in. I would think that I can query the CURRENTMODE variable, something like this:

Code:
if (JS1.b3) then
  if (CURRENTMODE == MODE1) then
    SendKey('Shift-6') <--- No idea how to do that.
    CURRENTMODE= MODE2
  else if (CURRENTMODE == MODE2) then...


But I'm getting the error: "Bit value expected but CURRENTMODE found"...

Any idea about how to accomplish this?

Thanks.
_________________________
When you're feeling sad, just remember that somewhere in the world, there's someone pushing a door that says "pull".

Top
#3427056 - 11/05/11 10:10 PM Re: Doing something based on current mode [Re: WileECoyote]
531 Ghost Offline
USMC
Veteran

Registered: 09/17/02
Posts: 10873
Loc: Elizabeth City NC
Sounds like you may be looking for a IF/THEN/ELSE ?
_________________________
Originally Posted By: Abraham Lincoln
America will never be destroyed from the outside. If we falter and lose our freedoms, it will be because we destroyed ourselves.


For your CH Products programming needs, come on over to: The CH-Hangar
Current System Specs

Top
#3427063 - 11/05/11 10:16 PM Re: Doing something based on current mode [Re: WileECoyote]
WileECoyote Offline
Member

Registered: 01/09/11
Posts: 871
Loc: Argentina
Thanks Ghost, but nope.

The problem is the evaluation per se, the if (CURRENTMODE == MODE1) part. I played around with the if statement and have no problems with it. The problem comes when trying to evaluate the CURRENTMODE variable.
_________________________
When you're feeling sad, just remember that somewhere in the world, there's someone pushing a door that says "pull".

Top
#3427386 - 11/06/11 10:46 AM Re: Doing something based on current mode [Re: WileECoyote]
531 Ghost Offline
USMC
Veteran

Registered: 09/17/02
Posts: 10873
Loc: Elizabeth City NC
banghead That'll teach me to skim over the obvious!

Sorry

Yes, it is easy and no need for scripting actually. Follow along...



"gove" fat fingerd that one... biggrin







Now, simply do the same for modes 2 and 3 with the desired keys/macros and you'll be set with NAV/AA/AG modes. All you'll have to do is look at the LED on the base of the FighterStick. For me, I use Green = NAV, Red = AA and Amber = AG


Edited by 531 Ghost (11/06/11 10:52 AM)
Edit Reason: "gove"
_________________________
Originally Posted By: Abraham Lincoln
America will never be destroyed from the outside. If we falter and lose our freedoms, it will be because we destroyed ourselves.


For your CH Products programming needs, come on over to: The CH-Hangar
Current System Specs

Top
#3427424 - 11/06/11 11:23 AM Re: Doing something based on current mode [Re: WileECoyote]
WileECoyote Offline
Member

Registered: 01/09/11
Posts: 871
Loc: Argentina
Ah, thank you very much mister Ghost. But still... yeah, I know... Im still getting headaches with this. The problem now is that I can't seem to get a proper sequence out of this.

I followed your mini tut, and asigned the keys 4, 5 and 6 to each mode. Now when I press then, I get kind of random failures, for instance, 456456446564564565456. Any idea what could cause it. My first thought was that I was pressing the keys to quickly when testing them, but nope, even if I press them with enough between each other, the problem persists.
_________________________
When you're feeling sad, just remember that somewhere in the world, there's someone pushing a door that says "pull".

Top
#3427753 - 11/06/11 05:14 PM Re: Doing something based on current mode [Re: WileECoyote]
Bob Church Offline
Member

Registered: 08/03/00
Posts: 306
Loc: USA
Hi WileECoyote,

I'm assuming you've moved to Ghost's method, just programming the character to the Mode button (3) directly. It creates some timing problems, there are just too many "clocks" running asynchronously and it's easy to pick up a repeating character or a character coming for the wrong mode. It's not usually a problem because when it's a separate button the mode change is usually complete before the character gets sent. You might still get a duplicate now and then, but there's no more risk than with a normal press.

It's actually an easy thing to fix. You need to force the character to not repeat and you need to force it after the mode change is completed. Program it as Ghost says, but for Button 3 put:

NULL

in for the Normal "Press" character on all three Modes, and then put the character(s) you want to send in the Normal "Release" box. The mode changes on the press, so it's always complete when you release the button (if it registers at all), and seems to clear things up when I run it here.

Give it a try and see if it will work for you!

Best regards,

- Bob

The StickWorks
http://www.stickworks.com


Edited by Bob Church (11/06/11 05:14 PM)

Top
#3427870 - 11/06/11 07:50 PM Re: Doing something based on current mode [Re: WileECoyote]
WileECoyote Offline
Member

Registered: 01/09/11
Posts: 871
Loc: Argentina
Absolutely perfect. Thank you for the help. bananadance
_________________________
When you're feeling sad, just remember that somewhere in the world, there's someone pushing a door that says "pull".

Top
#3427913 - 11/06/11 08:56 PM Re: Doing something based on current mode [Re: WileECoyote]
Bob Church Offline
Member

Registered: 08/03/00
Posts: 306
Loc: USA
Hi WileECoyote,

You're quite welcome! I'm glad it was some help!

Have fun!

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

Top
#3428165 - 11/07/11 07:49 AM Re: Doing something based on current mode [Re: WileECoyote]
531 Ghost Offline
USMC
Veteran

Registered: 09/17/02
Posts: 10873
Loc: Elizabeth City NC
Originally Posted By: Bob Church
It's actually an easy thing to fix. You need to force the character to not repeat and you need to force it after the mode change is completed. Program it as Ghost says, but for Button 3 put:

NULL

in for the Normal "Press" character on all three Modes, and then put the character(s) you want to send in the Normal "Release" box. The mode changes on the press, so it's always complete when you release the button (if it registers at all), and seems to clear things up when I run it here.



Should've tested in my test.map, thanks Bob!
_________________________
Originally Posted By: Abraham Lincoln
America will never be destroyed from the outside. If we falter and lose our freedoms, it will be because we destroyed ourselves.


For your CH Products programming needs, come on over to: The CH-Hangar
Current System Specs

Top
#3428441 - 11/07/11 02:28 PM Re: Doing something based on current mode [Re: WileECoyote]
Bob Church Offline
Member

Registered: 08/03/00
Posts: 306
Loc: USA
Hi Ghost,

Yer welcome! It's just a little tricky, things can get out of order pretty easily. When I ran the map, I saw just what he described, but looking at it I could see that it was just not switching modes in time or getting a duplicate and I guessed the characters weren't blocked from repeating on the press side. I played around a bit and it was just an easy way to handle both. The press side always switched the mode first and the release side always acts like there's a NULL after it to stop the repeat, so it just all fit together. The only way I've been able to get a glitch out of it was working button 3 very rapidly. Sometimes that can cause it to skip, I think you end up just changing modes before it has time to react, but so long as the button gets a solid click it seems to be unbreakable. You could probably work around even that with a little CMS file and flag or two, but I don't think it's really a problem in any case.

Anyway, a handy trick for the few times you want to send something and change modes at the same time.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

Top
Page 1 of 2 1 2 >
Topic Options
Rate This Topic
Hop to:

Moderator:  RacerGT 
 
Quick Search
Recent Articles
Support SimHQ
.
Social


Recent Topics
Tablet Suggestions
by Weaponz248
05:28 PM
An SR-71 story...
by Peally
04:35 PM
Mount & Blade: anyone else playing this?
by VMIalpha454
03:29 PM
Jurassic World trailer
by RossUK
12:49 PM
How do you spend 500,000,000 making a video game.
by marko1231123
10:38 AM
Most compelling character arcs from TV shows?
by PanzerMeyer
09:12 AM
TV: State of Affairs
by EAF331 MadDog
08:46 AM
Do You Travel? Where?
by Plainsman
11:11 PM
Merrrrry Christmas from Poopourri
by Bill_Grant
08:18 PM
Ever see a Semi jump a ramp?
by Timothy
07:42 PM
 

Forum Use Agreement | Privacy Statement
Copyright 1997-2014, SimHQ Inc. All Rights Reserved.