gosub setup
gosub main %characterdata1 %characterdata2 %characterdata3
halt
sub main
namespace push
namespace local main
if %0 > 0
set !chard1 %1
if %0 > 1
set !chard2 %2
if %0 > 2
set !chard3 %3
else
set !chard3 defaultvalue
while %end_condition = #false
{
; do work
gosub Process1 !chard3
}
namepace pop
return
sub setup
; here define initialization or character specific data
set %characterdata1 blah
set %characterdata2 yes
set %characterdata3 42
return
sub Process1
namespace push ; preserve the former namespace so we can return to it later
namespace local Process1
if %0 > 0
set !chard1 %1 ; This chard1 is isolated from the !chard1 in the sub main
else
set !chard1 some_default_value ; This chard1 is isolated from the !chard1 in the sub main
; do work
namespace pop ; we are returning the former namespace that was in effect before the last namespace push command
return