LUA - Special Messages

All discussions & material related to Command's Lua interface

Moderators: michaelm75au, angster, RoryAndersonCDT, MOD_Command

Post Reply
User avatar
killjoy73au
Posts: 31
Joined: Mon Jul 10, 2017 5:56 am

LUA - Special Messages

Post 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.
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA - Special Messages

Post by michaelm75au »

Not sure that Lua method supports HTML?
Michael
User avatar
killjoy73au
Posts: 31
Joined: Mon Jul 10, 2017 5:56 am

RE: LUA - Special Messages

Post 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.
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA - Special Messages

Post 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]
Michael
User avatar
killjoy73au
Posts: 31
Joined: Mon Jul 10, 2017 5:56 am

RE: LUA - Special Messages

Post by killjoy73au »

Well look at that, saved me a whole lot of stuffing around.

Thanks mate.
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: LUA - Special Messages

Post 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.
Image
TheOttoman
Posts: 139
Joined: Thu Dec 14, 2017 3:29 pm

RE: LUA - Special Messages

Post by TheOttoman »

<deleted as the answer was already provided>
User avatar
kevinkins
Posts: 2465
Joined: Wed Mar 08, 2006 11:54 am

RE: LUA - Special Messages

Post 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
“The study of history lies at the foundation of all sound military conclusions and practice.”
Alfred Thayer Mahan
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: LUA - Special Messages

Post 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.
Image
User avatar
kevinkins
Posts: 2465
Joined: Wed Mar 08, 2006 11:54 am

RE: LUA - Special Messages

Post 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
“The study of history lies at the foundation of all sound military conclusions and practice.”
Alfred Thayer Mahan
Post Reply

Return to “Lua Legion”