Page 1 of 1
LUA - Special Messages
Posted: Sun Jan 21, 2018 9:31 am
by killjoy73au
Okay so another problem i'm having... making a special message with the following function:
ScenEdit_SpecialMessage('SideNameOrID','Text')
How do I incorporate the following message with HTML into the text?
[center]Tactical Update Message Received.[/center]
Confirmation received that a Chinese surface action group has been sunk.
With HTML it looks like:
<P align=center><STRONG>Tactical Update Message Received.</STRONG></P>
<P>Confirmation received that a Chinese surface action group has been sunk.</P>
Cheers.
RE: LUA - Special Messages
Posted: Mon Jan 22, 2018 2:45 am
by michaelm75au
Not sure that Lua method supports HTML?
RE: LUA - Special Messages
Posted: Mon Jan 22, 2018 4:15 am
by killjoy73au
I've no idea either, I was just going by the functions description...
ScenEdit_SpecialMessage (side, message)
Displays a special message consisting of the HTML text message to side `side.
Parameters:
side string The side name/guid to display the message on
message string The HTML text to display to the player
Not sure if there is any way to format a special message via LUA.
RE: LUA - Special Messages
Posted: Mon Jan 22, 2018 4:46 am
by michaelm75au
Was looking at the wrong command[:o].
Just tried it and what you posted works.
Do this in the Lua Editor.
local message = '<P align=center><STRONG>Tactical Update Message Received.</STRONG></P><P>Confirmation received that a Chinese surface action group has been sunk.</P>'
ScenEdit_SpecialMessage ('germany', message)
-- use whatever the side name is[:D]
RE: LUA - Special Messages
Posted: Mon Jan 22, 2018 4:59 am
by killjoy73au
Well look at that, saved me a whole lot of stuffing around.
Thanks mate.
RE: LUA - Special Messages
Posted: Mon Jan 22, 2018 7:37 pm
by Rory Noonan
Also a nice shortcut is using 'playerside' instead of 'Whatever the side is called', automatically sends it to player. Really handy for scenarios intended to be played by one side only.
RE: LUA - Special Messages
Posted: Wed Jan 24, 2018 12:10 am
by TheOttoman
<deleted as the answer was already provided>
RE: LUA - Special Messages
Posted: Mon Mar 05, 2018 1:35 pm
by kevinkins
Thanks for the code snippet. Using the HTML only makes sense if the player has special messages in a pop up checked in game options. So I wonder if there is a way to temporary force the pop-up when the player does not have the box checked? A work around is to perhaps alert the player in the briefing that it would be prudent to check the box.
Kevin
RE: LUA - Special Messages
Posted: Mon Mar 05, 2018 3:20 pm
by Rory Noonan
The ScenEdit_MsgBox() function displays a message regardless of player settings; doesn’t have the formatting flexibility of the SpecialMessage function though. I think a Lua command to be able to force special messages is a great idea.
RE: LUA - Special Messages
Posted: Mon Mar 05, 2018 9:46 pm
by kevinkins
I use ScenEdit_MsgBox() as a default so the player does not miss important messages that could be buried in the tiny font of message log. In fact, I never rely on the player seeing an important message embedded the message log. The MsgBox is the way to go. It's in the player's face. Formatted special messages would be far much better as an Alert to the player.
Kevin