createDiaryRecord: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(populated with empty template)
m (Remove syntaxhighlight spoiler hack)
 
(126 intermediate revisions by 20 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2 |= Game name
|game1= arma2
|version1= 1.00


|1.00|= Game version
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.50


| (description) |= Description
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| '''(command)''' |= Syntax
|game4= arma3
|version4= 0.50


|p1= |= PARAMETER1
|gr1= Briefing


|p2= |= PARAMETER2
|eff= local


|p3= |= PARAMETER3
|arg= local


| |= RETURNVALUE
|descr= Creates a [[Diary]] entry. Supported tags and their parameters: <spoiler>
{| class="wikitable sortable valign-top"
! Tag
! class="unsortable" | Options
! class="unsortable" | Example
|-
| img
|
* ''image'': [[String]] - path to image. When present, any element with it will be displayed as image.
* ''width'': [[Number]] - image width in pixels.
* ''height'': [[Number]] - image height in pixels.
* {{GVI|arma3|2.10|size= 0.75}} ''title'': [[String]] - tooltip to show on mouse over image
* {{GVI|arma3|2.10|size= 0.75}} ''src'': [[String]] - alternative to 'image'
{{Feature|arma3|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. {{hl|height {{=}} 370; ratio {{=}} 16/9; height {{=}} width / ratio;}}}}
|
<syntaxhighlight lang="html"><img image="picture.paa" width="128" height="64" /></syntaxhighlight>
<br>
Since {{arma3}} v2.10:
<syntaxhighlight lang="html"><img src="picture.paa" width="128" height="64" title="this is an image" /></syntaxhighlight>
|-
| font
|
* ''color'': [[String]] - {{Link|https://en.wikipedia.org/wiki/HTML_color|HTML color}} in format #aarrggbb or #rrggbb
* ''size'': [[Number]] - font height in pixels (default: 14)
* ''face'': [[String]] - font type (see [[FXY File Format#Available Fonts|Fonts]])
| <syntaxhighlight lang="html"><font color="#FF00FF" size="16" face="LucidaConsoleB">Hello there</font></syntaxhighlight>
|-
| br
| {{n/a}}
| <syntaxhighlight lang="html">Line 1<br />Line 2</syntaxhighlight>
|-
| marker
|
* ''name'': [[String]] - marker name
| <syntaxhighlight lang="html"><marker name="respawn_west">Respawn point</marker></syntaxhighlight>
|-
| execute
|
* ''expression'': [[String]] - executed code
| <syntaxhighlight lang="html"><execute expression="player setDamage 1">Die!</execute></syntaxhighlight>
|-
| executeClose
|
* ''expression'': [[String]] - executed code, diary is closed afterwards
| <syntaxhighlight lang="html"><executeClose expression="player setDamage 1">Die and close</executeClose></syntaxhighlight>
|-
| [[createDiaryLink|log]]
|
* ''subject'': [[String]] - [[createDiarySubject|subject]] name.
* ''record'': [[String]] - record ID (e.g. "Record6" or "Unit1059524")
| <syntaxhighlight lang="html"><log subject="Hello">Get to the "Hello" subject</log></syntaxhighlight>
<syntaxhighlight lang="html"><log subject="Hello" record="Record0">Go to the first record added to "Hello"</log></syntaxhighlight>
|-
| gear
|
* ''unit'': [[Number]] - unit ID
| <syntaxhighlight lang="html"><gear unit="123456">Open unit 123456's gear</gear></syntaxhighlight>
|-
| teamSwitch
|
* ''unit'': [[Number]] - unit ID
| <syntaxhighlight lang="html"><teamSwitch unit="123456">Switch to unit 123456</teamSwitch></syntaxhighlight>
|-
| kick
|
* ''id'': [[Number]] - unit ID
| <syntaxhighlight lang="html"><kick unit="123456">Kick player unit 123456</kick></syntaxhighlight>
|-
| ban
|
* ''id'': [[Number]] - unit ID
| <syntaxhighlight lang="html"><ban unit="123456">ban player unit 123456</ban></syntaxhighlight>
|-
| mute
|
* ''id'': [[Number]] - unit ID
| <syntaxhighlight lang="html"><mute unit="123456">mute player unit 123456</mute></syntaxhighlight>
|-
| voteadmin
|
* ''id'': [[Number]] - unit ID
| <syntaxhighlight lang="html"><voteadmin unit="123456">vote admin unit 123456</voteadmin></syntaxhighlight>
|-
| votekick
|
* ''id'': [[Number]] - unit ID
| <syntaxhighlight lang="html"><votekick unit="123456">vote kick player unit 123456</votekick></syntaxhighlight>
|-
| currentTask
|
* ''id'': [[Number]] - task ID
* ''action'': [[String]] - 'n' or 's' (select)
| <syntaxhighlight lang="html"><currentTask id="my_task">get to my_task task</currentTask></syntaxhighlight>
|}</spoiler>
{{Feature|informative|
If the [[createDiaryRecord]] command fails, it returns a null record.
Before {{arma3}} v2.00, [[isNull]] did not work with the diary record type and [[diaryRecordNull]] did not exist.
In order to verify a null record, it is possible to create a variable and compare against it:
<sqf>
private _recordNull = objNull createDiaryRecord [];
private _createdRecord = player createDiaryRecord ["Diary", ["Title", "Description"]];
if (_createdRecord isEqualTo _recordNull) then { hint "Failed"; };
</sqf>
}}


|s1= player [[createDiaryRecord]] [subject, textInfo, task, taskState, showTitle]


|x1= <code>(example)</code>|= EXAMPLE1
|p1= player: [[Object]]


____________________________________________________________________________________________
|p2= subject: [[String]]


| |= SEEALSO
|p3= textInfo: [[String]] or [[Array]] of [[String]]s - can be:
* [[String]] - the record's content - its title will be empty
* [[Array]] of [[String]]s - format [title, text, icon]:
** title: [[String]]
** text: [[String]]
** {{GVI|arma3|2.10|size= 0.75}} icon: [[String]] - (Optional) icon to show next to the title


| |= MPBEHAVIOUR
|p4= task: [[Task]] - (Optional, default [[taskNull]])
____________________________________________________________________________________________
 
|p5= taskState: [[String]] - (Optional, default {{hl|"NONE"}}) changes the state of the given task. Can be one of:
{{Columns|3|
* {{hl|"NONE"}}
* {{hl|"CREATED"}}
* {{hl|"ASSIGNED"}}
* {{hl|"SUCCEEDED"}}
* {{hl|"FAILED"}}
* {{hl|"CANCELED"}}
}}
}}


<h3 style='display:none'>Notes</h3>
|p6= showTitle: [[Boolean]] - (Optional, default [[true]]) whether or not to show title in the description section as well
<dl class='command_description'>
|p6since= arma3 1.96
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|r1= [[Diary Record]]
</dl>


<h3 style='display:none'>Bottom Section</h3>
|x1= <sqf>player createDiaryRecord ["Diary", ["Intel", "Enemy base is on grid <marker name='enemyBase'>161170</marker>"]]</sqf>
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
|x2= <sqf>player createDiaryRecord ["Diary", "Information gathered.<br /><img image='wellDone_ca.paa' />"]</sqf>
 
|x3= <sqf>player createDiaryRecord ["Diary", ["Title", "Description"], taskNull, "", false];</sqf>
 
|x4= <sqf>
player createDiaryRecord [
"Diary",
["Font tag", "<font color='#7FFF00' size='30' face='TahomaB'>This will changed text size, colour and font</font>"],
taskNull,
"",
false
];
</sqf>
 
|x5= <sqf>
player createDiaryRecord [
"Diary",
["Image", "<img image='\A3\Ui_F_Curator\Data\Logos\arma3_curator_artwork.jpg' width='500' height='800' />"],
taskNull,
"",
false
];
</sqf>
 
|x6= <sqf>player createDiaryRecord ["Diary", ["Linebreak", "Line1<br />Line2<br /><br />Line4"], taskNull, "", false];</sqf>
 
|x7= <sqf>player createDiaryRecord ["Diary", ["Execute","<execute expression='hint ""Some code"";'>Some text</execute>"], taskNull, "", false];</sqf>
 
|x8= <sqf>player createDiaryRecord ["Diary", ["ExecuteClose", "<executeClose expression=""hint 'Diary closed';"">Close Diary</executeClose>"], taskNull, "", false];</sqf>
 
|seealso= [[allDiaryRecords]] [[processDiaryLink]] [[createDiaryLink]] [[createDiarySubject]] [[diarySubjectExists]] [[setDiaryRecordText]] [[removeDiaryRecord]]
}}
 
{{Note
|user= Tankbuster
|timestamp= 20170324201100
|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.
}}
 
{{Note
|user= R3vo
|timestamp= 20190622162800
|text= It seems that the '''task''' parameter has no effect in {{arma3}} because the task entry in the briefing menu is created when the task itself was created.
}}
 
{{Note
|user= Honger
|timestamp= 20221018175112
|text= <nowiki><log></nowiki>, as <sqf inline>createDiaryLink</sqf>, 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).
}}

Latest revision as of 13:51, 23 June 2023

Hover & click on the images for description

Description

Description:
Creates a Diary entry. Supported tags and their parameters:
Tag Options Example
img
  • image: String - path to image. When present, any element with it will be displayed as image.
  • width: Number - image width in pixels.
  • height: Number - image height in pixels.
  • Arma 3 logo black.png2.10 title: String - tooltip to show on mouse over image
  • Arma 3 logo black.png2.10 src: String - alternative to 'image'
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;
<img image="picture.paa" width="128" height="64" />


Since Arma 3 v2.10:

<img src="picture.paa" width="128" height="64" title="this is an image" />
font
<font color="#FF00FF" size="16" face="LucidaConsoleB">Hello there</font>
br N/A
Line 1<br />Line 2
marker
<marker name="respawn_west">Respawn point</marker>
execute
  • expression: String - executed code
<execute expression="player setDamage 1">Die!</execute>
executeClose
  • expression: String - executed code, diary is closed afterwards
<executeClose expression="player setDamage 1">Die and close</executeClose>
log
<log subject="Hello">Get to the "Hello" subject</log>
<log subject="Hello" record="Record0">Go to the first record added to "Hello"</log>
gear
<gear unit="123456">Open unit 123456's gear</gear>
teamSwitch
<teamSwitch unit="123456">Switch to unit 123456</teamSwitch>
kick
<kick unit="123456">Kick player unit 123456</kick>
ban
<ban unit="123456">ban player unit 123456</ban>
mute
<mute unit="123456">mute player unit 123456</mute>
voteadmin
<voteadmin unit="123456">vote admin unit 123456</voteadmin>
votekick
<votekick unit="123456">vote kick player unit 123456</votekick>
currentTask
<currentTask id="my_task">get to my_task task</currentTask>
↑ Back to spoiler's top
If the createDiaryRecord command fails, it returns a null record.

Before Arma 3 v2.00, isNull did not work with the diary record type and diaryRecordNull did not exist. In order to verify a null record, it is possible to create a variable and compare against it:

private _recordNull = objNull createDiaryRecord []; private _createdRecord = player createDiaryRecord ["Diary", ["Title", "Description"]]; if (_createdRecord isEqualTo _recordNull) then { hint "Failed"; };
Groups:
Briefing

Syntax

Syntax:
player createDiaryRecord [subject, textInfo, task, taskState, showTitle]
Parameters:
player: Object
subject: String
textInfo: String or Array of Strings - can be:
task: Task - (Optional, default taskNull)
taskState: String - (Optional, default "NONE") changes the state of the given task. Can be one of:
  • "NONE"
  • "CREATED"
  • "ASSIGNED"
  • "SUCCEEDED"
  • "FAILED"
  • "CANCELED"
since Arma 3 logo black.png1.96
showTitle: Boolean - (Optional, default true) whether or not to show title in the description section as well
Return Value:
Diary Record

Examples

Example 1:
player createDiaryRecord ["Diary", ["Intel", "Enemy base is on grid <marker name='enemyBase'>161170</marker>"]]
Example 2:
player createDiaryRecord ["Diary", "Information gathered.<br /><img image='wellDone_ca.paa' />"]
Example 3:
player createDiaryRecord ["Diary", ["Title", "Description"], taskNull, "", false];
Example 4:
player createDiaryRecord [ "Diary", ["Font tag", "<font color='#7FFF00' size='30' face='TahomaB'>This will changed text size, colour and font</font>"], taskNull, "", false ];
Example 5:
player createDiaryRecord [ "Diary", ["Image", "<img image='\A3\Ui_F_Curator\Data\Logos\arma3_curator_artwork.jpg' width='500' height='800' />"], taskNull, "", false ];
Example 6:
player createDiaryRecord ["Diary", ["Linebreak", "Line1<br />Line2<br /><br />Line4"], taskNull, "", false];
Example 7:
player createDiaryRecord ["Diary", ["Execute","<execute expression='hint ""Some code"";'>Some text</execute>"], taskNull, "", false];
Example 8:
player createDiaryRecord ["Diary", ["ExecuteClose", "<executeClose expression=""hint 'Diary closed';"">Close Diary</executeClose>"], taskNull, "", false];

Additional Information

See also:
allDiaryRecords processDiaryLink createDiaryLink createDiarySubject diarySubjectExists setDiaryRecordText removeDiaryRecord

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Tankbuster - c
Posted on Mar 24, 2017 - 20:11 (UTC)
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.
R3vo - c
Posted on Jun 22, 2019 - 16:28 (UTC)
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.
Honger - c
Posted on Oct 18, 2022 - 17:51 (UTC)
<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).