So, in the deck script, I have a function stat_to_mod:
on stat_to_mod x do
floor (x-10)/2
end
Most widgets can use stat_to_mod[20] in their scripts and properly get the result 5, but for contraptions and widgets inside contraptions, it always returns 0 regardless of the argument. deck.stat_to_mod[20] also doesn't work (though It also doesn't work outside of contraptions so I didn't expect it to). The decker docs describe deck as a global constant, so I'm confused why this doesn't work.
I feel like I'm misunderstanding something important. Is there a way to achieve what I want to achieve?