Global variables

Help creating logic scripts for Air Manager Instruments

Moderators: Ralph, russ

Message
Author
User avatar
Ralph
Posts: 6607
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Global variables

#11 Post by Ralph »

In the instrument with the encoder:

Code: Select all

hw_dial_add("Your encoder", function(direction)
  if direction == 1 then
    si_command("ENCODER/1/CW")
  elseif direction == -1 then
    si_command("ENCODER/1/CCW")
  end
end)
The instrument that should receive the encoder inputs:

Code: Select all

si_command_subscribe("ENCODER/1/CW", function()
  print"Encoder 1 rotated clockwise"
end)

si_command_subscribe("ENCODER/1/CCW", function()
  print"Encoder 1 rotated counter clockwise"
end)

Shimokuta
Posts: 83
Joined: Wed Feb 03, 2021 12:52 pm

Re: Global variables

#12 Post by Shimokuta »

Thanks Ralph

Somehow i get no readings?!
I made a similar code, so i must be doing wrong
But my workaround is ok for. now.
So i think we can leave it for now


again thanks

User avatar
Ralph
Posts: 6607
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Global variables

#13 Post by Ralph »

Like I mentioned before, the simulator has to be running for this to work.

Shimokuta
Posts: 83
Joined: Wed Feb 03, 2021 12:52 pm

Re: Global variables

#14 Post by Shimokuta »

Yeah it does.
Global variable readings are being read correctly.
These not.
Well like i said, must be something on my system...weird

Shimokuta
Posts: 83
Joined: Wed Feb 03, 2021 12:52 pm

Re: Global variables

#15 Post by Shimokuta »

Hmm this seems some FSX issue
For developing my code i use a notebook with FSX installed.
Mostly no issues , but this seems to differ for FSX.
On my sim with prepar3d v5.3 i DO get readings, on my FSX testmachine not.
Oh well ...happy now!

User avatar
Ralph
Posts: 6607
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Global variables

#16 Post by Ralph »

Not a FSX issue, but a firewall issue.

Shimokuta
Posts: 83
Joined: Wed Feb 03, 2021 12:52 pm

Re: Global variables

#17 Post by Shimokuta »

I run fsx and Airmanager on the same machine
But never the less i turned off my firewall and readings do occur now even with FSX
After turning it back on they keep occurring.
Indeed something weird on my notebook


grtz

User avatar
Ralph
Posts: 6607
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Global variables

#18 Post by Ralph »

For the firewall it doesn't really matter if it is local or remote, it's a network connection either way.

Shimokuta
Posts: 83
Joined: Wed Feb 03, 2021 12:52 pm

Re: Global variables

#19 Post by Shimokuta »

Yeah I know
oh well case closed :)

Post Reply