The following code exhibits the problem. Only the second vecdraw is visible on screen, because the first one gets reset to :show = false when the second one got made:
set vlist to list().
function make_vecdraw {
parameter vec, label.
set temp_vecdraw to vecdraw(v(0,0,0), vec, red, label, 1, true, 1).
vlist:add(temp_vecdraw).
}
make_vecdraw(20*ship:north:vector, "north").
wait 0.01.
make_vecdraw(20*ship:up:vector, "up").
wait 5.
The following code does not have the problem. The mere changing of temp_vecdraw to a local instead of a global makes it so that both vecdraws remain visible.
set vlist to list().
function make_vecdraw {
parameter vec, label.
local temp_vecdraw is vecdraw(v(0,0,0), vec, red, label, 1, true, 1).
vlist:add(temp_vecdraw).
}
make_vecdraw(20*ship:north:vector, "north").
wait 0.01.
make_vecdraw(20*ship:up:vector, "up").
wait 5.
Possible reason:
There is a feature in kOS to detect when a VECDRAW has been fully orphaned away and can't be accessed from the kerboscript code anymore. When that happens the vecdraw is hidden so that users won't have a big arrow on screen they can't get rid of. That feature is probably misfiring here in some way.
I think you mixed up your code excerpts and text. The problem occurred when I used
set temp_vecdraw to ...
and was resolved with
local temp_vecdraw is ...
The following code exhibits the problem. Only the second vecdraw is visible on screen, because the first one gets reset to
:show = false
when the second one got made:The following code does not have the problem. The mere changing of
temp_vecdraw
to a local instead of a global makes it so that both vecdraws remain visible.Possible reason:
There is a feature in kOS to detect when a VECDRAW has been fully orphaned away and can't be accessed from the kerboscript code anymore. When that happens the vecdraw is hidden so that users won't have a big arrow on screen they can't get rid of. That feature is probably misfiring here in some way.