When you use go[] with a transition, the transition animation needs two Images to animate between, so it sends the view[] event to the target card to see what it’s going to look like. Then, when the transition is complete and the new card is visible, it gets another “view” event like normal.
So no, you’re not doing something wrong, that’s just how Decker works.
If you’re struggling to get the solutions in that other thread working, here’s another alternative: by default, a transition takes 30 frames (half a second), so if view gets called twice within the same second, it’s probably because of a transition, and we can ignore the second one.
If you put a field named lastview on your card, you can use it to keep track of the last time view was called, like this:
on view do
# If the current frame is more than
# 60 frames (one second) since
# the last time view[] was called,
# call realview[].
if sys.frame > lastview.data + 60
realview[]
end
# Log that view[] was called
show["viewed" card.name]
# Update our records for next time
lastview.data:sys.frame
end
on realview do
show["real view"]
end
You should make the lastview field invisible and locked so that players don’t accidentally mess with it.
If you go to this card without a transition, in the Listener you should see the log messages:
"real view"
"viewed" card1
If you go to this card with a transition, you should see the log messages:
"real view"
"viewed" card1
"viewed" card1
realview[] was called for the first view, but the second view happened so soon afterwards, that it skipped calling realview[] the second time.