createDiaryRecord – Talk
Lou Montana (talk | contribs) m (Text replacement - "<code>" to "<code style="display: block">") |
Lou Montana (talk | contribs) m (Text replacement - "" to "") |
||
Line 14: | Line 14: | ||
Example: | Example: | ||
<code style="display: block">codestring = "script.sqf"; | <code style="display: block">codestring = "script.sqf"; | ||
player createDiaryRecord ["diary", ["Title", "<executeClose expression='execVM codestring'>Text</execute>"]];</code> {{User|Superxpdude}} - 23:57, 26 March | 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