Sysval (TeaScript)

From PGE Wiki
Jump to navigation Jump to search


sysval is a function in TeaScript that allows you to read and write system variables.

To read the value of a sysval use:

sysval(name)

This will return the value of the sysval used. Note that name is not case-sensitive.


When using a sysval that is writable use:

sysval(name) = value

...to change the value of the sysval.

R: Read Only

W: Write Only

R&W: Read and Write

Name Type Description
NCount R The number of NPC objects in the level
BCount R The number of block object in the level
BGOCount R The number of BGO objects in the level
WCount R The number of warp objects in the level
LCount R The number of liquid objects in the level
ECount R The number of effect objects in the level
ActNCount R The number of active NPC objects in the screen
ActBCount R The number of active block objects in the screen
ScrSplitstyle R The status of the camera's split mainly used for 2 player mode. Older versions of 1.4.5 allowed for this to be modified.
  • 0: The camera is not split or 1 player mode is on
  • 1: Player 1 is on the top and player 2 is on the bottom
  • 2: Player 1 is on the bottom and player 2 is on the top
  • 3: Player 1 is on the left and player 2 is on the right
  • 4: Player 1 is on the right and player 2 is on the left
Player1scrX R The camera's top left X-scene coordinate of player 1
Player1scrY R The camera's top left Y-scene coordinate of player 1
Player2scrX R The camera's top left X-scene coordinate of player 2
Player2scrY R The camera's top left Y-scene coordinate of player 2
GameMode R The current game mode
  • 0: 1 player mode
  • 1: 2 player mode
  • 2: Battle mode
lvltimer R&W The current number in the level timer
Playerhealth R&W The current number of 1-Ups collected
CoinCount R&W The current number of coins collected
Score R&W The current score
BPlayer1Health R&W The current number of 1-ups for player 1 in battle mode
BPlayer2Health R&W The current number of 1-ups for player 2 in battle mode
Starcoincount R The current number of collected star coins
WldInvCount R The current number of items in the world map inventory
Coinsforextralife R&W The limit of coins the player can store. Minimum value is 1.
EnableLighting W Enables the lighting system if set to 1. Doing so automatically changes it to -1, interestingly.
Enablepause R&W Disables the player's ability to pause if set to 1.
Showhud R&W Hides the HUD if set to 1.
fluddrestorespeed R&W Determines how much your F.L.U.D.D. tank fills up by every second the player is in water. Default value is 200, which maxes out the tank capacity.
playerbasestatus R&W The starting status of the player given after losing a life.
grabshellinsmb3way ? Stands for if the player is able to grab shells while falling on one. (Does not work in 1.4.5, possible bug)
GameTime R The total amount of frames the level has been running.
Second R The seconds counter of the user's computer timer. This does not work with replays.
Minute R The minutes counter of the user's computer timer. This does not work with replays.
Hour R The hours counter of the user's computer timer in the 24-hour time format. This does not work with replays.
Day R The days counter of the user's computer calendar. This does not work with replays.
Month R The months counter of the user's computer calendar. This does not work with replays.
Year R The year counter of the user's computer calendar. This does not work with replays. (This also is used on the title screen for the copyright text.)
disableshelldash R&W Disables the player's ability to use the shell suit dash if set to 1.
disablehammershield R&W Disables the player's Hammer Suit shield when ducking if set to 1.
disablelinkshield R&W Disables Link's shield if set to 1.
disablelinksword R&W Disables Link's sword attack if set to 1. (Animations will still play)
disablejump R&W Disables the player's ability to jump if set to 1.
disablespinjump R&W Disables the player's ability to spin jump if set to 1.
disableduck R&W Disables the player's ability to crouch/duck if set to 1. (Penguin Suit sliding hitboxes are buggy, and Link's downward stab will also disabled.)
Disablesave R&W Disables the player's ability to save if set to 1.
Param1 R&W The first parameter transmitted when called. More info on param sysvals below.
Param2 R&W The second parameter transmitted when called. More info on param sysvals below.
Param3 R&W The third parameter transmitted when called. More info on param sysvals below.
invtimewhenhurt R&W How many frames the player's temporary invincibility lasts when taking damage/powering up. Default value is 150.
npcstyle R&W Unknown effect.
disablesharedfludd R&W If set to -1, each F.L.U.D.D. nozzle type will have separate water capacities.
disablesysconstreset R&W Unknown effect.
enablesmb3statussys R&W Enables the SMB3/Modern power-up system.
enableinertiafornpc R&W Unknown effect.
enablewalljump R&W Enables the wall jump ability.
shellcanhitblockside R&W Unknown effect.
yoshiflyable R&W Enables Yoshi's flutter jump.
spinjumpfloating R&W Enables the spin jump floating ability.
disablegrabtop R&W Disables the ability to grab NPCs from above regardless of NPC text code settings.
disablegrabside R&W Disables the ability to grab NPCs from the side regardless of NPC text code settings.
disableclimbing R&W Disables the ability to climb on climbable backgrounds.
disablepenguindash R&W Disables the ability to slide on belly when the player has a penguin suit.
gametitle W The game window's title bar as a string.
machinecode R Unknown effect.
syslang R The value of the computer's current language configuration. Values can be found here.
starcount R The total number of Stars collected.

This table below helps determine what value is transmitted from an object's script through the param sysvals.

Event Object param1 param2 param3
Death Block The ID of the source object that destroyed the block. How the object destroyed the block. The ID of the block that was destroyed.
Hit Block The ID of the NPC or player who hit the block. The ID of the block that was hit. If a player hit the block, this value is 1, and if an NPC hits the block, the value is set to -1. The absolute value is how the block was hit.
No More Objects In Layer Block The ID of the source object. How the object destroyed the block. Always returns 0.
On Screen Block The ID of the block. Always returns 0. Always returns 0.
Death NPC The ID of the NPC. The ID of the player who destroyed the NPC. Always returns 0.
Active NPC The ID of the NPC. Always returns 0. Returns 1 if the NPC was spawned from a generator.
Talk NPC The ID of the NPC. The ID of the player who initiated the talk event. Always returns 0.
Grab NPC The ID of the NPC. The ID of the player who grabbed the NPC. Returns 1 if the NPC was grabbed from above.
No More Objects In Layer NPC The ID of the NPC. Always returns 0. Always returns 0.
Next Frame NPC The ID of the NPC. Always returns 0. Always returns 0.
Touch NPC The ID of the NPC. The ID of the player who touched the NPC. The value returned depends on which side of the NPC was touched.

0 = wasn't touched

1 = touched from above

2 = touched from below

3 = touched from the left side

4 - touched from the right side

Enter Warp The ID of the player who triggered the event. The ID of the warp that was used. Always returns 0.