createDiaryRecord – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
m (→‎Executing Code through createDiaryRecord: Added </code> tag and {{Unsigned}})
m (Remove soon-to-be non-existent template usage)
Line 14: Line 14:
Example:
Example:
<code>codestring = "script.sqf";
<code>codestring = "script.sqf";
player createDiaryRecord ["diary", ["Title", "<executeClose expression='execVM codestring'>Text</execute>"]];</code> {{Unsigned|23:57, 26 March 2014‎|Superxpdude}}
player createDiaryRecord ["diary", ["Title", "<executeClose expression='execVM codestring'>Text</execute>"]];</code> {{User|Superxpdude}} - 23:57, 26 March 2014‎

Revision as of 06:30, 2 January 2021

More goodies from mikey: http://www.ofpec.com/forum/index.php?topic=33468.0 --Doolittle 00:59, 27 August 2009 (CEST)

I don't understand why this command doesn't work on dedicated server? Even if unit is local to server it doesn't add record and on the other hand I can add record to any unit from client even if it is not local --MessiahUA 12:39, 6 June 2011 (CEST)

Executing Code through createDiaryRecord

So after messing around with the execute tags in createDiaryRecord, I've managed to find out a few things about them.

First of all, you need to use apostrophes to surround the code, otherwise the script will break since it thinks that the diary entry ends right after the "expression="
Example: <execute expression='Code'>Text</execute>

Second, for using things that require strings as inputs (hint, execVM, etc...) you have to define a string beforehand, then reference the string in the expression. Otherwise you'll end up with the game thinking the createDiaryRecord ends too early.
Example: codestring = "script.sqf"; player createDiaryRecord ["diary", ["Title", "<executeClose expression='execVM codestring'>Text</execute>"]]; Superxpdude - 23:57, 26 March 2014‎