Difference between revisions of "Lua Functions List"

Jump to navigation Jump to search
930 bytes added ,  15:07, 24 September 2021
→‎Functions: various extra info on already-listed functions
(→‎Functions: various extra info on already-listed functions)
Line 2: Line 2:
==Functions==
==Functions==


;ActivateTriggerByName( triggerName )
;ActivateTriggerByName( ObjectName )
:Activates a trigger already included in TriggerInstances.lua for the current level, using that trigger's ObjectName.
;Names["ObjectName"].Start()
:Activates a Trigger or Timeline which is loaded in the current level, using their ObjectName.




Line 21: Line 22:


;<nowiki>game:cameraSystem():StartDebugCam() & 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. Keyboard and controller have different types of movement control so it can be useful to use both.
:If you need to tilt the camera up/down, run <code>game:cameraSystem():GetDebugCam():SetAngleLock(true)</code> and use keyboard keys assigned to forward/back. Run same code but with (false) to go back to regular debugcam control scheme.




Line 49: Line 51:


;<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.
:(needs cheats enabled) 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.
::You can move up/down in this menu with whatever keys are assigned to move forward/back (default 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.
::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.


Line 67: Line 69:


;<nowiki>game:playerBarn():GetLocalDude():SetOutfit( number )</nowiki>
;<nowiki>game:playerBarn():GetLocalDude():SetOutfit( number )</nowiki>
:Can be run with any number 0-6
:Changes your robe tier/color based on the number. Change is visible to companion (but maybe sometimes is not?)
::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
::7 and above (and negative numbers?) also appear in-game as white robe tier 4, but that "outfit" value in memory does stay as whatever number you set (it isn't reset to 6), and that same value also appears in your companion's game's memory as the RemoteDude outfit value. This could be used as one way to remotely send info between modded games, if the mod can directly read memory values.




Line 86: Line 89:


;SpawnEvent{ triggertype = { var1 = a, var2 = b, etc } }
;SpawnEvent{ triggertype = { var1 = a, var2 = b, etc } }
:Makes an event happen as if a trigger from the level's TriggerInstances.lua had been triggered, you can do a very large amount of custom events this way.  
:Makes an event happen as if a trigger from the level's TriggerInstances.lua had been triggered, you can do a very large amount of custom events this way.
:(Use the name of a trigger's Type as seen in TriggerInstances.lua for "triggertype", and fill in the variables the same way TriggerInstances shows for that type of trigger. You can also generate and view TempMetasystem.lua to see all trigger types including some that are unused in the regular game, see below)
:(Use the name of a trigger's Type as seen in TriggerInstances.lua for "triggertype", and fill in the variables the same way TriggerInstances shows for that type of trigger. You can also generate and view TempMetasystem.lua to see all trigger types including some that are unused in the regular game, see below)
:(This function is defined in PWeb3.lua but will not work unless you define it yourself; the default StartLua.lua will do that for you)  
: (This function is defined in PWeb3.lua but will not work unless you define it yourself; the default StartLua.lua will do that for you)  
::Examples:  
:: Examples:
::<code>SpawnEvent { DisplayText = { text = "Text that shows up on your screen", x = 0, y = 0, duration = 3, fadeTime = 0.5, scale = 0.1 } }</code>
::<code>SpawnEvent { DisplayText = { text = "Text that shows up on your screen", x = 0, y = 0, duration = 3, fadeTime = 0.5, scale = 0.1 } }</code>
::<code>SpawnEvent { PlayDudeAnim = { animName = "Name of an animation sequence defined in DudeAnimation.lua", clearAnimQueue = true, useLocal = true}}</code>
::<code><nowiki>SpawnEvent { PlayDudeAnim = { animName = "Name of an animation sequence defined in DudeAnimation.lua", clearAnimQueue = true, useLocal = true}}</nowiki></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")


Line 99: Line 102:




;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, jumping really high, never truly flying, etc.




Line 111: Line 114:




;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.




Line 120: Line 123:


;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