{"name":"createDiaryRecord","operator":null,"title":"createDiaryRecord","type":"command","url":"https://community.bistudio.com/wiki/createDiaryRecord","revid":370359,"updated":"2024-12-02T16:08:54Z","groups":["Briefing"],"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":"local","effect":"local","server_exec":false},"exec":null,"description":"Creates a Diary entry. Supported tags and their parameters:\n\n| Tag | Options | Example |\n|---|---|---|\n| img | - *image*: String - path to image. When present, any element with it will be displayed as image.<br>- *width*: Number - image width in pixels.<br>- *height*: Number - image height in pixels.<br>- Arma 3 v2.10 *title*: String - tooltip to show on mouse over image<br>- Arma 3 v2.10 *src*: String - alternative to 'image'<br>> [!NOTE]<br>> **Arma 3:** Maximum width supported seems to be **370** pixels as a wider image will be cut off. Height should be calculated with the aspect ratio of the image. `height = 370; ratio = 16/9; height = width / ratio;` | ```html<br><img image=\"picture.paa\" width=\"128\" height=\"64\" /><br>```<br>Since Arma 3 v2.10:<br>```html<br><img src=\"picture.paa\" width=\"128\" height=\"64\" title=\"this is an image\" /><br>``` |\n| font | - *color*: String - [HTML color](https://en.wikipedia.org/wiki/HTML_color) in format #aarrggbb or #rrggbb<br>- *size*: Number - font height in pixels (default: 14)<br>- *face*: String - font type (see Fonts) | ```html<br><font color=\"#FF00FF\" size=\"16\" face=\"LucidaConsoleB\">Hello there</font><br>``` |\n| br | N/A | ```html<br>Line 1<br />Line 2<br>``` |\n| marker | - *name*: String - marker name | ```html<br><marker name=\"respawn_west\">Respawn point</marker><br>``` |\n| execute | - *expression*: String - executed code | ```html<br><execute expression=\"player setDamage 1\">Die!</execute><br>``` |\n| executeClose | - *expression*: String - executed code, diary is closed afterwards | ```html<br><executeClose expression=\"player setDamage 1\">Die and close</executeClose><br>``` |\n| log | - *subject*: String - subject name.<br>- *record*: String - record ID (e.g. \"Record6\" or \"Unit1059524\") | ```html<br><log subject=\"Hello\">Get to the \"Hello\" subject</log><br>```<br>```html<br><log subject=\"Hello\" record=\"Record0\">Go to the first record added to \"Hello\"</log><br>``` |\n| gear | - *unit*: Number - unit ID | ```html<br><gear unit=\"123456\">Open unit 123456's gear</gear><br>``` |\n| teamSwitch | - *unit*: Number - unit ID | ```html<br><teamSwitch unit=\"123456\">Switch to unit 123456</teamSwitch><br>``` |\n| kick | - *id*: Number - unit ID | ```html<br><kick unit=\"123456\">Kick player unit 123456</kick><br>``` |\n| ban | - *id*: Number - unit ID | ```html<br><ban unit=\"123456\">ban player unit 123456</ban><br>``` |\n| mute | - *id*: Number - unit ID | ```html<br><mute unit=\"123456\">mute player unit 123456</mute><br>``` |\n| voteadmin | - *id*: Number - unit ID | ```html<br><voteadmin unit=\"123456\">vote admin unit 123456</voteadmin><br>``` |\n| votekick | - *id*: Number - unit ID | ```html<br><votekick unit=\"123456\">vote kick player unit 123456</votekick><br>``` |\n| currentTask | - *id*: Number - task ID<br>- *action*: String - 'n' or 's' (select) | ```html<br><currentTask id=\"my_task\">get to my_task task</currentTask><br>``` |\n\n> [!NOTE]\n> If the createDiaryRecord command fails, it returns a null record.\n> Before Arma 3 v2.00, isNull did not work with the diary record type and diaryRecordNull did not exist.\n> In order to verify a null record, it is possible to create a variable and compare against it:\n>\n> ```sqf\n> private _recordNull = objNull createDiaryRecord [];\n> private _createdRecord = player createDiaryRecord [\"Diary\", [\"Title\", \"Description\"]];\n> if (_createdRecord isEqualTo _recordNull) then { hint \"Failed\"; };\n> ```","syntaxes":[{"syntax":"player createDiaryRecord [subject, textInfo, task, taskState, showTitle]","since":null,"effect":null,"exec":null,"params":[{"name":"player","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"player: Object"},{"name":"subject","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"subject: String"},{"name":"textInfo","type":"String or Array of Strings","optional":true,"default":null,"description":"can be:\n- String - the record's content - its title will be empty\n- Array of Strings - format [title, text, icon]:\n  - title: String\n  - text: String\n  - Arma 3 v2.10 icon: String -  icon to show next to the title","types":["String","Array"],"since":null,"text":"textInfo: String or Array of Strings - can be:\n- String - the record's content - its title will be empty\n- Array of Strings - format [title, text, icon]:\n  - title: String\n  - text: String\n  - Arma 3 v2.10 icon: String - (Optional) icon to show next to the title"},{"name":"task","type":"Task","optional":true,"default":"taskNull","description":null,"types":["Task"],"since":null,"text":"task: Task - (Optional, default taskNull)"},{"name":"taskState","type":"String","optional":true,"default":"`\"NONE\"`","description":"changes the state of the given task. Can be one of:\n- `\"NONE\"`\n- `\"CREATED\"`\n- `\"ASSIGNED\"`\n- `\"SUCCEEDED\"`\n- `\"FAILED\"`\n- `\"CANCELED\"`","types":["String"],"since":null,"text":"taskState: String - (Optional, default `\"NONE\"`) changes the state of the given task. Can be one of:\n- `\"NONE\"`\n- `\"CREATED\"`\n- `\"ASSIGNED\"`\n- `\"SUCCEEDED\"`\n- `\"FAILED\"`\n- `\"CANCELED\"`"},{"name":"showTitle","type":"Boolean","optional":true,"default":"true","description":"whether or not to show title in the description section as well","types":["Boolean"],"since":"arma3 1.96","text":"showTitle: Boolean - (Optional, default true) whether or not to show title in the description section as well"}],"returns":{"type":"Diary Record","types":["Diary Record"],"description":null,"text":"Diary Record"},"form":"binary","operator":null,"left":{"text":"player","types":["Object"]},"right":{"text":"[subject, textInfo, task, taskState, showTitle]","types":["Array"]}}],"examples":[{"text":"```sqf\nplayer createDiaryRecord [\"Diary\", [\"Intel\", \"Enemy base is on grid <marker name='enemyBase'>161170</marker>\"]];\n```","code":["player createDiaryRecord [\"Diary\", [\"Intel\", \"Enemy base is on grid <marker name='enemyBase'>161170</marker>\"]];"]},{"text":"```sqf\nplayer createDiaryRecord [\"Diary\", \"Information gathered.<br /><img image='wellDone_ca.paa' />\"];\n```","code":["player createDiaryRecord [\"Diary\", \"Information gathered.<br /><img image='wellDone_ca.paa' />\"];"]},{"text":"```sqf\nplayer createDiaryRecord [\"Diary\", [\"Title\", \"Description\"], taskNull, \"\", false];\n```","code":["player createDiaryRecord [\"Diary\", [\"Title\", \"Description\"], taskNull, \"\", false];"]},{"text":"```sqf\nplayer createDiaryRecord [\n    \"Diary\",\n    [\"Font tag\", \"<font color='#7FFF00' size='30' face='TahomaB'>This will changed text size, colour and font</font>\"],\n    taskNull,\n    \"\",\n    false\n];\n```","code":["player createDiaryRecord [\n\t\"Diary\",\n\t[\"Font tag\", \"<font color='#7FFF00' size='30' face='TahomaB'>This will changed text size, colour and font</font>\"],\n\ttaskNull,\n\t\"\",\n\tfalse\n];"]},{"text":"```sqf\nplayer createDiaryRecord [\n    \"Diary\",\n    [\"Image\", \"<img image='\\A3\\Ui_F_Curator\\Data\\Logos\\arma3_curator_artwork.jpg' width='500' height='800' />\"],\n    taskNull,\n    \"\",\n    false\n];\n```","code":["player createDiaryRecord [\n\t\"Diary\",\n\t[\"Image\", \"<img image='\\A3\\Ui_F_Curator\\Data\\Logos\\arma3_curator_artwork.jpg' width='500' height='800' />\"],\n\ttaskNull,\n\t\"\",\n\tfalse\n];"]},{"text":"```sqf\nplayer createDiaryRecord [\"Diary\", [\"Linebreak\", \"Line1<br />Line2<br /><br />Line4\"], taskNull, \"\", false];\n```","code":["player createDiaryRecord [\"Diary\", [\"Linebreak\", \"Line1<br />Line2<br /><br />Line4\"], taskNull, \"\", false];"]},{"text":"```sqf\nplayer createDiaryRecord [\"Diary\", [\"Execute\",\"<execute expression='hint \"\"Some code\"\";'>Some text</execute>\"], taskNull, \"\", false];\n```","code":["player createDiaryRecord [\"Diary\", [\"Execute\",\"<execute expression='hint \"\"Some code\"\";'>Some text</execute>\"], taskNull, \"\", false];"]},{"text":"```sqf\nplayer createDiaryRecord [\"Diary\", [\"ExecuteClose\", \"<executeClose expression=\"\"hint 'Diary closed';\"\">Close Diary</executeClose>\"], taskNull, \"\", false];\n```","code":["player createDiaryRecord [\"Diary\", [\"ExecuteClose\", \"<executeClose expression=\"\"hint 'Diary closed';\"\">Close Diary</executeClose>\"], taskNull, \"\", false];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["allDiaryRecords","processDiaryLink","createDiaryLink","createDiarySubject","diarySubjectExists","setDiaryRecordText","removeDiaryRecord"],"notes":[{"user":"Tankbuster","date":"2017-03-24T20:11:00Z","text":"When adding multiple diary records, be aware that they appear in reverse order. ie the first one you add will appear last and the last one you add will be first."},{"user":"R3vo","date":"2019-06-22T16:28:00Z","text":"It seems that the **task** parameter has no effect in Arma 3 because the task entry in the briefing menu is created when the task itself was created."},{"user":"Honger","date":"2022-10-18T17:51:12Z","text":"<log>, as `createDiaryLink`, requires declaring **both** subject and ID of the record belonging to said subject. Otherwise generated text will not be clickable or might open a non-existing record (behaviour similar to clicking on map when viewing Diary)."}],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Briefing","Introduced with Arma 2 version 1.00","Scripting Commands","Scripting Commands: Local Effect","Take On Helicopters: Scripting Commands"]}