Hey, just curious how i would run this script in the normal UI instead of the script editor. Im still quite new to target.
 
Hey Clicker,

Thanks a lot for sharing! Yeah it beat me last time LOL, and haven't given it another go recently (actually been a while since I played ED or anything games really).

I'll inject it back into my build though and give it another try. Let you know how it goes.

Cheers!


Hey Disi,

When you load up the Target GUI, hit the big button that says 'Run Configuration' and navigate to the script folder and open. Should be all you need to do.

I generally use the GUI if I am not messing with the code or user preferences (or the EDBat file).

Enjoy, AD
 
State Tracking via status.json from inside TARGET script now possible!

Hey AD,

Are you sitting down?

The attached zip file included contains;
1) sample script runner batch file (which I think you now include in your package)
2) a .tmh file

The important part of the script runner is that it captures the path of the status.json journal file then calculates the string length of this path.
These are written to;
c:\status.json.path.txt
c:\status.json.len.txt

These are required for the functions within the EDFileOps.tmh file.
This should work for all users however this batch file must be run as Administrator! There are instructions within the file on how to do this.
I've had to use this method as it's near impossible to work this out using TARGET code.
NOTE: the user will need to edit this .cmd file to ensure the main TARGET script filename and path are correct.
If the user doesn't want to use a windows batch file to start their script , then the code within this .tmh file would need to be changed to hard code the status.json path.

There are two functions in the .tmh file and a bunch of hex coded defines kindly provided to me by Robert Maynard.
(https://forums.frontier.co.uk/showt...rnal-display-and-surface-navigation-assistant)

The two functions are;
a) initReadStatus() effectively grabs the 'Flags' value from status.json and decodes it into its discrete components.
b) initWaitStart() calls initReadStatus() and loops until 'Flags' does not equal 0 and can be called toward the beginning of your .tmc script (eg just before your initCustomCammands() call)

A description of status.json can be found in the latest journal document which can be found via https://forums.frontier.co.uk/showthread.php/452937-Journal-Docs-for-v3-3
(scroll down to section 12 near the end of the document)

A simple example of usage would be to wait until the game loads, read/process "Flags", then correctly set any variables you use accordingly (eg landing gear, cargo scoop etc).

Obviously calling the initReadStatus() functions from any of your other code allows for a more reliable state tracking mechanism.

To get this working,
a) cut/paste the appropriate lines from my sample script runner into your startup batch file
b) copy the .tmh file into the folder containing your main script files and add an include statement in your .tmc file.

If you decide to make it part of your script, you can move the defines into your settings file and the functions into your functions file.

Have a play and let me know what you think.
Hold up on adding initWaitStart() to start of your script!
I'm investigating some timeout issues and need to rethink how I've done this bit.

You should be still good to go testing the main initReadStatus() code. ... yeah not just yet.

Cheers
Clicker

EDIT: I've removed the zip file as I've had to rewrite both files.
 
Last edited:
New zip file coming soon!

Update on above.

TLDR: I can now reliably start TARGET script and grab the FLAGS value in status.json very close to the game starting.

Issues I had to take into account;
a) Target Script must be started before the game gets to the first menu.
ie. if the Thrustmaster Combined HID is not created before this, ED throws a 'BindingLoadingErrors' error

b) Whilst the TARGET script can run any number of functions and routines on startup, the main() routine MUST finish within 60 seconds or the script will abort.
ie my loop in initWaitStart() would not run longer than 60 seconds before the script crashes with a timeout error.

c) While the loop is running at the start of the script (before main() completes), the Stop Profile button in TARGET GUI is not available (!!!)
(not a problem if you run the script via the TARGET Script Editor!)

d) There are no timeout issues in TARGET after main() has completed.

I came up with two solutions to this, either or both of which can be implemented depending on personal preference.

1) Create a 75-90 second delay in the windows batchfile between the start of my apps (incl EDLauncher) and the target script.
TARGET script calls initWaitStart() just prior to resetting your StartupLock variable (ie. after the ThrustmasterCombined HID is created).
initWaitStart() will loop for 55 seconds or until status.json file is initialised by ED.
This function will exit just prior to the 60 second timeout if the game has not been started, so the script will not abort.
To overcome this, I simply mapped an unused switch to fire initWaitStart() manually.

2) Map initWaitStart() to a button or switch.
Dispense with the delay in the batchfile.
Dispense with trying to run initWaitStart() at the start of your script.
Flick the switch or button as soon as the game is running proper (ie after all the menus and after the orange spinning ship has finished).

Option 1 needs the delays tweaked by the user depending on the game load times on their PC.
If the timing can be reliably worked out, you won't need to map initWaitStart() to a button/switch.

Option 2 requires a button/switch to be mapped to initWaitStart().
It's then totally up to the user to fire it once the game is fully loaded.
This is arguably the easiest option...but it's manual.

I prefer Option 1 as it's as close to automatic as you can get.

Note: initWaitStart() accepts an integer argument when you call it.
This integer is the maximum number of 5 second loops (minus 1) that the function will test for status.json to be initialised by ED
So, when we use initWaitStart in option 1 above, we set the argument to 12 ... ((12-1)*5) = 55 seconds.
When we map initWaitStart() to a button or switch we can pass a larger number as TARGET will not timeout, so something like initWaitStart(99) is fine.

As mentioned at the top of this post...once I 'sanitize' my scripts, I'll zip them up and attach to another post.
(no doubt with even more comments and explanation)

Cheers
Clicker
 
Last edited:
...and here is the zip file.

Contains:
  • Sample Script Starter.bat
  • EDWaitStart-DEV.tmh
  • EDReadStatus-DEV.tmh - needs a change...see "EDIT" note below
  • EDSetLEDs-DEV.tmh

EDSetLEDs-Dev.tmh is a rehash of my blinking LED routine from late last year and is included for completeness.
Hopefully the scripts are clear enough for you to work out what and how they do what they do, however, if anyone has questions or wants clarity, just ask.

EDReadStatus-Dev is broken into two parts now.
1) To grab the info from .txt files written to C:\ by the Script Starter batch file relating to status.json. This really only needs to be run once per session (before calling WaitStart/ReadStatus), hence why I moved it out of the main ReadStatus routine...minimises the number of file operations. NOTE: The batch file must be run as Administrator to work, AND is required for these functions to work.
2) The actual ReadStatus routine. This grabs the 'FLAGS' value within status.json then processes the result into individual bits. I've provided the framework to process all 28 bits but it's up to the end user to code what they want to do with one, some or all of the bits.

Have a play and let me know what you think....feel free to incorporate into your scripts if you are so inclined...or not.

Lastly, it's worth noting that where one or more global variables are used, I've added these to the top of the files, before the function declarations.

Cheers
Clicker

p.s. 80% of this code was written so that the end user doesn't need to know where the status.json file lives AND doesn't need/want to edit any TARGET script files.
p.p.s. For anyone else who knows how and where to find status.json AND doesn't mind editing TARGET scripts, the script runner batch file, initWaitStart and initGetStatusFileInfo functions can all be dispensed with...leaving just the initReadStatus() function, which the user simply needs to hard code in the full pathname for status.json

EDIT: zip file contents updated 5-FEB-2019
EDReadStatus-DEV.tmh file
Replace entire Line 78 with myJsonLen = 76;
Then remove lines 60-64.
 

Attachments

  • EDReadStatus.zip
    4.4 KB · Views: 342
Last edited:
Any chance that you implent the ReadStatus think to your scripts? it looks like a real nice to have feature @Aussiedroid
 
Reworked CHAT FUNCTIONS in TARGET.

Hi Aussiedroid,

Long time coming perhaps, but here it is...

Many thanks to sYfte over at the HOTAS/HOSAS/SIMPIT Discord who has been able to create a function which allows the user to easily edit the chat contents.

This much more elegant solution does not require a translation table and further does not use the Sleep() function.
The Sleep() function should never be used as it sleeps the whole script and thus will not accept ANY input for the duration of the Sleep() (my bad!)

Function: SendChatString() - accepts a predefined chat string, grabs one character at a time to send to chat window

NOTE: LOCK function does not work with this, so if you press a button which sends keys to the game whilst the routine is typing into the chat window,
these will get inserted into the text stream and will not go to the game.

FYI 'QuickCommsPanel' is defined within the script as 'ENTER' key.

Also note that user may need to increase the '50' delay multiplier here (2 places in BOLD) if they find the beginning of the string missing when using.

// START Chat Functions

include "EDChatMacros.tmh"

// GLOBAL VARs can go into EDSettings file once tested

char ca_pulseChar[] = "0" ;

int SendChatString(alias string) {
int length, pos = 0 ;

length = strlen(&string) ;

ActKey(PULSE+KEYON+QuickCommsPanel);

while (pos < length) {
strsub(&ca_pulseChar, &string, pos, pos) ;
DeferCall(50 * (pos + 1), &ActKey, KEYON+PULSE+ca_pulseChar[0]) ;
pos = pos + 1 ;
}
DeferCall(50 * (pos + 2), &ActKey, KEYON+PULSE+QuickCommsPanel) ;
}

Function: initStr2Char() - this does the conversion...one character at a time. (convert "X" to 'X')
no longer required!!!

NO LONGER REQUIRED

...and lastly, your chat definitions...

File: EDChatMacros.tmh
// Define your chat variables here.

// NOTE: Just change the text between the quotes
// DO NOT change the macro names (everything starting with "chat_")

define chat_ClearChatBox "/clear" // Do not modify this one

define chat_HostileAttack "You're a disgrace! Die! Time to see the Rebuy!"
define chat_HostileMock "I fart in your general direction :/"
define chat_HostileDemand "How much cargo is your life worth? Hand it over!"
define chat_HostileScanning "Stay calm, cut your engines and prepare to be scanned. Move and you will be fired upon"

define chat_PassiveHail "Greetings CMDR o7"
define chat_PassiveFarewell "Fly safe CMDR"
define chat_PassiveHonk "Easy there! Watch where you are going CMDR"
define chat_PassiveSurrender "Hold your Fire! I surrender, what are your demands?"

define chat_FriendlyThanks "Thank you for your assistance! o7"
define chat_FriendlyMailSlot "CMDR coming through the mailslot"
define chat_FriendlyOfferAid "Can I help CMDR?"
define chat_FriendlyDeter "I don't want conflict, but I will protect what is mine"

define chat_BasicHello "CMDR! o7"
define chat_BasicHonk "Easy there! Watch where you are going CMDR"
define chat_BasicQuery "What do you want CMDR?"
define chat_BasicAttack "Let's Rock!!"

// END Chat Defines

To use, (example) instead of ActKey(KEYON+PULSE+mTextBasicHello); , you send SendChatString(chat_BasicHello);

You asked for it....here 'tis!

Enjoy

Clicker
:-D
 
Last edited:
Feb Update!

Update 3.3.3: BEYOND..BEYOND


** IMPORTANT - v3.3.3 Requires the latest 2018 (v3.0.18.328 or higher) Update for TARGET Software, Drivers & Firmware to be installed. **


-> A few minor issues/conflicts addressed that have been reported by CMDRS since 3.3.0... :)



List of Changes:

IMPROVEMENT: ED-BAT option added to open Reference Maps (pictures) when running batch. (Please update your folder path to use) (Thx CMDR Awesome)
IMPROVEMENT: For Discord, added variables for Overlay & for opening Chat in Overlay in EDKeyMap file (unused). (mapped to ALT+F3, ALT+F4)

FIXED: VoiceAttack + Singularity multiple keybind issues. 4x Conflicting VA Galaxy Map binds (now all uses CTRL+'Mapping') & 3x Missing VA commands bound for Attach/Detach Free Camera (CTRL+C) & Thruster Forward-Only Reverse (for Ship+SRV) (CTRL+R). (Thx CMDR CrazyDisi & CMDR Axsom)
FIXED: Missing FAOff Printout for when UseRudderAxisCurves is active (1) has been added. (Thx CMDR sw33tp34)
FIXED: Changed default Discord PTT mapping due to conflict. (Does not support '~', so has been swapped with alternative 'NUMPAD *') (Thx CMDR Axsom)

REMOVED: MFG Crosswind Toe Brake axis mapping for Thrusters Forward/Backwards from default setup. (safer/more precise)



[alien] Fly Safe CMDRs! [alien]


** Please visit the ModDB link to get the latest version *** Steam Guide can be found here **

** New to the script? Be sure to also check out the Beginners Reference Map in the download pack. **
 
Any chance that you implent the ReadStatus think to your scripts? it looks like a real nice to have feature @Aussiedroid

Hey CrazyDisi,

I've only had a chance to gloss over its function so far. Not sure how to use it in the script really or how it will benefit. Can definitely look into adding it though for a future release.

Reworked CHAT FUNCTIONS in TARGET.

Hi Aussiedroid,

Long time coming perhaps, but here it is...

I've been able to create a function which allows the user to easily edit the chat contents.

Function: initSendChat() - accepts a predefined chat string, grabs one character at a time to send to chat window

// START Chat Functions

include "EDChatMacros.tmh"

// GLOBAL VARs can go into EDSettings file once tested

int myChar;
int myChar2 = " ";
int myresult = 0;

// End GLOBAL

int initSendChat(int myTextToSend) {
// Accepts a chat macro defined in EDChatMacros.tmh file
// Usage example:
// initSendChat(chat_ClearChatBox);

int myTextLength = strlen(myTextToSend);

int myCounter = 0;

ActKey(PULSE+KEYON+QuickCommsPanel);
Sleep(500);
while (myCounter < myTextLength) {
strsub(myChar2, myTextToSend, myCounter, myCounter);
initStr2Char();
ActKey(PULSE+KEYON+myChar);
Sleep(33);
myCounter = myCounter + 1;
}
ActKey(PULSE+KEYON+QuickCommsPanel);
Sleep(250);
}

Function: initStr2Char() - this does the conversion...one character at a time. (convert "X" to 'X')

int initStr2Char() {

if (!strcmp(myChar2, "a")) myChar = 'a';
if (!strcmp(myChar2, "b")) myChar = 'b';
if (!strcmp(myChar2, "c")) myChar = 'c';
if (!strcmp(myChar2, "d")) myChar = 'd';
if (!strcmp(myChar2, "e")) myChar = 'e';
if (!strcmp(myChar2, "f")) myChar = 'f';
if (!strcmp(myChar2, "g")) myChar = 'g';
if (!strcmp(myChar2, "h")) myChar = 'h';
if (!strcmp(myChar2, "i")) myChar = 'i';
if (!strcmp(myChar2, "j")) myChar = 'j';
if (!strcmp(myChar2, "k")) myChar = 'k';
if (!strcmp(myChar2, "l")) myChar = 'l';
if (!strcmp(myChar2, "m")) myChar = 'm';
if (!strcmp(myChar2, "n")) myChar = 'n';
if (!strcmp(myChar2, "o")) myChar = 'o';
if (!strcmp(myChar2, "p")) myChar = 'p';
if (!strcmp(myChar2, "q")) myChar = 'q';
if (!strcmp(myChar2, "r")) myChar = 'r';
if (!strcmp(myChar2, "s")) myChar = 's';
if (!strcmp(myChar2, "t")) myChar = 't';
if (!strcmp(myChar2, "u")) myChar = 'u';
if (!strcmp(myChar2, "v")) myChar = 'v';
if (!strcmp(myChar2, "w")) myChar = 'w';
if (!strcmp(myChar2, "x")) myChar = 'x';
if (!strcmp(myChar2, "y")) myChar = 'y';
if (!strcmp(myChar2, "z")) myChar = 'z';

if (!strcmp(myChar2, "A")) myChar = 'A';
if (!strcmp(myChar2, "B")) myChar = 'B';
if (!strcmp(myChar2, "C")) myChar = 'C';
if (!strcmp(myChar2, "D")) myChar = 'D';
if (!strcmp(myChar2, "E")) myChar = 'E';
if (!strcmp(myChar2, "F")) myChar = 'F';
if (!strcmp(myChar2, "G")) myChar = 'G';
if (!strcmp(myChar2, "H")) myChar = 'H';
if (!strcmp(myChar2, "I")) myChar = 'I';
if (!strcmp(myChar2, "J")) myChar = 'J';
if (!strcmp(myChar2, "K")) myChar = 'K';
if (!strcmp(myChar2, "L")) myChar = 'L';
if (!strcmp(myChar2, "M")) myChar = 'M';
if (!strcmp(myChar2, "N")) myChar = 'N';
if (!strcmp(myChar2, "O")) myChar = 'O';
if (!strcmp(myChar2, "P")) myChar = 'P';
if (!strcmp(myChar2, "Q")) myChar = 'Q';
if (!strcmp(myChar2, "R")) myChar = 'R';
if (!strcmp(myChar2, "S")) myChar = 'S';
if (!strcmp(myChar2, "T")) myChar = 'T';
if (!strcmp(myChar2, "U")) myChar = 'U';
if (!strcmp(myChar2, "V")) myChar = 'V';
if (!strcmp(myChar2, "W")) myChar = 'W';
if (!strcmp(myChar2, "X")) myChar = 'X';
if (!strcmp(myChar2, "Y")) myChar = 'Y';
if (!strcmp(myChar2, "Z")) myChar = 'Z';

if (!strcmp(myChar2, "0")) myChar = '0';
if (!strcmp(myChar2, "1")) myChar = '1';
if (!strcmp(myChar2, "2")) myChar = '2';
if (!strcmp(myChar2, "3")) myChar = '3';
if (!strcmp(myChar2, "4")) myChar = '4';
if (!strcmp(myChar2, "5")) myChar = '5';
if (!strcmp(myChar2, "6")) myChar = '6';
if (!strcmp(myChar2, "7")) myChar = '7';
if (!strcmp(myChar2, "8")) myChar = '8';
if (!strcmp(myChar2, "9")) myChar = '9';

if (!strcmp(myChar2, " ")) myChar = ' ';
if (!strcmp(myChar2, ".")) myChar = '.';
if (!strcmp(myChar2, ",")) myChar = ',';
if (!strcmp(myChar2, "/")) myChar = '/';
if (!strcmp(myChar2, "'")) myChar = '\'';
if (!strcmp(myChar2, "!")) myChar = '!';
if (!strcmp(myChar2, ":")) myChar = ':';
if (!strcmp(myChar2, ";")) myChar = ';';
if (!strcmp(myChar2, "@")) myChar = '@';
if (!strcmp(myChar2, "#")) myChar = '#';
if (!strcmp(myChar2, "$")) myChar = '$';
if (!strcmp(myChar2, "%")) myChar = '%';
if (!strcmp(myChar2, "^")) myChar = '^';
if (!strcmp(myChar2, "&")) myChar = '&';
if (!strcmp(myChar2, "*")) myChar = '*';
if (!strcmp(myChar2, "-")) myChar = '-';
if (!strcmp(myChar2, "+")) myChar = '+';
if (!strcmp(myChar2, "=")) myChar = '=';
if (!strcmp(myChar2, "_")) myChar = '_';
if (!strcmp(myChar2, "<")) myChar = '<';
if (!strcmp(myChar2, ">")) myChar = '>';
if (!strcmp(myChar2, "?")) myChar = '?';
if (!strcmp(myChar2, "~")) myChar = '~';

// if (!strcmp(myChar2, "")) myChar = ''; // Add more punctuation chars here if needed

}

...and lastly, your chat definitions...

File: EDChatMacros.tmh
// Define your chat variables here.

// NOTE: Just change the text between the quotes
// DO NOT change the macro names (everything starting with "chat_")

define chat_ClearChatBox "/clear" // Do not modify this one

define chat_HostileAttack "You're a disgrace! Die! Time to see the Rebuy!"
define chat_HostileMock "I fart in your general direction :/"
define chat_HostileDemand "How much cargo is your life worth? Hand it over!"
define chat_HostileScanning "Stay calm, cut your engines and prepare to be scanned. Move and you will be fired upon"

define chat_PassiveHail "Greetings CMDR o7"
define chat_PassiveFarewell "Fly safe CMDR"
define chat_PassiveHonk "Easy there! Watch where you are going CMDR"
define chat_PassiveSurrender "Hold your Fire! I surrender, what are your demands?"

define chat_FriendlyThanks "Thank you for your assistance! o7"
define chat_FriendlyMailSlot "CMDR coming through the mailslot"
define chat_FriendlyOfferAid "Can I help CMDR?"
define chat_FriendlyDeter "I don't want conflict, but I will protect what is mine"

define chat_BasicHello "CMDR! o7"
define chat_BasicHonk "Easy there! Watch where you are going CMDR"
define chat_BasicQuery "What do you want CMDR?"
define chat_BasicAttack "Let's Rock!!"

// END Chat Defines

To use, (example) instead of ActKey(KEYON+PULSE+mTextBasicHello); , you send initSendChat(chat_BasicHello);

You asked for it....here 'tis!

Enjoy

Clicker
:-D

Hey Clicker!

Thanks a lot for sharing all that cool code recently. I saw this a little late to include in my build released today, but have wanted to improve the chat function so will look at this for my next release. Looks to be a much better setup!

As I mention above, not sure how to use the status tracking code you shared really, but will check that out too! See if its worth adding too.

Cheers, AD

Really need to get back into ED. I haven't played much since last year.
 
Hi AD,

NO problem.

The Readstatus stuff was more for me rather than you...just wanted to be able to track/set state flags reliably.

The Chat stuff was a challenge and I wanted to see if I could crack it!
Took me quite a while on and off to crack actually, but today I had an epiphany moment and it all fell into place!

Your efforts and script are the benchmark and I'm just glad I can contribute.
Even if you don't use my code or ideas, I know how sparse examples on how to do certain stuff is, so someone will see this and take something away.

Cheers
Clicker
 
Last edited:
Hi AD,

NO problem.

The Readstatus stuff was more for me rather than you...just wanted to be able to track/set state flags reliably.

The Chat stuff was a challenge and I wanted to see if I could crack it!
Took me quite a while on and off to crack actually, but today I had an epiphany moment and it all fell into place!

Your efforts and script are the benchmark and I'm just gald I can contribute.
Even if you don't use my code or ideas, I know how sparse examples on how to do certain stuff is, so someone will see this and take something away.

Cheers
Clicker

Thanks mate! That chat setup is definitely better than mine, and finally a practical way of changing the text quotes. Looking forward to giving it a go.

Yeah, I know how it is when you have something you want to crack. Great feeling when you finally get that success!

I was having a crack at a setting for the Pulse Wave scanner, to fire every 7 seconds repeating till you press the trigger again, but have yet to crack it. REXEC doesnt want to play nice for me lol, so had to drop it for the current release. Still it is bugging at me so gotta give it another go some time. :)

Cheers, AD
 
Hi AD,

im having problem download the mod

Code:
The file you have selected (Aussiedroid-ED-Warthog-Script-3.3.3.zip) is not available via any mirrors. Please check back shortly as our servers update every 5 minutes. To access more file mirrors we encourage you to join the community, otherwise please be patient and keep trying.

How long does it usually take for it to be available?
 
Hi AD,

im having problem download the mod

Code:
The file you have selected  (Aussiedroid-ED-Warthog-Script-3.3.3.zip) is not available via any  mirrors. Please check back shortly as our servers update every 5  minutes. To access more file mirrors we encourage you to join the  community, otherwise please be patient and keep trying.

How long does it usually take for it to be available?

Looks like it is taking a while to seed across their servers :( Normally it is quick, but occasionally it has taken some time before its available. Maybe a server glitch. Hopefully it will come good soon, else I will try to upload again tomorrow.

Cheers, AD
 
Hey AD,

just for the sake of saying, you could put this repository into GitHub or something like that. That way you dont need to "Build" Zip Release and upload them somewhere. i've for example put your Script into my private Git-Repository to monitor the changes i made :)
 
@AussieDroid:

Looks like there is a problem with their servers, the file still isn't available and it's been almost six hours. Any chance you could provide a working link?
 
Hey AD,

just for the sake of saying, you could put this repository into GitHub or something like that. That way you dont need to "Build" Zip Release and upload them somewhere. i've for example put your Script into my private Git-Repository to monitor the changes i made :)

I actually didnt know about Github till after I started all this script up. Can check it out though and see if it works, but never been much of a fan of the site tbh.

@AussieDroid:

Looks like there is a problem with their servers, the file still isn't available and it's been almost six hours. Any chance you could provide a working link?

Yeah, just checked again this morning before work and seems the issue remains. I have left a message on the forums to see if it can be resolved. If its still not working after work (8-10hrs from now), I will provide a temp link somehow and share.

It's not a super urgent update this release so hopefully not a big issue to wait a little :)

Cheers, AD
 
Looks like ModDB is still having issues. Not sure what is going on.

Here is a temporary link to the 3.3.3 download pack: N/A

Cheers, AD
 
Last edited:
Back
Top Bottom