This is a part of my Audiosurf 2 scripting documentation.
This page documents the version released February 21, 2014 and isn't complete yet.
type name = default or choice2 or choice3 -- extra information
If I write ?=
instead of =
that means omitting the value will cause the existing value or default to be preserved. Only matters if you're calling the function more than once.
The mod script is executed during the loading screen when starting a song. A function in the script named Update()
, if present, will be executed every frame during actual gameplay.
This function is executed inside of Unity's LateUpdate function.
Arguments:
float dt -- the current value of Unity's deltaTime value
float tracklocation -- The fractional index of the track node that the player is currently "on". (When the player is halfway between nodes 3 and 4, CurrentNode is 3.5)
float playerstrafe -- the player's current offset from the center of the track
table input -- the same table returned by GetInput()
float currentWakeboarderJumpHeight
This function is executed [].
Arguments:
float dt -- the current value of Unity's deltaTime value
float tracklocation -- The fractional index of the track node that the player is currently "on". (When the player is halfway between nodes 3 and 4, CurrentNode is 3.5)
float playerstrafe -- the player's current offset from the center of the track
table input -- the same table returned by GetInput()
float currentWakeboarderJumpHeight
TODO
Creates an "automagic table". Attempting to access a sub-table inside the table automatically generates that table.
a = AutomagicTable() a.b.c.d = "a.b and a.b.c are automatically created"
It is the exact same thing as this: http://lua-users.org/wiki/AutomagicTables
float jumpheightscaler = 1
float gravity = -0.45
bool usetraffic = true
bool airstrafing ?= false
bool usejumpmarkers = false
float fullgrid_collectiongracetime = 0.0
bool smoothstrafetowake = false
float puzzleblockfallinterval ?= 0.1
float blockflight_secondstopuzzle ?= 0.35
bool automatic_traffic_collisions = true
bool usepuzzlegrid = true
int puzzlerows = 7
int puzzlecols = 3
bool cleargridonlanding ?= true
bool cleargridonlanding ?= true
bool forceclearsinglecolumns ?= true
bool forcecollectiononoverfill ?= true
bool show_x_in_a_row_text ?= false
bool useBlockTrailToOptimalJumps = false
int removeBlocksNearOptimalJumps = 0
bool usePinatas = false
bool useAirBlocks = false
bool blocksInLanes = true
bool useLivingScoreboardGhosts = true
bool cancrash ?= false
bool canpush ?= false
bool canScoop ?= false
bool multilane ?= false
int colorcount ?= 1
int blocktype_grey ?= 5
int blocktype_highway ?= 6
int blocktype_highwayinverted ?= 7
float greypercent ?= 0.3
bool greyrandomdistribution ?= false
bool usecaterpillars ?= false
float minimummultiplier ?= 0
float jumpautofixscaler ?= 1
bool sideview ?= false
bool degreyatlandingzone ?= false
float launchtrickmultiplier ?= 1
bool autofinishgamepadjumps ?= true
bool autofinishmousejumps ?= true
float puzzlematchmultiplier ?= 1
float stealthscoremultiplier ?= 1
float secondstoblockjumpsafterlanding ?= 0
bool easytraffic ?= false
string jumpmode ?= "wake" or "none" or "ramps" or "button" or "auto"
float minimumjump_airtime ?= 0.9
float minimumjump_height ?= 3.5
float startingscore ?= 0
float pointspergrey ?= 0
float pointspercolor ?= 0
float matchcollectionseconds = 1.5
int minmatchsize ?= 3
string greyaction ?= ("eraseone" / "erasesingle" / "eraseblock") or "normal" or ("clog" / "stuck" / "permanent") or "erasecolumn" or ("erasegrid" / "eraseall")
float[] trickdurations ?= {1,2,3,5}
float[] trickpoints ?= {400,1000,3000,10000}
float playerminspeed ?= 0.1
float playermaxspeed ?= 2.9
float minimumbestjumptime ?= 2.5
float uphilltiltscaler ?= 0.8
float downhilltiltscaler ?= 1.55
float uphilltiltsmoother ?= 0.03
float downhilltiltsmoother ?= 0.06
bool useadvancedsteepalgorithm ?= true
bool alldownhill ?= false
bool railedblockscanbegrey ?= false
float trafficcompression ?= 0.65
float watercompression ?= 0.45
bool autocenter ?= false
float maxstrafe ?= -- this is directly assigned to many internal settings, which each have different defaults (maxStrafe 15, maxStrafeJump 9, maxStrafeMouse 2.2, maxStrafeMouseJump 2.2, nonMouseMaxStrafe 15, nonMouseMaxStrafeJump 9)
bool usesnowboardphysics ?= false
int freqtrafficbins = 0 -- numbers greater than 256 are treated as 256
vector3 pos = {0,0,0}
rotation rot = {0,0,0}
vector3 scale = {0,0,0}
Takes any lua object/table, converts it to a string, and outputs it to "Audiosurf2_Data\output_log.txt".
This print is different from the print(string)
in skin scripts. (it's better)
returned table:
int matchedcellscount
table[][] cells {{{ -- outer array iterates horizontally and inner arrays iterate vertically
int type -- "color ID"
bool matched
int matchsize
bool[] matchcols
}, ...}, ...}
float maxair
float maxAir -- same thing
float jumpairtime
table pos {
float x
float y
float z
}
float seconds
table color {
float r
float g
float b
float a
}
-- the following rotation values are in degrees. they are the node's absolute rotation not delta
float pan -- rotation around the y axis
float tilt -- x
float roll -- z
vector3 rot -- same as {tilt, pan, roll}
float intensity -- normalized
bool funkyrot -- if this is in a corkscrew or loop
float antiairtime -- "anti jump seconds"
float trafficstrength
float antitrafficstrength
Identical to skins' BatchRenderEveryFrame{}
but includes an extra setting:
string uniqueName = nil
string prefabName -- mandatory
int[] locations -- mandatory
vector3[] offsets = nil
bool rotateWithTrack = true
int maxShown = 50
int maxDistanceShown = 1000
string uniqueName -- mandatory. matches a name in BatchRenderEveryFrame{}
int[] hideLocations = nil
int[] showLocations = nil
An instance hidden in this manner still counts toward the maxShown
limit.
The vector3 is a combination of both styles. (vector3[1]
and vector3.x
are equivalent)
string prefabName = "AvatarBot" -- can be "vehicle" or the name of an object
-- if prefabName == "vehicle"
float attachToTrackWithNodeOffset = 0
-- else
float attachToTrackWithNodeOffset = nil
bool inheritAttachedRotation = true -- only used if attachToTrackWithNodeOffset is set
-- end
transform2 transform = nil
string name = "clonename1" -- auto increments
one of the 3 below tables
string command = nil or "ChangeShaderColors" or "SetTransform" or "Blink" or "ChangeTrackNodeOffset"
string name -- must be set to a string. this is the name of a clone
table param -- must be set to a table
shadercolors
transform2
table
:
int numBlinks = 5
float duration = 2
table
:
float offset ?= ?
string command = nil
string name -- must be set to a string. this is the name of a clone
Invokes Unity's GameObject.BroadcastMessage on the specified clone with null arguments, where command is the name of the method to call. I'm not quite sure what all this can actually do. I can't see how the vehicle is constructed in the place I'm looking so I don't know what children it has.
Known commands:
string command = nil
Sends a generic message to AS2's message system. It uses this internally a lot so you can probably break something with some of these commands:
AboutToLoadGameplayScene
AdvancingPastLobby
BeforeBuildHighway
BlockAddedToPuzzle
ClearScoreMultiplier
ClearScoreMultiplier
ControllerDisconnected
EndCleanup
FinishedScoringLandingPoints
GameplayEnd
GameplayModeSet
GameplayStart
GameplayStart_LateOne
GameplayStart_EarlyOne
HoverUp -- causes the hovering vehicle to bounce up a bit
IntroFlyinComplete
JumpNow
LobbyClose
ModeChanged
OverrideColorsNow
PlayerCrashLanded
PlayerFailedToJump
PlayerHitGrey
PlayerLanded
PlayerMissedRamp
PuzzleCollectingMatches
PuzzleOverfill
PuzzleOverfillWarning
RequestFinalScoring
ResolutionChanged
SkinChanged
SkinCodeAboutToRun
SkinFileComplete
SongEnded
SongStartedPlaying
TrickSafeFailed
TricksUnlocked
TriedToLaunchMultiplayerWithNoFollowers
TutorialChallengeComplete
UnlockedElite
UpdatedTrackColors
WakeboarderCrossedOptimalJumpSpot
table mouse {
float x
float y
bool LMB
bool RMB
bool MMB
float wheel
}
table keyboard { -- all the entries in this table are either true or nil. lua "if" treats nil like false
bool anykey -- a key is pressed. it might be a key that this table doesn't have an entry for
bool nokeys -- if this is true then it is guaranteed to be the only entry in this table
bool a b c d e f g h i j k l m n o p q r s r u v w x y z uparrow downarrow leftarrow rightarrow semicolon comma period 1 2 3 4 5 6 7 8 9 0 space
}
table[4] players {{
float Horizontal
float Vertical
float Horizontal2
float Vertical2
bool button1
bool button2
bool button3
bool button4
table mouse -- the contents are identical to the main mouse table
}, ...}
string name = "nameless"
int score = 0
string displayScore = nil
int score = 0
bool showdelta = true
string soundType = "none" or "grunt"
string avatar = "AvatarMcFly" or "AvatarIphoneLady" or "AvatarBear" or "AvatarRobot"
For types other than grunt
, this is identical to PlaySound{name=soundType}
.
input table or launchNode can be nil to use the current node
int launchNode = nil
float trackoffset ?= ?
table[] newblocks ?= ? or {{
int type = 0
float collision_strafe = 0
int puzzle_col = 0
bool add_top = false
}, ...}
table[][] cells ?= ? or {{{
int type = -1
}, ...}, ...}
table timing ?= ? or {
float matchtimer ?= ?
float matchtimerthreshold ?= 1.5
float collectnow_usingmultiplier = nil
}
Takes no parameters and returns nothing. Hides the surfer, vehicle, and rooster set by the skin.
vector3 pos = nil
-- if pos is set
vector3 rot = {0,0,0}
string/float railoffset = nil or "detached"
-- else
table nearcam ?= ? or { -- if nil, none of the values will be altered
vector3 pos = {0,0,0}
vector3 rot = {0,0,0}
float strafiness = 0
}
table farcam ?= ? or { -- if nil, none of the values will be altered
vector3 pos = {0,0,0}
vector3 rot = {0,0,0}
float strafiness = 0
}
-- end
Numbers less than 1 will be treated as 1.
bool * ?= nil
double * ?= nil
string * ?= nil
{*=*} * ?= nil -- Keys and values can be a mixture of bool, double, and string. A nil key will cause an exception to be thrown.
Sets the values the skin will see when calling GetSkinProperties()
. Please read the GetSkinProperties
documentation for the full details.
colorcount
is a reserved property name and it will always be silently overwritten with current GameplaySettings{colorcount}
setting.
string name
float volume = 1
float pitch = 1
float loopseconds = 0
If the sound does not exist, no sound will play and an error will be logged.
Identical to skins' LoadSounds{}
.
Same as skins' GetQualityLevel()
float secondsvisible = 0
color color = {195,195,195,255}
string text = ""
Takes no parameters and returns nothing.
int index
string powerupname ?= ?
int type ?= ?
vector3 v3offset ?= ?
Skins override this if they supply as many or more colors than you.
Colors are {r=0-1, g=0-1, b=0-1, a=0-1}
format.
Identical to skins' CreateObject{}
Identical to skins' SetBlocks{}