@InertiaM
Hi,
MSFS 2024 (not beta) already has the variable:
"IS AVATAR" (Boolean. This returns either 1 (TRUE) or 0 (FALSE) to indicate whether the user is in "Avatar" mode or not). This makes it easy to determine in AM whether the avatar is in or out of the aircraft.
The C-172 doesn't have the B variables that are already available on the Vision Jet or the TBM 930 to get in or out of the aircraft.
You actually have to use your "scoped L var." Unfortunately, strange things happen then that are different from other variables. If you need the value 1 to get in or out of the aircraft, you need the value 0 the next time you call it. Therefore, my new script now switches the value between 0 and 1 every time you click the button, depending, of course, on whether the ENTER or EXIT function is used.
Code: Select all
------------------------- ENTER and EXIT THE AIRCRAFT -------------------------------------------------------
ava_txt=txt_add("ENTER AC", "font:roboto_bold.ttf; size:24; color: white; halign:center;",25, 290, 100, 20)
local avatar
local entervalue = 1
local exitvalue = 1
function check_press_red()
if avatar == true then
msfs_rpn(entervalue.." (>L:1:ENTER_AIRCRAFT)")
entervalue = 1-entervalue
else
msfs_rpn(exitvalue.." (>L:1:EXIT_AIRCRAFT)")
exitvalue = 1-exitvalue
end
end
check_button =button_add("red_button.png", "red_button_pressed.png", 45, 310, 60, 60, check_press_red)
msfs_variable_subscribe("IS AVATAR","BOOL", function(ava)
avatar= ava
if ava then
txt_set(ava_txt,"ENTER AC")
else
txt_set(ava_txt,"LEAVE AC")
end
end)