createDiaryRecord – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
m (→‎Executing Code through createDiaryRecord: Added </code> tag and {{Unsigned}})
m (Text replacement - "‎" to "")
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
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="<br>
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="<br>
Example:
Example:
<code><execute expression='Code'>Text</execute></code>
<code style="display: block"><execute expression='Code'>Text</execute></code>


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. <br>
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. <br>
Example:
Example:
<code>codestring = "script.sqf";
<code style="display: block">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

Latest revision as of 11:55, 26 April 2023

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