Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I would like to rebuild the taxi part of Groundhandling5.
Normaly you increase and decrease taxispeed with mouse pointer. But I would also like to do it from my second keybord using HIDMacro, FSUIPC+LUA and Taxispeed.xml in Groundhandling5.

I have rebuild Taxispeed.xml by creating macro for the code in the mouse area.

Part of original file:

<Mouse>  <Area Left="3" Top="35" Right="16" Bottom="57">    <Cursor Type="DownArrow"/>    <Tooltip ID="">Decrement Target Taxispeed</Tooltip>    <Click Repeat="Yes">      (L:TsTargetSpeed,number) 4 >      if{ (L:TsTargetSpeed,number) -- (>L:TsTargetSpeed,number) }      els{ 1 (>L:GH_Sound07,bool) }    </Click>  </Area> 

Which is rebuild to:

<Mouse>  <Area Left="3" Top="35" Right="16" Bottom="57">    <Cursor Type="DownArrow"/>    <Tooltip ID="">Decrement Target Taxispeed</Tooltip>    <Click Repeat="Yes">    @DecTaxspeed              <<<<<<<<-------- changed       </Click>  </Area>

and macros like this:

<Macro Name="DecTaxspeed">      (L:TsTargetSpeed,number) 4 >      if{ (L:TsTargetSpeed,number) -- (>L:TsTargetSpeed,number) }      els{ 1 (>L:GH_Sound07,bool) }</Macro>

Code for use from keyboard:

<Element>  <Select>    <Value>      (L:DecTaxiSpeed) 1 == if{             0(>L:DecTaxiSpeed, number)              @DecTaxspeed               }    </Value>  </Select></Element>

All of the previous codes are in the Taxispeed.xml. The code is almost the same for all three parts of my rebuild, Increase Taxispee, Decrease Taxispeed and Taxipeed On, Off and Armed. The new Taxispeed.xml works OK when using mousepointer.

 

From the HIDMacro and the second keyboard I use this code:

HIDMacros.SetFSUIPCInt &H66C1, 2, 1

It is offset programming in FSUIPC.

In FSX module folder I have ipcReady.lua, part of:

function dectax(offset, val)  if val == 1 then    ipc.writeLvar("L:DecTaxiSpeed", 1)    ipc.writeSW(0x66C1,-1 )  endendipc.writeSW(0x66C1,-1)event.offset(0x66C1, "SW", "dectax")

The previous code is almost the same for three part in Taxispeed.xml; Increase Taxispeed, Decrease Taxispeed and Taxispeed On, Off and Armed. But with proper variables for each one.

This works, but not always. And that is my problem.
When I press proper key the speed may increase on, two or tree steps and then don't move any more. I then have to press the proper key for decrease speed and the speed decrease on, two or three steps and then stops! I have to change the key the whole time. The mousepointer works OK all the time and have no effect at the keyboard keys. I would like the key to works like the mousepointer. When I press key for Increase I would like the taxispeed to increase as long I press the key. And the same for decrease!

I think the lua code is wrong, but I can't find out what!
 

Posted

 

I think the lua code is wrong, but I can't find out what!

 

 

I can't see anything which would do as you say in the Lua. I don't understand the rest as I don't know HIDMacros or the taxi program, I assume you want to write 1 to the 16 bit word at 66C1 (why a full word, not a byte?), and cancel with -1. Why not 0?

 

Will the HidMacros action try to keep writing 1 or does it wait for the -1? 

 

And are you sure nothing else you use is also using 66C1? Try, say, 66FF as a "SB" type.

 

Pete

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.