As far as I can tell you need to specify that variables are global explicitly in scilab;
global counter
counter = 0
function checkForA()
global counter
// Do some stuff
counter = counter + 1
endfunction
function checkForB()
global counter
// Do some stuff
counter = counter + 3
endfunction
function printCounter()
global counter
disp(counter)
endfunction