{"name":"getFSMVariable","operator":null,"title":"getFSMVariable","type":"command","url":"https://community.bistudio.com/wiki/getFSMVariable","revid":330370,"updated":"2022-09-04T20:25:49Z","groups":["Variables"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Return the value of variable in the variable space of given FSM. The FSM handle is the number returned by the execFSM command.","syntaxes":[{"syntax":"FSMhandle getFSMVariable name","since":null,"effect":null,"exec":null,"params":[{"name":"FSMhandle","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"FSMhandle: Number"},{"name":"name","type":"String","optional":false,"default":null,"description":"name of the variable","types":["String"],"since":null,"text":"name: String - name of the variable"}],"returns":{"type":"Anything","types":["Anything"],"description":null,"text":"Anything"},"form":"binary","operator":null,"left":{"text":"FSMhandle","types":["Number"]},"right":{"text":"name","types":["String"]}},{"syntax":"FSMhandle getFSMVariable [name, defaultValue]","since":"arma3 1.68","effect":null,"exec":null,"params":[{"name":"FSMhandle","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"FSMhandle: Number"},{"name":"name","type":"String","optional":false,"default":null,"description":"name of the variable","types":["String"],"since":null,"text":"name: String - name of the variable"},{"name":"defaultValue","type":"Anything","optional":false,"default":null,"description":"value to return if variable is nil","types":["Anything"],"since":null,"text":"defaultValue: Anything - value to return if variable is nil"}],"returns":{"type":"Anything","types":["Anything"],"description":null,"text":"Anything"},"form":"binary","operator":null,"left":{"text":"FSMhandle","types":["Number"]},"right":{"text":"[name, defaultValue]","types":["Array"]}}],"examples":[{"text":"```sqf\n_handle getFSMVariable \"_foo\";\n```","code":["_handle getFSMVariable \"_foo\";"]},{"text":"```sqf\n_handle getFSMVariable [\"_foo\", 123];\n```","code":["_handle getFSMVariable [\"_foo\", 123];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["FSM","commandFSM","completedFSM","doFSM","execFSM","setFSMVariable"],"notes":[],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Variables","Introduced with Arma 2 version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}