Display a dataref in textadd

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Message
Author
auditdata
Posts: 63
Joined: Sun Jun 21, 2020 2:06 pm

Re: Display a dataref in textadd

#11 Post by auditdata »

Thanks for taking the time to reply. So helpful for a non-programmer.
I searched the web for Lua integer and only came up with math functions to do it which seemed to require a library.
INT seems such a simple function to be omitted from Lua
Now reading up about string format which seems to be a powerful programming language all to itself!!! :-)
I spend some time last year writing a generic button instrument using a configurable json file but soon realised users don't want configurable they just want it to do what they want.
Now adapting it for Toliss aircraft which seem to be under represented on the instrument library and not using the configurable file to make it simpler
Might submit it when finished.
Interestingly initially I called it a "Stream Deck" clone and sure enough 6 months later someone wrote a configuration of Stream deck for flight sim.

auditdata
Posts: 63
Joined: Sun Jun 21, 2020 2:06 pm

Re: Display a dataref in textadd

#12 Post by auditdata »

I know I said I would stop bothering you guys but can you give me a quick pointer how to repeat a function as a button is held down.
I want to increase decrease the set speed in the autopilot while the button is still being pressed.
A sort of do while
Is this possible or is there another object type for this?

Code: Select all

button_2_4=button_add("BGreen.png", "BRed.png", 340, 120, 100, 100, function()
    xpl_command("sim/autopilot/airspeed_down")   
end)  

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Display a dataref in textadd

#13 Post by Keith Baxter »

Hi,


Use the "BEGIN" and "END" features.

https://siminnovations.com/wiki/index.p ... pl_command

Code: Select all

button_2_4=button_add("BGreen.png", "BRed.png", 340, 120, 100, 100, function(press)
       xpl_command("sim/autopilot/airspeed_down","BEGIN")  ,
    function((release)
     xpl_command("sim/autopilot/airspeed_down","END")   
end)  


Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

auditdata
Posts: 63
Joined: Sun Jun 21, 2020 2:06 pm

Re: Display a dataref in textadd

#14 Post by auditdata »

That worked perfect.
:-)

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Display a dataref in textadd

#15 Post by Keith Baxter »

auditdata wrote: Thu Apr 28, 2022 2:19 pm That worked perfect.
:-)
Hi

for that, I would prefer you to buy me a coffee rather than bear by the way. ;)

LOL Just joking. I do it to help all and get great pleasure out of what I can share within my knowledge scope.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply