Message to team / players

Message to team / players

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
coolmann
Posts: 6
Joined: 03 Dec 2012, 07:27

Message to team / players

Post by coolmann »

Hi,
I want to send a message to my allies, and to all players, but i dont get it to work.

I tried Spring.SendMessage and such.

I want to see it like i write myself with a: and s: or without.

Greetings
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Message to team / players

Post by Silentwings »

To make it exactly as though you typed the command you can use e.g. Spring.SendCommands("say a: hello allies").
coolmann
Posts: 6
Joined: 03 Dec 2012, 07:27

Re: Message to team / players

Post by coolmann »

Ah, that easy thx :)

Just for understanding, i have the following code:
Spring.SendCommands("say a: hello allies")
Spring.Echo ("Echo")
but the first to appear ingame is Echo.
Why?

Greetings
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Message to team / players

Post by Silentwings »

Not sure - I'm surprised to see that happen - I can only guess that some Spring.XX commands are put into queues which are only actioned later. Or maybe Spring.Echo gets a special hotline to the output because its (meant to be) used for debugging.
coolmann
Posts: 6
Joined: 03 Dec 2012, 07:27

Re: Message to team / players

Post by coolmann »

Okay.

One last question:

Spring.SendCommands (needs ModUICtrl)

( string command1 [, string command2 [ ... ] ] ) -> nil
( {string command1, string command2, ...} ) -> nil

thats from the list, but where to find a list with those commands?
Cant find the say here: http://springrts.com/wiki/Lua_CMDs
Maybe iam totally wrong..

Greetings
and thanks
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Message to team / players

Post by SirMaverick »

coolmann wrote:Just for understanding, i have the following code:
Spring.SendCommands("say a: hello allies")
Spring.Echo ("Echo")
but the first to appear ingame is Echo.
Why?
Echo is executed immetiately. It's like local println/printf.

SendCommand is a (synced) command that is (therefore) first send to the server, then back to the clients and then executed.
Post Reply

Return to “Lua Scripts”