@dc42 The problem is not in the variable name, I tested it and it did not work with the following script:
M30 "0:/sys/test/config_globals.g"
M28 "0:/sys/test/config_globals.g"
M29
M291 T0 S4 R"Welcome" P"Welcome to your Printer. Please select the version of printer you have" K{"V1","V2"}
if input = 0
M291 S3 R"Version V1" P"According to this, you have a V1 printer. Press OK to confirm, or cancel to re-start"
echo >"0:/sys/test/config_globals.g" "if !exists(global.config_version)"
echo >>"0:/sys/test/config_globals.g" " global version = 1"
global version = 1
if input = 1
M291 S3 R"Version V2" P"According to this, you have a V2 printer. Press OK to confirm, or cancel to re-start"
echo >"0:/sys/test/config_globals.g" "if !exists(global.config_version)"
echo >>"0:/sys/test/config_globals.g" " global version = 2"
global version = 2
if global.version = 1
M291 T0 S4 R"V2 to V3" P"Do you have a A model or a B model" K{"A model","B model"}
if input = 0
echo >>"0:/sys/test/config_globals.g" " global printer_model = 1"
global printer_model = 1
if input = 1
echo >>"0:/sys/test/config_globals.g" " global printer_model = 2"
global printer_model = 2
elif global.version = 2
M291 T0 S4 R"V2 to V3" P"Do you have a C model or a D model" K{"C model","D model"}
if input = 0
echo >>"0:/sys/test/config_globals.g" " global printer_model = 1"
global printer_model = 1
if input = 1
echo >>"0:/sys/test/config_globals.g" " global printer_model = 2"
global printer_model = 2
That outputs (when choosing V1 and model A)
if !exists(global.config_version)
global version = 1
However this combination of scripts does work:
M30 "0:/sys/test/config_globals.g"
M28 "0:/sys/test/config_globals.g"
M29
M291 T0 S4 R"Welcome" P"Welcome to your Printer. Please select the version of printer you have" K{"V1","V2"}
if input = 0
M291 S3 R"Version V1" P"According to this, you have a V1 printer. Press OK to confirm, or cancel to re-start"
echo >"0:/sys/test/config_globals.g" "if !exists(global.config_version)"
echo >>"0:/sys/test/config_globals.g" " global version = 1"
;global version = 1
if input = 1
M291 S3 R"Version V2" P"According to this, you have a V2 printer. Press OK to confirm, or cancel to re-start"
echo >"0:/sys/test/config_globals.g" "if !exists(global.config_version)"
echo >>"0:/sys/test/config_globals.g" " global version = 2"
;global version = 2
if global.version = 1
M98 P"0:/sys/test/version1.g"
elif global.generation = 2
M98 P"0:/sys/test/version2.g"
M291 T0 S4 R"V2 to V3" P"Do you have a A model or a B model" K{"A model","B model"}
if input = 0
echo >>"0:/sys/test/config_globals.g" " global printer_model = 1"
global printer_model = 1
if input = 1
echo >>"0:/sys/test/config_globals.g" " global printer_model = 2"
global printer_model = 2
M291 T0 S4 R"V2 to V3" P"Do you have a C model or a D model" K{"C model","D model"}
if input = 0
echo >>"0:/sys/test/config_globals.g" " global printer_model = 1"
global printer_model = 1
if input = 1
echo >>"0:/sys/test/config_globals.g" " global printer_model = 2"
global printer_model = 2
That outputs (when choosing V1 and model A)
if !exists(global.config_version)
global version = 1
global printer_model = 1
I don't see a good reason why the script with everything contained in one file would not work, but that same script just split out over three files does work as it should