You can use pointers to make changes to the original var, and not the copy...
Code:
function calculate_a_var(var* input)
{
*input= 1;
}


Now define a local var, and pass its memory address...
Code:
function test()
{
var calculated_var = 0;
while(1)
{
if (on_mouse == 1)
{
calculate_a_var(&calculated_var);
}
if (calculated_var == 1)
{
do something;
}
}
}