Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
#4017942 - 10/04/14 08:54 AM Listmode function help  
Joined: Apr 2005
Posts: 43
Rooks Offline
Junior Member
Rooks  Offline
Junior Member

Joined: Apr 2005
Posts: 43
Adelaide, AU
Hi
I'm trying to extend myself in terms of writing my own stuff in Target for a DCS: MiG-21bis profile (Script Editor not GUI). I have no prior programming experience so this is quite challenging and rewarding in itself as I chip away.

I'm trying to replicate the listmode code on pg. 51 of the manual where you can cycle a list back/forwards
Click to reveal..

include "FC2_MIG_29C_Macros.ttm"
int listmode, index; //master modes list function & index
int main()
{
if(Init(&EventHandle)) return 1;
listmode = SEQ(_8__Gunsight_Reticle_Switch,
_7__Air_To_Ground_Mode,
_6__Longitudinal_Missile_Aiming_Mode,
_5__Close_Air_Combat_HMD_Helmet_Mode,
_4__Close_Air_Combat_Bore_Mode,
_3__Close_Air_Combat_Vertical_Scan_Mode,
_2__Beyond_Visual_Range_Mode,
_1__Navigation_Modes);
//China Hat is used for Modes selection---------------
MapKey(&Throttle, CHF, EXEC("index = (index+1)%8; ActKey(KEYON+PULSE+X(listmode, index));")); // forward
MapKey(&Throttle, CHB,EXEC("index = (index+7)%8; ActKey(KEYON+PULSE+X(listmode, index));")); // 7 is 8-1
= backward
}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
}


The problem is after compiling and attempting to run the script I get:
Runtime Error: Symbol not found: _11__S3_4 in main ( line 11 in MiG-21bis.tmc )

aaaand I'm stuck I have no idea how to fix this or where it's gone wrong. Any help would be much appreciated
I'll include my woeful work in progress biggrin

Click to reveal.. (MiG-21bis.tmc)

include "target.tmh"
include "MiG-21bis-Macro.ttm"

int listmode, index;

int main()
{
if(Init(&EventHandle)) return 1;

// Weapon Selection List ****************
listmode = SEQ(
_11__S3_4,
_10__S1_2,
_9__B1_4,
_8__B3_4,
_7__B1_2,
_6__AA3_4,
_5__AA1_2,
_4__AA4,
_3__AA3,
_2__AA2,
_1__AA1);


//JOYSTICK*******************************

MapKey(&Joystick, TG1, FireGuns);
MapKey(&Joystick, S2, WeaponRelease);
MapKey(&Joystick, S4, WheelBrakes);
MapKey(&Joystick, H2U, TargetLock);
//MapKey(&Joystick, H2D, );

//Weapon Selection List****************************************
MapKey(&Joystick, H2R, EXEC("index = (index+1)%11; ActKey(KEYON+PULSE+X(listmode, index));")); // forward
MapKey(&Joystick, H2L, EXEC("index = (index+10)%11; ActKey(KEYON+PULSE+X(listmode, index));")); // 10 is 11-1 = backward
//***************************************************************
MapKey(&Joystick, H1U, PULSE+TrimPitchDown);
MapKey(&Joystick, H1D, PULSE+TrimPitchUp);
//MapKey(&Joystick, H1L, );
//MapKey(&Joystick, H1R, );

MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Joystick, JOYX, 0, 0, 0, 0, 0);
MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Joystick, JOYY, 0, 0, 0, 0, 0);

//THROTTLE************************************

MapKey(&Throttle, SPDF, PULSE+AirBrakesOn);
MapKey(&Throttle, SPDM, PULSE+AirBrakesOff);
MapKey(&Throttle, SPDB, PULSE+AirBrakesOn);
MapKey(&Throttle, BSF, PULSE+RadarOn);
MapKey(&Throttle, BSM, PULSE+RadarStandby);
MapKey(&Throttle, BSB, PULSE+RadarOff);
MapKey(&Throttle, LTB, SEQ(PULSE+SAURecovery, PULSE+SAUCancel));
MapKey(&Throttle, FLAPU, PULSE+FlapsUp);
MapKeyR(&Throttle, FLAPU, PULSE+FlapsDown);
MapKey(&Throttle, FLAPD, PULSE+FlapsDown);
MapKeyR(&Throttle, FLAPD, PULSE+FlapsUp);
MapKey(&Throttle, CSU, TDCUp);
MapKey(&Throttle, CSD, TDCDn);
//MapKey(&Throttle, CSL,);
//MapKey(&Throttle, CSR,);
MapKey(&Throttle, LDGH, SEQ(CHAIN(PULSE+GearLockReleased, PULSE+GearHandleUp, D(4000), PULSE+GearHandleNeutral, PULSE+GearLockEngaged), CHAIN(PULSE+GearHandleDown, D(4000),PULSE+GearHandleNeutral)));

MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, SCX, 0, 0, 0, 0, 0);
MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, SCY, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetJCurve(&Throttle, THR_RIGHT, 50, 50);
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_LEFT, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_FC, 0, 0, 0, 0, 0);

}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
}

Click to reveal.. (MiG-21bis-Macro.ttm)

// Gear / Brakes / Chute ************************
define GearHandleDown L_SHIFT+'g'
define GearLockEngaged R_CTL+'g'
define GearLockReleased R_SHIFT+'g'
define GearHandleNeutral L_CTL+'g'
define GearHandleUp 'g'

define ABSOn R_CTL+R_SHIFT+'w'
define ABSOff R_SHIFT+'w'
define DragButtonOpen R_ALT+R_CTL+'d'
define DragButtonClosed R_ALT+'d'
define DragChute 'p'
define DragChuteDisconnect R_CTL+R_SHIFT+'p'
define EmergencyBrakeOn L_CTL+L_SHIFT+'w'
define EmergencyBrakeOff L_CTL+'w'
define NoseBrakeOn L_ALT+L_CTL+'w'
define NoseBrakeOff L_ALT+'w'
define WheelBrakes 'w'

// ENGINE ****************************************

define AfterburnerMaxOff R_ALT+R_SHIFT+']'
define AfterburnerMaxOn R_ALT+']'
define EmergencyAfterburnerOff L_ALT+L_CTL+'e'
define EmergencyAfterburnerOn L_ALT+'e'
define DropCentreFuelPod R_CTL+PGUP
define DropWingFuelPod R_CTL+PGDN
define WingFuelPodOpen R_CTL+R_SHIFT+PGDN
define WingFuelPodClosed R_CTL+PGDN

// FLIGHT CONTROLS ***********************************

define AirBrakesOn 'c'
define AirBrakesOff 'd'
define FlapsDown 'f'
define FlapsUp L_SHIFT+'f'
define FlapsTakeOff L_ALT+'f'
define FlapsLanding L_CTL+'f'
define TrimPitchDown L_SHIFT+'t'
define TrimPitchUp L_CTL+'t'

// WEAPONS ********************************

define WeaponRelease L_ALT+SPC
define FireGuns SPC
define Reload1 L_ALT+'1'
define Reload2 L_ALT+'2'
define Reload3 L_ALT+'3'
define ASPMainModeAuto L_SHIFT+'3'
define ASPMainModeManual L_CTL+'3'
define ASPModeBomb L_CTL+'2'
define ASPModeGyro L_SHIFT+'4'
define ASPModeGun L_SHIFT+'1'
define ASPModeMissile L_CTL+'4'
define ASPModeRockets L_CTL+'1'
define ASPModeShooting L_SHIFT+'2'
define ASPGunsightOff R_CTL+R_SHIFT+'v'
define ASPGunsightOn R_SHIFT+'v'
define NetOff R_CTL+R_SHIFT+'x'
define NetOn R_SHIFT+'x'
define PipperOff R_CTL+R_SHIFT+'c'
define PipperOn R_SHIFT+'c'
define MasterAir L_WIN+'1'
define MasterGround L_WIN+'2'
define AAModeIR L_WIN+'4'
define AAModeNeutral L_ALT+L_WIN+'4'
define AAModeSAR L_WIN+'3'
define AA1 '1'
define AA2 '2'
define AA3 '3'
define AA4 '4'
define AA1_2 '-'
define AA3_4 '0'
define B1_2 '5'
define B3_4 '6'
define B1_4 '7'
define S1_2 '8'
define S3_4 '9'

// AUTOPILOT ***********************************

define SAUHoldAlt 'j'
define SAULowAltRecoveryOff R_ALT+R_SHIFT+'s'
define SAULowAltRecoveryOn R_CTL+'s'
define SAURecovery 'a'
define SAUStabilise L_ALT+'a'
define SAUCancel L_ALT+L_CTL+'a'
define SAUCancelLanding R_ALT+R_SHIFT+'a'
define SAULandingAuto R_ALT+'a'
define SAULandingCommand R_SHIFT+'a'

// RADIO ************************

define Intercom '\'
define CoverMe L_WIN+'x'
define RTF L_WIN+'t'
define AwacsBandit L_WIN+'q'
define AttackMyTgt L_WIN+'c'

// RADAR *****************************

define RadarCont L_SHIFT+'q'
define RadarIFF L_SHIFT+'a'
define RadarLowSpeed L_SHIFT+'s'
define RadarPassive L_SHIFT+'e'
define RadarReset L_CTL+L_SHIFT+'f'
define RadarTemp L_SHIFT+'w'
define RadarWeather L_SHIFT+'r'
define RadarOff L_CTL+L_SHIFT+'4'
define RadarOn L_SHIFT+L_ALT+'4'
define RadarStandby L_ALT+'4'
define TargetLock ENT
define TDCDn 'l'
define TDCUp 'o'

// LIGHTS ***************************

define LightsLandOn L_ALT+'l'
define LightsLandOff L_ALT+L_CTL+'l'
define LightsLandTaxi L_CTL+'l'
define LightNavMax L_SHIFT+'l'
define LightNavMed L_ALT+L_SHIFT+'l'
define LightNavMin L_CTL+L_ALT+'l'
define LightNavOff L_SHIFT+L_ALT+'l'

// MISC ***************************

define Eject L_CTL+'e'

Inline advert (2nd and 3rd post)

#4021048 - 10/11/14 03:41 AM Re: Listmode function help [Re: Rooks]  
Joined: Apr 2005
Posts: 43
Rooks Offline
Junior Member
Rooks  Offline
Junior Member

Joined: Apr 2005
Posts: 43
Adelaide, AU
Update - I've misread/misunderstood the manual in the formatting of the list.
Works ok now just listing the items. This newbie thought the numbers were not part of the definitions.
Thanks to Chiclidfan over at the ED forums.


Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

If you shop on Amazon use this Amazon link to support SimHQ
.
Social


Recent Topics
Carnival Cruise Ship Fire....... Again
by F4UDash4. 03/26/24 05:58 PM
Baltimore Bridge Collapse
by F4UDash4. 03/26/24 05:51 PM
The Oldest WWII Veterans
by F4UDash4. 03/24/24 09:21 PM
They got fired after this.
by Wigean. 03/20/24 08:19 PM
Grown ups joke time
by NoFlyBoy. 03/18/24 10:34 PM
Anyone Heard from Nimits?
by F4UDash4. 03/18/24 10:01 PM
RIP Gemini/Apollo astronaut Tom Stafford
by semmern. 03/18/24 02:14 PM
10 years after 3/8/2014
by NoFlyBoy. 03/17/24 10:25 AM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0