Forums » Technology » Flight Sim Controllers » T.A.R.G.E.T. (Thrustmaster) » Warthog Views Script ? Active Topics You are not logged in. [Log In] [Register User]
Page 1 of 3 1 2 3 >
Topic Options
Rate This Topic
Hop to:
#4020955 - 10/10/14 06:14 PM Warthog Views Script ?
Lightning Offline
Junior Member

Registered: 10/08/14
Posts: 7
Loc: BC Canada
Hello
Just by way of background, let me tell you that I have been a Thrustmaster user since the beginning, WAY back.
I even wrote all the files used in the original Ver2 install disk from Thrustmaster for the FCS Pro / WCS Mark II.
Have written MANY files for the F16 / F22 / Cougar systems.
So you see I'm not just lazy, maybe it's cause I'm old (67) :), but I'm so far totally baffled by the programming language of my brand new Warthog frown
Thought I could use Target software to program a simple H1 (Hat 1) file for views in FS9 / Combat Flight Simulator 1&2, but it doesn't allow for anything more than 4 positions, no angles.
Tried to figure out Script Editor to no avail frown
Thinking maybe I spent $800 for new setup and stand by mistake?
Would someone please be so kind as to help me out with this?
As you can see from below, all I want is to be able to have all 8 views with Button S3 as an "UP" modifier so I can do a little flying and combat.
I have been away from flightsims for a few years but, would like to get my feet wet again.

Again, any help would be VERY much appreciated.

My Old File:-

# FS2004.tmj

Rem #################################################################
Rem
Rem Flight Sim 2004
Rem for
Rem Flight Sim 2004
Rem
Rem by Robert "Lightning-=BS=-CO" Baum
Rem
Rem Last modified: 10 January 2004, 10:42 am
Rem
Rem Controllers: Thrustmaster Cougar
Rem
Rem #################################################################
Rem
Rem This file works equally well with CFS1 or CFS2
Rem Views work as in Hat1 POV, with the S3 key as "UP" modifier.
Rem All other buttons assigned in FS preferences
Rem #################################################################

USE ALL_DIRECTX_BUTTONS
USE MDEF #FS2004.tmm

BTN H1U /P USB (D60 D5D)
/R USB (U60 U5D)

BTN H1UL /H KP7
BTN H1UR /H KP9
BTN H1L /H KP4
BTN H1R /H KP6
BTN H1D /H KP2
BTN H1DL /H KP1
BTN H1DR /H KP3

BTN S3 /H KP5

Top
#4022066 - 10/14/14 05:31 AM Re: Warthog Views Script ? [Re: Lightning]
Nicu Offline
Junior Member

Registered: 10/31/10
Posts: 77
Advice: use first the GUI to generate simple scripts, then examine the scripts to learn how they are made.
Also, the manual have some good examples.

Regarding your code, I tried to translate it (please let me know if I missed something).
Normally the translation from FOXY is quite straightforward, but because you need the HAT corners and TARGET does not translate these corners to virtual keys, I needed to use the Event Handler.

Code:
include "target.tmh"

//program startup
int main()
{
    if(Init(&EventHandle)) return 1; // declare the event handler, return on error
	
    POVKeys[0] = CHAIN(KP8, KP5);
    MapKey(&Joystick, S3, KP5); // BTN S3 /H KP5
}

//event handler
int prevKey = -1;
int POVKeys[] = {KP8, KP9, KP6, KP3, KP2, KP1, KP4, KP7};
int EventHandle(int type, alias o, int x)
{
    if((&o == &Joystick) & (x == POV))
    {
	if(prevKey != -1) ActKey(POVKeys[prevKey / 45]);
	prevKey = o[x];
	if(prevKey != -1) ActKey(KEYON + POVKeys[prevKey / 45]);
    }
    else DefaultMapping(&o, x);
}

Top
#4024012 - 10/18/14 01:02 AM Re: Warthog Views Script ? [Re: Lightning]
Lightning Offline
Junior Member

Registered: 10/08/14
Posts: 7
Loc: BC Canada
Thank you for the reply, just found it smile

Will try it tomorrow.

Got buttons programmed in 6 installs of FS9 and 3 of FSX using standard DX USB buttons and it works ok, but can't imagine Dog Fighting without my up diagonals (lose sight lose fight:) )

Can't wait to try your code in Combat Flight Sims (and later other Combat Sims as well)

Been a long time since I did much flying, but I may even get back into War Birds etc.

Thanks again.

PS:- I did actually spend a bunch more time reading the manuals, but it hurt my old brain smile

Top
#4030352 - 11/01/14 02:56 PM Re: Warthog Views Script ? [Re: Lightning]
Lightning Offline
Junior Member

Registered: 10/08/14
Posts: 7
Loc: BC Canada
Ok, just now had a chance to try this.
RL got in my way last couple of weeks frown

Created FS9 Corner Views.tmc

Ran it from TARGET Script Editor and it does indeed give me the corner views, and S3 gives up view, but S3 does not work as a modifier while in one of the other views.

Whole idea is to be able to track a target in any view from just the S3 and the hat.

If I just had one file that worked I hope that I could adapt this to any other flight sims I might want to fly.
I had everything under the sun programmed on my old Thrustmaster joysticks, but this new Warthog is getting more and more frustrating frown

Top
#4031032 - 11/03/14 09:03 AM Re: Warthog Views Script ? [Re: Lightning]
Nicu Offline
Junior Member

Registered: 10/31/10
Posts: 77
Try to delete the following line from <main>:
Code:
POVKeys[0] = CHAIN(KP8, KP5);

I added it because your FOXY script seems to do it, but I don't see its meaning...

Now, the script presses KP1,2,3,4,6,7,8,9 according with the HAT1 position, and KP5 when S3 is pressed.
I can not test the script in game, as I don't have it installed. You can use <Event Tester> to verify if the keys are correctly generated, and to detail me what else do you need.


Edited by Nicu (11/03/14 09:04 AM)

Top
#4033352 - 11/07/14 10:08 PM Re: Warthog Views Script ? [Re: Lightning]
Lightning Offline
Junior Member

Registered: 10/08/14
Posts: 7
Loc: BC Canada
Ok tried it and still no go, but I did run the script from Script Editor and then tried to see what happens in notepad.
It DID generate the proper keypad strokes, but here's the thing, in Game Controllers, it still seems to be generating DX hat keys.
Been a long time since I did any TM programming, but shouldn't the script disable the DX inputs from the hat?

Top
#4034044 - 11/10/14 04:46 AM Re: Warthog Views Script ? [Re: Lightning]
Nicu Offline
Junior Member

Registered: 10/31/10
Posts: 77
In order to bypass the DX hat, you may add o[x] = -1 in EventHandle, as below:
Code:
int EventHandle(int type, alias o, int x)
{
    if((&o == &Joystick) & (x == POV))
    {
	if(prevKey != -1) ActKey(POVKeys[prevKey / 45]);
	prevKey = o[x];
	if(prevKey != -1) ActKey(KEYON + POVKeys[prevKey / 45]);
        o[x] = -1;
    }
    else DefaultMapping(&o, x);
}

Top
#4034668 - 11/11/14 12:09 PM Re: Warthog Views Script ? [Re: Lightning]
Lightning Offline
Junior Member

Registered: 10/08/14
Posts: 7
Loc: BC Canada
Hi Nico
Been trying out your code (first one), but just noticed I am getting this error message.


Running script: C:\Documents and Settings\PC Gamer\My Documents\Thrustmaster Files\TM Warthog Corner Views.tmc
Compile Error: Name already defined: EventHandle in TM Warthog Corner Views.tmc at line 29

Sorry to be a pest but this whole process is just beyond my programming skills frown


Edited by Lightning (11/11/14 12:11 PM)

Top
#4034964 - 11/12/14 03:03 AM Re: Warthog Views Script ? [Re: Lightning]
Nicu Offline
Junior Member

Registered: 10/31/10
Posts: 77
No problem.
Maybe you copied the EventHandle function from my last post over the script from my first one, instead of simply adding o[x]=-1 as indicated.
I will give you the full script again, just get it and replace the old one with this:

Code:
include "target.tmh"

//program startup
int main()
{
    if(Init(&EventHandle)) return 1; // declare the event handler, return on error
	
//    POVKeys[0] = CHAIN(KP8, KP5);
    MapKey(&Joystick, S3, KP5); // BTN S3 /H KP5
}

//event handler
int prevKey = -1;
int POVKeys[] = {KP8, KP9, KP6, KP3, KP2, KP1, KP4, KP7};
int EventHandle(int type, alias o, int x)
{
    if((&o == &Joystick) & (x == POV))
    {
	if(prevKey != -1) ActKey(POVKeys[prevKey / 45]);
	prevKey = o[x];
	if(prevKey != -1) ActKey(KEYON + POVKeys[prevKey / 45]);
        o[x] = -1;
    }
    else DefaultMapping(&o, x);
}

Top
#4036340 - 11/15/14 01:05 PM Re: Warthog Views Script ? [Re: Lightning]
Lightning Offline
Junior Member

Registered: 10/08/14
Posts: 7
Loc: BC Canada
Hello again.
I have tried this code in Target Script editor (FS9 Corner Views.tmc)

//Code:
include "target.tmh"

//program startup
int main()
{
if(Init(&EventHandle)) return 1; // declare the event handler, return on error

POVKeys[0] = CHAIN(KP8, KP5);
MapKey(&Joystick, S3, KP5); // BTN S3 /H KP5
}

//event handler
int prevKey = -1;
int POVKeys[] = {KP8, KP9, KP6, KP3, KP2, KP1, KP4, KP7};
int EventHandle(int type, alias o, int x)
{
if((&o == &Joystick) & (x == POV))
{
if(prevKey != -1) ActKey(POVKeys[prevKey / 45]);
prevKey = o[x];
if(prevKey != -1) ActKey(KEYON + POVKeys[prevKey / 45]);
o[x] = -1;
}
else DefaultMapping(&o, x);
}


Compiles and runs without errors.
All views are perfect, but the thing is...none of the axis (joystick or throttle) do anything.
Don't show any movement in Windows Game Controller applet, or in game.
What am I doing wrong here?
Can I not just run the script from the Target Script Editor?
Can I add this to an .FCF file and run from Target GUI?
Again thanks for your patience and help.


Edited by Lightning (11/15/14 01:13 PM)

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

Moderator:  RacerGT 
 
Quick Search
Recent Articles
Support SimHQ
.
Social


Recent Topics
Women's libido is... complicated.
by Desert Eagle
Yesterday at 03:43 PM
Sam Gordon
by Chaz
Yesterday at 03:22 PM
Mull of Kintyre
by Coot
Yesterday at 11:41 AM
Whoah and Double Holy Smokes! A Crimson Skies-like newcomer?
by Coot
Yesterday at 11:05 AM
Could you send your parents to jail for doing this to you... I sure could!
by Top Gun
Yesterday at 10:26 AM
I Love the Dead
by Haggart
Yesterday at 09:18 AM
Nostalgia
by Ironside
Yesterday at 09:10 AM
Blenheim flies again
by KraziKanuK
Yesterday at 07:49 AM
Class Act, Canada
by Timothy
11/20/14 11:58 PM
Goodbye Kiowa
by DetCord
11/20/14 09:15 PM
 

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