B# is largely stateless, we listen to events and respond to them "right away". However, if you do need to store some information you can use our global variable storage via commands such as OUTPUT_SetGlobalVariable(key, intergerValue) allowing you to store integer values to retrieve at a later time.
Please DO NOT store variables like this var thing = 123 at the global scope. Values like this still be lost to the void when the player exits and reloads.