need help decoding adding/removing passengers in payload panel

Post any technical issues here. This forum gets priority from our staff.
new reply
jfayre
Airman
Posts: 19
Joined: 04 Dec 2019, 08:21

need help decoding adding/removing passengers in payload panel

Post by jfayre »

Hi,
This question is probably mainly for Rob, since he has been helping me in another thread.
I'm writing a custom fuel and payload dialog for my flight sim accessibility add-on for blind users. This dialog is specifically for the a2a aircraft.
I'm wondering if someone can give me a rundown of what actually happens when you click in the payload manager to add passengers and change weights?
From looking at the XML, it looks like the variables that get manipulated are L:CharacterX (1-4), l:SeatXCharacter (1-4) and L:SeatManager. I just can't quite work out the sequence.
This is almost certainly do to my inexperience with XML and this goofy RPN notation.
What I need to know is, which variables do I need to change in which order to duplicate the function of clicking on the payload buttons in the payload panel?
I've already got this working for Oil and Fuel.
Thanks!

ROB - A2A
A2A Colonel
Posts: 3647
Joined: 02 Mar 2004, 02:56

Re: need help decoding adding/removing passengers in payload panel

Post by ROB - A2A »

This is pretty complicated as the functionality of this system is pretty rich. These are the functions:
1. To put a passenger on a seat or to remove him.
2. To choose a character for a passenger.
3. To adjust the weight of a chosen character.

This is how you do it:
1. Click on an empty passenger slot to add a character.
2. A character selector window pop ups with available characters to choose from, click on one of them to put him on a seat. This character won't be available for the other passengers.
3. The slot is no longer empty, there is a picture of the chosen character next to the slot. Now you can adjust his weight. The weight for given character is stored so next time you choose him, his weight is fetched with him.
4. You can click the character picture to change the character.
5. You can click the passenger slot to remove the character.

Let's start from something easy like clicking on an empty passenger slot.

regards
ROB
A2A Simulations Inc.

ROB - A2A
A2A Colonel
Posts: 3647
Joined: 02 Mar 2004, 02:56

Re: need help decoding adding/removing passengers in payload panel

Post by ROB - A2A »

Let's pick the first seat to the right which is seat number 2.

Code: Select all

(M:Event) 'LeftSingle' scmp 0 ==
if{
        (L:Seat2Character,enum) 0 != 
        if{ 
                 0 (>L:Seat2Character,enum)
                0 (>L:SeatManager,enum) 
         } 
         els{
                  (L:SeatManager,enum) 2 == 
                  if{ 
                        0 (>L:SeatManager,enum) 
                   }  
                  els{ 
                        2 (>L:SeatManager,enum) 
                  }
         }
}
The seat is empty so Seat2Character variable equals 0. We have to pop up the character selector window by setting the SeatManager variable to 2. This will display the selector window next to the slot#2.

regards
ROB
A2A Simulations Inc.

ROB - A2A
A2A Colonel
Posts: 3647
Joined: 02 Mar 2004, 02:56

Re: need help decoding adding/removing passengers in payload panel

Post by ROB - A2A »

With the selector window active, there are four clickspots for each character to click on and choose. Actually, there are three characters available because one is taken by the pilot.

You click on the 3rd character:

Code: Select all

3 (>L:Seat2Character,enum)
0 (>L:SeatManager,enum) 
You set the Seat2Character to 3. So our 3rd character sits on the 2nd seat.

And we close the character selector window by setting SeatManager variable to 0.

regards
ROB
A2A Simulations Inc.

ROB - A2A
A2A Colonel
Posts: 3647
Joined: 02 Mar 2004, 02:56

Re: need help decoding adding/removing passengers in payload panel

Post by ROB - A2A »

Now you can adjust his weight clicking the plus or minus clickspots which are enabled now.

Each character hes his weight stored in Character#Weight variable. In the code below we add 1 pound to a character occupying seat#2:

Code: Select all

(L:Seat2Character,enum) 1 == if{ (L:Character1Weight,pounds) (L:WeightConverter,number) + 100 max 300 min (>L:Character1Weight,pounds) }
(L:Seat2Character,enum) 2 == if{ (L:Character2Weight,pounds) (L:WeightConverter,number) + 100 max 300 min (>L:Character2Weight,pounds) }
(L:Seat2Character,enum) 3 == if{ (L:Character3Weight,pounds) (L:WeightConverter,number) + 100 max 300 min (>L:Character3Weight,pounds) }
(L:Seat2Character,enum) 4 == if{ (L:Character4Weight,pounds) (L:WeightConverter,number) + 100 max 300 min (>L:Character4Weight,pounds) }
In our case Seat2Character is 3 so we adjust Character3Weight variable and we do care not to exceed reasonable values by "100 max 300 min".

Here we remove 1 pound:

Code: Select all

(L:Seat2Character,enum) 1 == if{ (L:Character1Weight,pounds) (L:WeightConverter,number) - 100 max 300 min (>L:Character1Weight,pounds) }
(L:Seat2Character,enum) 2 == if{ (L:Character2Weight,pounds) (L:WeightConverter,number) - 100 max 300 min (>L:Character2Weight,pounds) }
(L:Seat2Character,enum) 3 == if{ (L:Character3Weight,pounds) (L:WeightConverter,number) - 100 max 300 min (>L:Character3Weight,pounds) }
(L:Seat2Character,enum) 4 == if{ (L:Character4Weight,pounds) (L:WeightConverter,number) - 100 max 300 min (>L:Character4Weight,pounds) }
regards
ROB
A2A Simulations Inc.

ROB - A2A
A2A Colonel
Posts: 3647
Joined: 02 Mar 2004, 02:56

Re: need help decoding adding/removing passengers in payload panel

Post by ROB - A2A »

And now we want to empty the seat. We click on the occupied passenger slot and we deal with the same code as for adding a passenger:

Code: Select all

(M:Event) 'LeftSingle' scmp 0 ==
if{
        (L:Seat2Character,enum) 0 != 
        if{ 
                 0 (>L:Seat2Character,enum)
                0 (>L:SeatManager,enum) 
         } 
         els{
                  (L:SeatManager,enum) 2 == 
                  if{ 
                        0 (>L:SeatManager,enum) 
                   }  
                  els{ 
                        2 (>L:SeatManager,enum) 
                  }
         }
}
This time Seat2Character is 3 so we set it to 0 and, just in case, we hide the character selector window setting SeatManager variable to 0.
The character's weight is still as it is, we don't touch it, with the empty seat it is not calculated.

Down below this code there is also a code that allows to change a weight of character using the mouse wheel.

Let me know the whole thing is is clearer now.

regards
ROB
A2A Simulations Inc.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019, 08:21

Re: need help decoding adding/removing passengers in payload panel

Post by jfayre »

Hi Rob,
Thanks for all this. So, since I'm designing this for people not using a mouse, I'm coding my own dialog.
Since as blind people, we can't see the character images, here are my thoughts.
I'll have a dialog with checkboxes for each seat, and edit boxes for the weights. From some hacking around, I've found that setting the Seat!Character variable to 1-4 will also cause the Character1-Character4 variables to populate with what I'm fairly sure is the seat number. I'm not worried about choosing a particular character avatar for each seat. Just putting a body in them. Seat 1 will get char 1, 2 will get 2, etc.
So, this is essentially bypassing the seat manager. I should then be able to tweak weights using the Character1Weight variable.
This appears to be working in some initial tests, I just want to make sure I'm not doing something horribly wrong.

ROB - A2A
A2A Colonel
Posts: 3647
Joined: 02 Mar 2004, 02:56

Re: need help decoding adding/removing passengers in payload panel

Post by ROB - A2A »

Just operate these variables: Seat#Character and Character#Weight. Ignore Character# or use it as read only. SeatManager is just to display the character selector window which you can also ignore however it also helps not to choose already taken character alsewhere.

Follow this:
Use Seat#Character within 0-4 range. Do not assign the same characters among the seats.
Use Character#Weight within 100 - 300 range (pounds). Try not to adjust weight of a character which is not in the cockpit.
Also, if there is no pilot in, there should be no passengers either.

You should be good.
regards
ROB
A2A Simulations Inc.

ROB - A2A
A2A Colonel
Posts: 3647
Joined: 02 Mar 2004, 02:56

Re: need help decoding adding/removing passengers in payload panel

Post by ROB - A2A »

Also be aware characters 1 and 3 are males, characters 2 and 4 are females so instruct your users to play with their weights accordingly.

regards
ROB
A2A Simulations Inc.

new reply

Return to “Bonanza Tech Support”

Who is online

Users browsing this forum: No registered users and 9 guests