To test this, set test=50 in vars section of scenario .sav file, and test=75 in code section of scenario file (example scenario file is attached to this post.)
^ Commands in code section run after clicking "OK"... but global vars are not set yet (see image below.)
^ Code section command has set test=75 BEFORE clicking "Start".
Code: Select all
/lua log.error("%s","test=" .. tostring(test))
^ Then click start and turn 0 shows test=50 from vars! The 75 is just gone, replaced by value in vars once "Start" is clicked. (Or possibly before clicking "Start", since gtk2 client shows value at 50 despite it having just been set to 75 in code section.)
Code: Select all
[script]
vars=$test=50
$
code=$
test=75
log.error("%s","test=" .. tostring(test))
function tester(turn, year)
log.error("%s","tester: test="..tostring(test))
end
signal.connect('turn_started', 'tester')
tester(-1,-1)
$