{"name":"setAttributes","operator":null,"title":"setAttributes","type":"command","url":"https://community.bistudio.com/wiki/setAttributes","revid":351277,"updated":"2023-11-27T02:34:49Z","groups":["Strings","Structured Text"],"status":"ok","replaced_by":[],"games":[{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"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":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns a Structured Text created from the given structured text and sets attributes to the given values.\n\n> [!IMPORTANT]\n> Even though command accepts plain String too, the argument should be Structured Text in order for the set attributes to have an effect.\n> Additionally the result of the command should be fed to composeText (See #Example 1) or formatText.","syntaxes":[{"syntax":"text setAttributes [name1, value1, name2, value2, ...]","since":null,"effect":null,"exec":null,"params":[{"name":"text","type":"String or Structured Text","optional":false,"default":null,"description":"only passing Structured Text has any effect","types":["String","Structured Text"],"since":null,"text":"text: String or Structured Text - only passing Structured Text has any effect"},{"name":"nameN","type":"String","optional":false,"default":null,"description":"name of the attribute","types":["String"],"since":null,"text":"nameN: String - name of the attribute"},{"name":"valueN","type":"String","optional":false,"default":null,"description":"value of the attribute","types":["String"],"since":null,"text":"valueN: String - value of the attribute"}],"returns":{"type":"Structured Text","types":["Structured Text"],"description":null,"text":"Structured Text"},"form":"binary","operator":null,"left":{"text":"text","types":["String","Structured Text"]},"right":{"text":"[name1, value1, name2, value2, ...]","types":["Array"]}}],"examples":[{"text":"```sqf\n_txt = text \"Red text, right align\";\n_txt setAttributes [\"color\", \"#FF0000\", \"align\", \"right\"];\nhint composeText [_txt];\n```","code":["_txt = text \"Red text, right align\";\n_txt setAttributes [\"color\", \"#FF0000\", \"align\", \"right\"];\nhint composeText [_txt];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["composeText","formatText","parseText","text","ctrlSetStructuredText"],"notes":[],"categories":[]}