A little help for a newbie please!

Announcements, general discussion
Post Reply
Passman
Posts: 3
Joined: 17 Jan 2014, 17:22

A little help for a newbie please!

Post by Passman » 17 Jan 2014, 17:33

This is a great program, just what I have been looking for.

The straight forward Send Simconnect Event is fine, however I'm getting very confused by the scripting and I wonder if someone could point me in the right direction please.

I have coded the following for a set Xpndr event and it works perfectly

Code: Select all

Dim frq
frq = HIDMacros.GetBuffer
frq = HIDMacros.StrRPad(frq, "0", 4)
HIDMacros.FSXEvent "XPNDR_SET", "&h"&frq
However, the following code to set VOR1 doesn't work at all and I have absolutly no idea why!

Code: Select all

Dim frq
frq = HIDMacros.GetBuffer
frq = HIDMacros.StrRPad(frq, "0", 3)
HIDMacros.FSXEvent "VOR1_SET", "&h"&frq 
What am I doing wrong and how can I resolve the problem?

Mant thanks for your help

Peter

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: A little help for a newbie please!

Post by admin » 20 Jan 2014, 08:54

The code looks fine.
I can not check myself as I don't use FSX any more, but maybe the value for VOR1 doesn't come in hexa BCD but as real value.
So I would try:

Code: Select all

HIDMacros.FSXEvent "VOR1_SET", frq
And maybe for debugging purposes just start with something like

Code: Select all

HIDMacros.FSXEvent "VOR1_SET", 123
and then extend to variable from buffer.
Petr Medek
LUAmacros author

Passman
Posts: 3
Joined: 17 Jan 2014, 17:22

Re: A little help for a newbie please!

Post by Passman » 20 Jan 2014, 12:49

Thanks for your suggestions.

They have clarified most problems I had, I'm most grateful for your time.

My last issue is around

Code: Select all

HIDMacros.FSXEvent "ADF_SET", ???
Following your suggestions nothing seems to set this as expected. Any helpful pointers please?

Many thanks

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: A little help for a newbie please!

Post by admin » 21 Jan 2014, 08:50

After one google search I would try something like

Code: Select all

HIDMacros.FSXEvent "ADF_COMPLETE_SET", &H333000
to tune ADF freq 333.

Google for "simconnect ADF_SET"
Petr Medek
LUAmacros author

Passman
Posts: 3
Joined: 17 Jan 2014, 17:22

Re: A little help for a newbie please!

Post by Passman » 21 Jan 2014, 11:04

Hi Petr

Many thanks for the help and pointer. I'm pleased to say that is what I needed to get to the final solution.

Here is the code I ended up with and it works brilliantly , even allows me to set the tenth digit when required (although very seldom).

Code: Select all

Dim frq
frq = HIDMacros.GetBuffer
frq = frq * 1000
frq = HIDMacros.StrRPad(frq, "0", 7) 
HIDMacros.FSXEvent "ADF_COMPLETE_SET", "&h"&frq 
It's the first time I have tried to do anything like this and it takes some getting your head around it. What a difference it has made to the simming experience, it give you so much more time to concentrate on the flying.

The secret is to know what to search for on google!

Thanks again for you help, hopefully I won't need you again!

Peter

Post Reply