Difference between revisions of "Lua Functions List"

Jump to navigation Jump to search
1,408 bytes added ,  07:00, 20 June 2021
m
m (Added ToggleMuteMusic(), SetOutfit( number ))
Line 4: Line 4:
;ActivateTriggerByName( triggerName )
;ActivateTriggerByName( triggerName )
:Activates a trigger already included in TriggerInstances.lua for the current level, using that trigger's ObjectName.
:Activates a trigger already included in TriggerInstances.lua for the current level, using that trigger's ObjectName.


;CONFIG = ...
;CONFIG = ...
:Changes the global variable CONFIG which shows what sort of build the game is. "Valid" options appear to be <code>Gold, PublicBeta, Demo, Production, and Debug.</code> Using anything other than Gold/PublicBeta/Demo will turn on DebugPrint which outputs some debug info to stdout.txt . Using Production or Debug might allow some scripts to work that are otherwise unusable, hasn't been fully explored.
:Changes the global variable CONFIG which shows what sort of build the game is. "Valid" options appear to be <code>Gold, PublicBeta, Demo, Production, and Debug.</code> Using anything other than Gold/PublicBeta/Demo will turn on DebugPrint which outputs some debug info to stdout.txt . Using Production or Debug might allow some scripts to work that are otherwise unusable, hasn't been fully explored.


;DumpClassInfos(c)
;DumpClassInfos(c)
:A basic customized function included in StartLua.lua, which shows what is included in classes/other objects that Lua can access, printed to ClassInfo.txt in Journey root folder. Good for finding functions/variables/etc that aren't defined in the .lua's.  
:A basic customized function included in StartLua.lua, which shows what is included in classes/other objects that Lua can access, printed to ClassInfo.txt in Journey root folder. Good for finding functions/variables/etc that aren't defined in the .lua's.  
:(For "c", use _G to see everything at the top level, then use the name of almost anything marked as a table to see inside of it, and to see inside deeper use TopTable.TableInside.TableDeeperInside.Etc .)
:(For "c", use _G to see everything at the top level, then use the name of almost anything marked as a table to see inside of it, and to see inside deeper use TopTable.TableInside.TableDeeperInside.Etc .)


;DumpMetaSys()
;DumpMetaSys()
:Creates TempMetasystem.lua in Journey root folder, which shows "A table of all non-abstract classes registered with the meta system". This file is useful to see all the possible triggers (will have metadata GardenerType = "Trigger") and the variables you can set for those triggers (it shows ObjectName, activityId, and lightbarId in all of them but these are not required to be set).
:Creates TempMetasystem.lua in Journey root folder, which shows "A table of all non-abstract classes registered with the meta system". This file is useful to see all the possible triggers (will have metadata GardenerType = "Trigger") and the variables you can set for those triggers (it shows ObjectName, activityId, and lightbarId in all of them but these are not required to be set).
:(The function that the game defines in Tick.lua will crash your game; the default StartLua.lua modifies it to work the same and not crash)
:(The function that the game defines in Tick.lua will crash your game; the default StartLua.lua modifies it to work the same and not crash)
 
 
;<nowiki>game:cameraSystem():StartDebugCam()</nowiki>
 
;<nowiki>game:cameraSystem():StopDebugCam()</nowiki>
;<nowiki>game:cameraSystem():StartDebugCam() & game:cameraSystem():StopDebugCam()</nowiki>
:Start/stop the debug camera, which detaches from your character and can be rapidly moved all over the level. Press fly button/key to teleport your character in front of the camera. If debugHud is on, it will show the debug cam coordinates and other info.
:Start/stop the debug camera, which detaches from your character and can be rapidly moved all over the level. Press fly button/key to teleport your character in front of the camera. If debugHud is on, it will show the debug cam coordinates and other info.


;<nowiki>game:debugHud():CycleMode()</nowiki>
;<nowiki>game:debugHud():CycleMode()</nowiki>
:Displays a HUD showing information about connection, cameras, trigger timelines, and memory use(?); cycles through three different levels of detail.
:Displays a HUD showing information about connection, cameras, trigger timelines, and memory use(?); cycles through three different levels of detail.
;<nowiki>game:input():GetPad(0):Right() & game:input():GetPad(0):Left();</nowiki>
: Returns an array[1-2] with numbers between 1 to -1 depending on joystick position.
::[1] is left/right axis
::[2] is up/down axis
;<nowiki>game:input():GetPad(0):WasButtonPressed( number );</nowiki>
:Returns true when specified action button is pressed. (keyboard or controller) You cannot be in main menu or sitting down to trigger Fly and possibly other buttons.
:More values may exist, needs testing.
::12 = Fly button
::13 = Chirp button
::19 = Pause button
::20 = Menu button


;<nowiki>game:netGui():ToggleEnabled()</nowiki>
;<nowiki>game:netGui():ToggleEnabled()</nowiki>
:Turns on the NetGui HUD, which shows other players in the same "lobby" for the current level and lets you try to manually connect to them (might only be able to show up to 4, even if there are others you can connect to), or shows your current companion. You can move up/down in this menu with W/S, and select something by running game:netGui():ExecuteSelectedItem(game). It seems you still need to be nearby a player and have the same lobby flags triggered to connect to them, or at least to stay connected.
:Turns on the NetGui HUD, which shows other players in the same "lobby" for the current level and lets you try to manually connect to them (might only be able to show up to 4, even if there are others you can connect to), or shows your current companion.
::You can move up/down in this menu with W/S, and select something by running '''game:netGui():ExecuteSelectedItem(game)'''. It seems you still need to be nearby a player and have the same lobby flags triggered to connect to them, or at least to stay connected.
::Before you can reconnect to another player after leaving them, the wayfarer on their screen must first dust, which could take up to 30 seconds.
 
 
;<nowiki>game:netGui():SelectNextItem() & game:netGui():SelectPreviousItem()</nowiki>
:Can be used to move up and down NetGui without using W/S keys.
<u>Lua code to move NetGui using Right Joystick up/down</u>
local rightJoystick = game:input():GetPad(0):Right()
if (rightJoystick[2] == 1) then
    game:netGui():SelectNextItem()
elseif (rightJoystick[2] == -1) then
    game:netGui():SelectPreviousItem()
end
 


;<nowiki>game:playerBarn():GetLocalDude():SetOutfit( number )</nowiki>
;<nowiki>game:playerBarn():GetLocalDude():SetOutfit( number )</nowiki>
Line 30: Line 66:
::0, 1, 2, 3 are red robe tiers 1, 2, 3, 4
::0, 1, 2, 3 are red robe tiers 1, 2, 3, 4
::4, 5, 6 are white robe tiers 2, 3, 4
::4, 5, 6 are white robe tiers 2, 3, 4


;<nowiki>game:playerBarn():GetLocalDude()/GetRemoteDude():GetAnimBarn():QueueAnimation( animName, blendIn, blendOut, animSpeed, numLoops, duration )</nowiki>
;<nowiki>game:playerBarn():GetLocalDude()/GetRemoteDude():GetAnimBarn():QueueAnimation( animName, blendIn, blendOut, animSpeed, numLoops, duration )</nowiki>
:Can play any animation defined in animDatas table in DudeAnimation.lua , but it seems to only be visible in your own game. LocalDude is you, RemoteDude is your companion(might only work while they are hijacked by "Nick"). :Documentation from DudeAnimation.lua: "blendIn, blendOut, and duration are in seconds. to use duration, set numLoops = 0, otherwise it will be ignored. you can set numLoops < 0 to fit a certain number of complete loops in a duration. you can set duration to be a negative number if you want it to keep playing until you stop it."
:Can play any animation defined in animDatas table in DudeAnimation.lua , but it seems to only be visible in your own game. LocalDude is you, RemoteDude is your companion(might only work while they are hijacked by "Nick"). :Documentation from DudeAnimation.lua: "blendIn, blendOut, and duration are in seconds. to use duration, set numLoops = 0, otherwise it will be ignored. you can set numLoops < 0 to fit a certain number of complete loops in a duration. you can set duration to be a negative number if you want it to keep playing until you stop it."


;<nowiki>game:soundBarn():ToggleMuteMusic()</nowiki>
;<nowiki>game:soundBarn():ToggleMuteMusic()</nowiki>
:Toggles game music ON / OFF
:Toggles game music ON / OFF


;SpawnEvent{ triggertype = { var1 = a, var2 = b, etc } }
;SpawnEvent{ triggertype = { var1 = a, var2 = b, etc } }
Line 45: Line 84:
::<code>SpawnEvent { PlayDudeAnim = { animName = "Name of an animation sequence defined in DudeAnimation.lua", clearAnimQueue = true, useLocal = true}}</code>
::<code>SpawnEvent { PlayDudeAnim = { animName = "Name of an animation sequence defined in DudeAnimation.lua", clearAnimQueue = true, useLocal = true}}</code>
::(plays that animation for your character, and your companion will also be able to see it. Do useLocal=false to play animations on your companion if they are currently hijacked by "Nick")
::(plays that animation for your character, and your companion will also be able to see it. Do useLocal=false to play animations on your companion if they are currently hijacked by "Nick")
;<nowiki>SpawnEvent{ SetMaxCloth = { changeAmount = number } }</nowiki>
:Changes wayfarer cape length using any positive or negative number. You can reach max/zero length by changing amount by +/- 30, but cannot go past past the regular cape limit using this function.


;ToggleDMActive(game)
;ToggleDMActive(game)
:Toggles "Rocket Death Match" mode on and off. Chirp to shoot rockets, press fly button/key rapidly to jump. Your companion can't see your rockets/explosions/craters/etc, but they do see you moving around strangely due to the third-person-shooter controls and jumping instead of flying.
:Toggles "Rocket Death Match" mode on and off. Chirp to shoot rockets, press fly button/key rapidly to jump. Your companion can't see your rockets/explosions/craters/etc, but they do see you moving around strangely due to the third-person-shooter controls and jumping instead of flying.


;Vars.DudeAnimation.kDebugConsoleEnabled(true)
;Vars.DudeAnimation.kDebugConsoleEnabled(true)
:Toggles a debug HUD with information about player animations being used.
:Toggles a debug HUD with information about player animations being used.


;Vars.Game.cheatsEnabled(true)
;Vars.Game.cheatsEnabled(true)
:Needed for NetGui HUD to be turned on, and possibly other unknown things. Is reset to "false" when game loads so you must use lua script to set it to "true".
:Needed for NetGui HUD to be turned on, and possibly other unknown things. Is reset to "false" when game loads so you must use lua script to set it to "true".
 
 
 
;Vars.Lobby.kUseAutoLobby(true/false)
;Vars.Lobby.kUseAutoLobby(true/false)
:Turns on/off the AutoLobby system, which is what does matchmaking. Turning off is useful to avoid meeting a random player while trying to connect to someone specific using NetGui, or for playing solo without bothering with firewall/internet connection. If AutoLobby is off, your name can't show up in NetGui for someone else unless you select "Host Game" in NetGui.
:Turns on/off the AutoLobby system, which is what does matchmaking. Turning off is useful to avoid meeting a random player while trying to connect to someone specific using NetGui, or for playing solo without bothering with firewall/internet connection. If AutoLobby is off, your name can't show up in NetGui for someone else unless you select "Host Game" in NetGui.
 
 
 
;Vars.SoundBarn.kEnableDebugHud(true/false)
;Vars.SoundBarn.kEnableDebugHud(true/false)
:Toggles a debug HUD with information about sounds being used.
:Toggles a debug HUD with information about sounds being used.
 
 
 
;Vars.table.setting(value)
;Vars.table.setting(value)
:Changes settings controlled by Vars.lua. You can also just change the values in Journey.exe itself, but this script is good for changing things while playing, and also some things will be changed by the game when it loads and you must use this script to actually make the game do what you want.
:Changes settings controlled by Vars.lua. You can also just change the values in Journey.exe itself, but this script is good for changing things while playing, and also some things will be changed by the game when it loads and you must use this script to actually make the game do what you want.
:(See Vars.lua in Data/Scripts for possible settings: use a table/category name for "table", the specific setting name within that category for "option", and the desired value for "value".)
:(See Vars.lua in Data/Scripts for possible settings: use a table/category name for "table", the specific setting name within that category for "option", and the desired value for "value".)

Navigation menu