I just made a scenario where two different vessels of different classes (R-4Script helicopter and Skiff boat) are loaded. Both vessels have different screen annotations to display prompts and vessel information to the user.
Right now when I load the scenario and start with the focus in the R-4, I get the annotations for that vessel, but also the ones for the Skiff. I presume that this is due to the fact that the annotation calls are oapi functions not associated with a vessel, so they get presented no matter which vessel is focus.
I assume that there must be some way using the vessel functions to basically do a check where if the current vessel interface is the interface of the script, then it can show the annotations. I get parts of it, but I'm still missing the big picture and specific procedure.
Right now, I establish the vessel interface in both the R-4 and Skiff with get_focusinterface at the top of the main Lua script like this:
I then try to restrict the annotations of both vessels to only show when the focus is on that vessel by using this in the annotation function:
This kinda sorta works. When I start the scenario in the R-4, it initially only shows the R-4 annotations. But when I switch to the skiff, I get the skiff annotations, but they persist when I return the focus back to the R-4.
I'm clearly doing something wrong, and I'm not sure if what I am doing is only affecting the annotations or that there is some additional potential for inadvertent cross-confusion between the vessels. What is the proper way to isolate what happens in a particular vessel in a scenario to that vessel and no others?
Right now when I load the scenario and start with the focus in the R-4, I get the annotations for that vessel, but also the ones for the Skiff. I presume that this is due to the fact that the annotation calls are oapi functions not associated with a vessel, so they get presented no matter which vessel is focus.
I assume that there must be some way using the vessel functions to basically do a check where if the current vessel interface is the interface of the script, then it can show the annotations. I get parts of it, but I'm still missing the big picture and specific procedure.
Right now, I establish the vessel interface in both the R-4 and Skiff with get_focusinterface at the top of the main Lua script like this:
Code:
vi = vessel.get_interface('R-4Script')
I then try to restrict the annotations of both vessels to only show when the focus is on that vessel by using this in the annotation function:
Code:
if vessel.get_focusinterface() == vi then
...show annotations for this vessel
end
This kinda sorta works. When I start the scenario in the R-4, it initially only shows the R-4 annotations. But when I switch to the skiff, I get the skiff annotations, but they persist when I return the focus back to the R-4.
I'm clearly doing something wrong, and I'm not sure if what I am doing is only affecting the annotations or that there is some additional potential for inadvertent cross-confusion between the vessels. What is the proper way to isolate what happens in a particular vessel in a scenario to that vessel and no others?




