Lua UnsyncedCtrl
Pipes
Spring.Echo
( arg1 [, arg2 [, ... ] ] ) -> nil
This command is roughly equivalent to print, in standard Lua (with a few exceptions, documented in the Wiki). This is the most important single troubleshooting tool for coders wanting to check variable values, etc.
Typical usage:
local a,b,c = 1,2,3
Spring.Echo(a,b,c)
Results in "1,2,3" being shown in the Spring console.
Spring.PlaySoundFile
( string "soundfile" [, number volume [, number x, number y, number z ] ] ) -> nil | boolean
This command plays WAV sounds. By default, the soundfile is expected to be in the "Sounds" folder, just like sounds used for sound effects, etc.
Spring.PlaySoundStream (plays ogg-files!!!)
( string "oggfile" [, number volume = 1.0 [, number x, number y, number z ], boolean loop ] ) -> nil | boolean true
This command will allow you to play an Ogg Vorbis (.OGG) compressed sound file. Important note: you may only play ONE streaming sound at a time. And, if one stream tries to start playing, but another one isn't quite done yet, the call will fail, and silence will result. So, always either kill the stream, or put enough time between stream calls, or both, to ensure proper results.
Spring.StopSoundStream
( ) -> nil
This command terminates whatever SoundStream is running. Since only one may play at any time (see above), this can be used as an interrupt.
SendMessage
Spring.SendMessage
( string "message" ) -> nil
Spring.SendMessageToPlayer
( number playerID, string "message" ) -> nil
Spring.SendMessageToTeam
( number teamID, string "message" ) -> nil
Spring.SendMessageToAllyTeam
( number allyID, string "message" ) -> nil
Spring.SendMessageToSpectators
( string "message" ) -> nil
Unit Selection
Spring.SelectUnitMap
( { [unitID] = anything, ...} [,boolean append] ) -> nil
Spring.SelectUnitArray
( { [1] = unitID1 , [2] = unitID2 , ...} [,boolean append] ) -> nil
Unit Control
Spring.SetUnitNoDraw LuaGadgets only!
( number unitID, boolean noDraw ) -> nil
Spring.SetUnitNoSelect LuaGadgets only!
( number unitID, boolean noSelect ) -> nil
Spring.SetUnitNoMinimap LuaGadgets only!
( number unitID, boolean noMinimap ) -> nil
GUI
Spring.SetDrawSky
( boolean drawSky ) -> nil
Spring.SetDrawWater
( boolean drawWater ) -> nil
Spring.SetDrawGround
( boolean drawGround ) -> nil
Spring.DrawUnitCommands
( number unitID ) -> nil
( { [1] = unitID, ... } [, false ] ) -> nil
( { [unitID] = anything, ... }, true ) -> nil
Spring.SetTeamColor
( number teamID, number r, number g, number b ) -> nil
Spring.AssignMouseCursor default hotspot is center!
( string "cmdName", string "iconFileName" [, boolean overwrite [, boolean hotSpotTopLeft] ] ) -> nil | boolean
Spring.ReplaceMouseCursor default hotspot is center!
( string "oldFileName", string "newFileName" [, boolean hotSpotTopLeft] ) -> nil | boolean
Spring.SetCustomCommandDrawData register your custom cmd so it gets visible in the unit's cmd queue
( number cmdID,
number cmdIconID | string iconname | nil,
{ number r, number g, number b, number a } [, boolean showArea ] ) -> nil | true
Camera
Spring.SetCameraState
( table camState, number camTime) -> nil | boolean
camState = {
mode = cameraID,
1 = cameraID,
2 = posX,
3 = posY,
4 = posZ,
5 = dirX,
6 = dirY,
7 = dirZ,
... and more (depending on the camera ...
}
Spring.SetCameraTarget
( number x, number y, number z [,number transTime] ) -> nil
World Primitives
outdated! use opengl api instead!
Spring.AddWorldIcon
( number cmdID, number x, number y, number z ) -> nil
Spring.AddWorldText
( string "text", number x, number y, number z ) -> nil
Spring.AddWorldUnit
( number unitDefID, number x, number y, number z, number team, number facing) -> nil