Lua UnsyncedCtrl: Difference between revisions

From Spring
Jump to navigationJump to search
add Get/SetDrawSelectionInfo
No edit summary
Line 43: Line 43:
'''Spring.GetDrawSelectionInfo'''
'''Spring.GetDrawSelectionInfo'''
   ( ) -> boolean
   ( ) -> boolean
<font color="#55ee99">Returns whether &quot;Selected units&quot; text is displayed.</font>
'''Spring.GetDrawSelectionInfo'''
'''Spring.GetDrawSelectionInfo'''
   ( boolean drawSelectionInfo ) -> nil
   ( boolean drawSelectionInfo ) -> nil

Revision as of 21:27, 21 October 2008

Pipes

Spring.Echo

 ( arg1 [, arg2 [, ... ] ] ) -> nil
 Usefull for debugging.
Prints values in the spring chat console (hint: the default print() writes to STDOUT).

Spring.PlaySoundFile

 ( string "soundfile" [, number volume
   [, number x, number y, number z ] ] ) -> nil | boolean
 Plays WAV sounds. By default, the soundfile is expected to be in the "Sounds" folder.

Spring.PlaySoundStream

 ( string "oggfile" [, number volume = 1.0
   [, number x, number y, number z ]] ) -> nil | boolean true
 Allow you to play an Ogg Vorbis (.OGG) compressed sound file.
Note: you may only play _ONE_ stream at a time. If another stream is playing and
you try to start a second one the call will fail, and silence will result.
Note2: the file has to be on the local filesystem, so you can't playback ogg's
in your mod with this command, to do so you have to extract it before and save
it on the local filesystem.

Spring.StopSoundStream

 ( ) -> nil
 Terminates any 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

Spring.GetDrawSelectionInfo

 ( ) -> boolean

Returns whether "Selected units" text is displayed.

Spring.GetDrawSelectionInfo

 ( boolean drawSelectionInfo ) -> 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