xpl_write problem

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Post Reply
Message
Author
docjl
Posts: 129
Joined: Tue Mar 01, 2016 4:24 pm
Location: Besançon

xpl_write problem

#1 Post by docjl »

Hi,
I need some help from you. I'm working on my overhead panel of Jetsream, as I said few days ago, and I have problems to write some datarefs.
I use switches to call functions ; sometime, it works well, but with some, I can't transfer the dataref to X-Plane. For exemple, xpl_dataref_write("sim/cockpit2/switches/navigation_lights_on", "INT", 1) don't transmit to X-Plane (the feed-back X-Plane to AM works well, when I ask in reading it).
Other ones don't work : xpl_dataref_write("sim/flightmodel2/lights/nav_lights_brightness_ratio", "FLOAT[16]", {1.0}, 5) for example.
I don't understand why some are disfunctionning... :roll: Some ideas from one of you ? It will help me.
I'm not, here, on the computer where I work with AM, so, I can't show you all the code ; but if it's useful, I'll can do it.
Thanks.
Jean-Luc

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

Re: xpl_write problem

#2 Post by Ralph »

Are you aware that you're writing the brightness ratio array at an offset of 5? So you're writing position 5. Shouldn't that be position 1?

Not all datarefs are very well writeable, some of them just reset to their previous position. There's a force option with writing datarefs, but I wouldn't recommend that if it ain't necessary.
It's better to use commands:

sim/lights/nav_lights_on
sim/lights/nav_lights_off
sim/lights/nav_lights_toggle
https://siminnovations.com/wiki/index.p ... ommandrefs

docjl
Posts: 129
Joined: Tue Mar 01, 2016 4:24 pm
Location: Besançon

Re: xpl_write problem

#3 Post by docjl »

Ralph wrote:Are you aware that you're writing the brightness ratio array at an offset of 5? So you're writing position 5. Shouldn't that be position 1?
Yes I know, 5 was an example. Because, in fact, I must use 4 or 5 offsets to adjust some different lights in different offsets (I must follow the datarefs of the creator of the plane... and it's sometime strange :o )

Not all datarefs are very well writeable, some of them just reset to their previous position. There's a force option with writing datarefs, but I wouldn't recommend that if it ain't necessary.
Oh she**. I think, this is these datarefs who are not well writeable, or there is a subtlety of this specific plane.... I've tried yet to force with a "true" at the end of the code line, but it's not functional too....
It's better to use commands:
sim/lights/nav_lights_on
sim/lights/nav_lights_off
sim/lights/nav_lights_toggle
Yes, when I can, I prefer use command instead of write, but all datarefs aren't commandable (i.e.: brightness_ratio) and even, sometimes, the command don't work too (i.e.: separated left/right landing light)

It's a real problem if I must stop here my project... It's very frustrating ! :evil:
Thanks for your answer Ralph and good day.
Jean-Luc

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

Re: xpl_write problem

#4 Post by Ralph »

Did you try if it works with a different aircraft? I had troubles with writing a certain dataref on the Airfoil Labs 172, but it works with the default 172.

docjl
Posts: 129
Joined: Tue Mar 01, 2016 4:24 pm
Location: Besançon

Re: xpl_write problem

#5 Post by docjl »

No, I didn't. First, because, I haven't think at that, second, because there are lots of specifics datarefs on the plane I work, so IMHO, it risks to crash AM with another plane. But I can try, why not ?
There are few strange things on the Jetstream of Rollon. It's a very good plane to use, but his programmation is sometime disconcerting : Datarefs on 0 to be ON and 1 to be OFF... Obligation to switch on Land_light [1, 3 and 4] to switch on the left landing light....
It's very interesting to dig up the programmation part of a plane in fact. :)
Jean-Luc

Post Reply