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 » 16 Nov 2014, 14:46

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
0 x

User avatar
Silentwings
Moderator
Posts: 3597
Joined: 25 Oct 2008, 00:23

Re: Message to team / players

Post by Silentwings » 16 Nov 2014, 15:37

To make it exactly as though you typed the command you can use e.g. Spring.SendCommands("say a: hello allies").
0 x

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

Re: Message to team / players

Post by coolmann » 16 Nov 2014, 16:37

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
0 x

User avatar
Silentwings
Moderator
Posts: 3597
Joined: 25 Oct 2008, 00:23

Re: Message to team / players

Post by Silentwings » 16 Nov 2014, 17:08

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.
0 x

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

Re: Message to team / players

Post by coolmann » 16 Nov 2014, 19:14

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
0 x

User avatar
Silentwings
Moderator
Posts: 3597
Joined: 25 Oct 2008, 00:23

Re: Message to team / players

Post by Silentwings » 16 Nov 2014, 19:36

0 x

SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Message to team / players

Post by SirMaverick » 17 Nov 2014, 05:16

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.
0 x

Post Reply

Return to “Lua Scripts”