Command Categories

crossexam
files
objects
text
interface/case_menu
evidence
interface
gameflow
animation
music
logic
debug
effect
sounds






Commands

Category: crossexam

clearcross

Clears all cross exam related variables. A good idea to call this after a testimony is officially over, to ensure that 'resumes' don't mistakenly go back to the cross exam, and prevent other bugs from occuring.



cross label fail=VALUE

NameDescriptionDefault value
labellabel the cross exam so that you can 'goto label' later to start from the top
faillabel to jump to if no label is defined for an action, when pressing or presenting"none"

Begin a cross examination. You may tag this cross examination, such as 'cross testimony1' which will allow you to jump to the beginning of the testimony again with 'goto testimony1'. Aftter the 'cross' line, you will have a series of 'statement's which define each line of text that the witness says which make up the testimony. When statements are finished, you will have the line 'endcross' which signifies that responses for player action during the testimony, in the form of 'label's, will follow.

General layout of a cross examination:

cross [label]
statement [statement tag]
[text]
statement [statement tag]
[text]
statement [statement tag]
endcross

[defense and helper discussing about difficuly] goto [label]

[label for user action] [text] resume

[label for another user action] [text] resume

[label for successful user action (probably a present)] [text] goto continue

label none [general text for a bad present] resume

label continue [rest of game]


See
statement for more info on hiding and revealing statements. Also, endcross. resume has a special use for cross examinations, in that it will jump back to the next statement the user was on, after handling logic outside of cross/endcross. It is better to use 'resume' than 'goto top' or 'goto [label]', which will restart the cross examination from the beginning. It's especially useful to use 'resume' in the 'fail' case, because you won't know where the player came from.



cross_restart

Go to the first line in the current cross examination



endcross

End the current cross examination section. Usually followed by labels for responding to user action. See cross and statement for more info on cross examinations.



next_statement

Go to the next statement, usually not needed (the user is usually in control of navigating statements)



prev_statement

Go to the previous statement, usually not needed (the user is usually in control of navigating statements)



statement [tag] test=VALUE

NameDescriptionDefault value
tagName the statement so you can match up user action results with it
testName of a variable. Only show this statement if that variable is true.all statements shown by default

Must be between 'cross' and 'endcross'. Defines a specific statement within a witness testimony for cross examination. Usually followed by a line of text spoken by the witness. The 'tag' will be refered to by labels which follow the 'endcross' of this cross examination (although it is also possible to put the response label immediately following the line of text).

label press [tag] - PyWright will jump to a label that looks like this if the user "presses" this statement

label [evidence_tag] [tag] - PyWright will jump to this label when the user presents this evidence to this statement

If no matching label is found, PyWright will jump to the value of 'fail=' given to '
cross'.



Category: files

exportvars filename (variable_names)

NameDescriptionDefault value
filenamefile to export variables into, relative to the case folder
variable_namesThe names of variables to export. If none are listed, all variables will be exportedall variables

Saves the name and value of listed variables to a file. They can later be restored. Can be used to make ad-hoc saving systems, be a way to store achievements separate from saved games, or other uses.



filewrite filename [text]

NameDescriptionDefault value
filenamefile to write to
texttext to write

Writes text to the end of the specified file. Text is immediately flushed, files written to in this way do not need to be explicitly "saved". Use " " for carriage return in the file, " " for tab characters. 'filename' cannot contain spaces or be located earlier than the current game on the path.

See
fileclear and fileseek for other file commands.



importvars filename

NameDescriptionDefault value
filenamefile to import variables from, relative to the case folder

Restores previously exported variables from the file.



loadgame filename hide

NameDescriptionDefault value
filenameSaved game to load, relative to case folder. Saved games may not be named 'hide'save
hideIf hide token is included, the interface wont inform the user of the load.

Restores a save file.



savegame filename hide

NameDescriptionDefault value
filenameFile to save to, relative to case folder. Saved games may not be named 'hide'save
hideIf hide token is included, the interface wont inform the user of the save.

Creates a new saved game in the case folder.



screenshot path width=VALUE height=VALUE x=VALUE y=VALUE rwidth=VALUE rheight=VALUE

NameDescriptionDefault value
pathpath, relative to game's directory, to save the screenshot, including file extension (.png or .jpg)
widthshrink screenshot to this width256
heightshrink screenshot to this height192
xx-value of region to screenshot0
yy-value of region to screenshot0
rwidthwidth of region to screenshot256
rheightheight of region to screenshot192

Takes a screenshot and saves the image. Can select a specific region of the screen to snapshot. Useful for custom interfaces, or just providing a snapshot feature.



Category: objects

bemo emotion name

NameDescriptionDefault value
emotionBlinking emotion animation to set character to
nameObject name of character to change blinking emotion ofChooses currently speaking character (value of _speaking)

Sets a current char object to a specific blinking emotion animation.



bg bg_path x=VALUE y=VALUE z=VALUE loops=VALUE flipx name=VALUE rotz=VALUE stack fade wait

NameDescriptionDefault value
bg_pathPath to the graphics file relative to case/art/bg and without extension; such as scene1 for games/mygame/mycase/art/bg/scene1.png and scene1.txt
xset the x value0
yset the y value0
zset the z value (check PyWright/core/sorting.txt for idea of z values)sorting.txt lists default bg z values
loopsalter the loops of the bg animation
flipxMirror the image on the x axis
nameGives the bg a unique name to be used for other commandsDefault name will be the bg path
rotzrotate the object on the z axis0
stackThe scene won't be cleared when the background is loaded
fadeBackground will fade in instead of popping in
waitWait until animation is finished to continue

Creates a background object. If 'stack' is not included, the scene will be cleared before the background is loaded. Backgrounds also default to a lower z value than other objects, ensuring that they will be in the background (though this can be modified). Other than that, backgrounds have the same properties as other graphic objects, and may be animated or manipulated.



char character_name nametag=VALUE e=VALUE be=VALUE x=VALUE y=VALUE z=VALUE name=VALUE pri=VALUE fade stack hide noauto

NameDescriptionDefault value
character_nameName of character folder in art/port. If the character is to be hidden, the character_name doesn't need to match up to any actual directory. Graphics will be loaded from that directory according to the visible emotion
nametagThe name to actually display to the player as this character's name.character_name
eThe character's starting emotionnormal
beThe emotion to use while character is in the blink pose
xset the x valuedefault x places character in the center of the screen
yset the y valuedefault y places the bottom of the character graphic at the bottom of the screen
zset the z value (check PyWright/core/sorting.txt for idea of z values)sorting.txt lists default char z values
nameGives the object a unique name to be used for other commandsDefault name will be character_name
priAlter the default priority of the character animationsorting.txt lists default pri values
fadeCharacter will fade in instead of popping in
stackDon't delete other characters before adding this oneAll other characters are deleted
hideDon't actually show the character, just set who is talking
noautoJust play the animation, don't let textboxes set talk/blink modes or do lip syncing.

Create a character object, and set that object as the currently speaking character. (The variable _speaking_name contains the object name of the currently speaking character). Character's in pywright refer to a folder containing various animations belonging to the character. This "emotion" can be set with the e= keyword on the char command, as well as modified during text. Textboxes also will control the animation of the currently speaking character to make the mouth movements match the speed the text is printing.

There are several variables which further control properties of characters. All characters will, by default, use the sound effect "blipmale.ogg" as the sound the text makes as it prints out, which is the male voice. If the character's name is located under the female section in core/blipsounds.txt, the default sound used will instead be "blipfemale.ogg". The sound can be changed on a text by text basis, with "{soundnewsound.ogg}The text sound has now been changed", but this can get tedious.

A new default sound, based on the characters id name (the name used for their art folder, and used by the char command as in 'char name') can be set. The syntax is 'set char_defsound_[name] [sound file]', where [name] is the name you will use, and [sound file] is the filename relative to the sfx/ folder to play for the text blip sound.

The default blip for characters who aren't predefined in this way can be changed from blipmale.ogg to something else by setting the variable 'char_defsound': 'set char_defsound [sound file]'

The best place to set these variables is in a separate file included in intro.txt, so that the settings will remain throughout the game.



clear

Clears all objects from the scene.



delete name=VALUE suppress

NameDescriptionDefault value
nameUnique name of object to delete.
suppressDon't show error message even if object cannot be found to delete

Deletes the named object from the scene. (Any time you give an object a name, such as 'ev bloody_knife name=bk' you can use this command to delete it later, such as 'delete name=bk'.



emo emotion name

NameDescriptionDefault value
emotionEmotion animation to set character to
nameObject name of character to change emotion ofChooses currently speaking character (value of _speaking)

Sets a current char object to a specific emotion animation.



ev evidencekey x=VALUE y=VALUE z=VALUE loops=VALUE flipx name=VALUE rotz=VALUE fade

NameDescriptionDefault value
evidencekeyEvidence id key. PyWright will look at the 'evidencekey_pic' variable to determine what graphic file to load
xset the x value0
yset the y value0
zset the z value (check PyWright/core/sorting.txt for idea of z values)sorting.txt lists default ev z values
loopsalter the loops of the animation
flipxMirror the image on the x axis
nameGives the object a unique name to be used for other commandsDefault name will be the evidence key
rotzrotate the object on the z axis0
fadeObject will fade in instead of popping in

Creates a graphic for an evidence key. The graphic is based on whatever you set for that specific evidence key. You can easily add an item to the court record and then display the same item on screen. Example:

set housekey_pic key1
set housekey_name House Key
set housekey_desc The key to the victim's house
addev housekey
ev housekey
"House key added to court record"



fg fg_path x=VALUE y=VALUE z=VALUE loops=VALUE flipx name=VALUE rotz=VALUE nowait fade

NameDescriptionDefault value
fg_pathPath to the graphics file relative to case/art/fg and without extension; such as fence for games/mygame/mycase/art/fg/fence.png and fence.txt
xset the x value0
yset the y value0
zset the z value (check PyWright/core/sorting.txt for idea of z values)sorting.txt lists default fg z values
loopsalter the loops of the fg animation
flipxMirror the image on the x axis
nameGives the fg object a unique name to be used for other commandsDefault name will be the fg path
rotzrotate the object on the z axis0
nowaitContinue game execution without waiting for foreground animation to finish.
fadeObject will fade in instead of popping in

Creates a foreground object. These are just like any other object, except the default z value will place them in front of most of the objects in the scene.



obj graphic_path x=VALUE y=VALUE z=VALUE loops=VALUE flipx name=VALUE rotz=VALUE fade

NameDescriptionDefault value
graphic_pathPath to the graphics file relative to case/art and without extension; such as bg/scene1 for games/mygame/mycase/art/bg/scene1.png and scene1.txt
xset the x value0
yset the y value0
zset the z value (check PyWright/core/sorting.txt for idea of z values)sorting.txt lists default object z values
loopsalter the loops of the object animation
flipxMirror the image on the x axis
nameGives the object a unique name to be used for other commandsDefault name will be the graphic path
rotzrotate the object on the z axis0
fadeObject will fade in instead of popping in

Creates a generic graphics object and places it in the scene. It will be drawn on a layer according to it's z value. graphics objects may or may not be animated, which is defined in metadata files stored along with the graphics. ball.png will have a ball.txt describing it's animation qualities, if it has any.



penalty change_amount variable=VALUE threat=VALUE delay=VALUE

NameDescriptionDefault value
change_amountAmount of health to change, either adding, subtracting, or setting the health, while animating the change on the barBy default there will be no change
variablethe health variable to use"penalty"
threatAmount of health to threaten the player with losing (flashes this portion of the bar)0
delayHow long to delay the script before deleting the bar and continuing. A value of 0 means no delay and the bar will stay onscreen until deleted.Default is 50 if the value is changing, and 0 if the value is not

Display a health bar, and if change_amount is given, show the player that they are losing health, and subtract the health. If change_amount starts with a minus sign, the amount will be subtracted from the current health value. If it starts with a plus sign, the amount will be added to the current health value. With no minus or plus sign, it will SET the health value to this amount, but still animate the change. At your game's checkpoints, you will probably want "penalty 100", which will show the healthbar filling up to that amount.

Without change_amount, you are just showing the player their current health, and optionally threatening them with an amount they may lose if they make the wrong choice.

There is support for multiple health variables, if you were to have a multiple character game, or maybe you want to keep score and have a new health bar in each case. The 'variable' keyword allows you to choose which health bar the penalty command is referring to.

Since it just uses variables, you can also change the health bar values behind the scenes without showing the penalty bar at all, by just using the normal variable commands. The default penalty variable is 'penalty'.



Category: text

nt [nametag]

NameDescriptionDefault value
nametagText to set for the next nametagIf no text is given, the next nametag will be invisible

Sets or clears the next nametag. Must be called immediately before the textbox it alters. Other commands like "char" or "set _speaking" which alter the nametag may conflict with this command.



textblock x y width height color=VALUE name=VALUE [text]

NameDescriptionDefault value
xx value to place text
yy value to place text
widthwidth of text block
heightheight of text block (determines rows but the value is in pixels)
colorcolor of the text
nameid of textblock object for later reference
texttext to display

Displays a block of text all at once on the screen somewhere. Used to create custom interfaces. The text doesn't support markup in the same way that textboxes do.



textbox [text]

NameDescriptionDefault value
textText to be print in the textbox, with markup.

Draws a several line animated textbox to the screen. Uses art/general/textbox_2 as the back drop. The letters of the textbox will print one by one at a set rate, which can be modified with the markup commands. If there is a character speaking (the _speaking variable is set, a char command has just been issued, etc) then the character will animate as the text is output. The game script will pause until the player (or the textbox via markup) tells the game to continue. This command can also be issued by having a blank line surrounded by quotes. Ex:

char test
textbox This is some text that is printing
#The same text could be printed this way:
char test
"This is some text that is printing."



Category: interface/case_menu

casemenu pri=VALUE

NameDescriptionDefault value
priWhat priority to update the case menuDefault casemenu priority listed in core/sorting.txt

Shows the phoenix wright styled case selection menu, allowing players to navigate available cases in a game folder and choose one to play. The priority might need to be adjusted if you have any special animation going on, but don't modify it unless you know you need it. This command should be the last command run from an intro.txt placed in a game's folder. PyWright will also run the case menu by default if there is NO intro.txt in a game's folder. Single case games may opt to have the "case" folder and "game" folder be the same, and not show a case menu at all.



locked_cases

Call in a game folder level intro.txt to set up locked cases for that game.



addcase case_name

NameDescriptionDefault value
case_namecase folder name to add to the menu

Adds a case to the next menu slot. After calling {locked_cases}, call {addcase [case]} for each case that should be on the menu when they are all unlocked.



wincase

Sets the currently played case as beaten, so that when the case menu comes up again, the next case will be added to the menu. Call {wincase} somewhere in the ending sequence of the case, near the point at which it runs out of code and launches back into the case menu.



resetcase

Sets currently played case as no longer beaten.



Category: evidence

addev tag page

NameDescriptionDefault value
tagName of evidence to add to the court record
pageWhich page to add evidence toDefault is to add to the evidence page, unless the tag ends with a '$' in which case it will add to profiles

Adds evidence to the court record based on an evidence 'tag'. The various properties of the evidence should be stored in variables based on this tag:

set [tag]_name: the name displayed to the player on court record screen for this item, defaults to the tag itself

set [tag]_pic: the image to use, should be in game/case/art/ev, or game/art/ev, defaults to the tag ([tag].png in art/ev)

set [tag]_desc: the long description of the evidence, shown on zoomed court record view, defaults to blank

set [tag]_check: name of a script to run if item is checked by player



delev tag

NameDescriptionDefault value
tagname of evidence to delete from court record

Delete an item from the court record.



Category: interface

examine fail=VALUE

NameDescriptionDefault value
faillabel to jump to when a specific evidence label is not found.none

Displays the examine cursor to allow the player to choose a spot on the screen, and jump to different labels based on the spot. Immediately following the examine command, you must use region commands to define where the player can click.



examine3d

Turn 3d examinations on



gui type macro var_name x=VALUE y=VALUE z=VALUE width=VALUE name=VALUE graphic=VALUE hold password try_bottom run=VALUE [text]

NameDescriptionDefault value
typetype of gui to create. (Back, Button, Input, or Wait)
macroFirst argument after Button is the name of the macro to run when the button is pressed, valid for (Button)
var_nameVariable name to save input text into, valid for (Input)
xx position of created item, valid for (Back, Button, Input)
yy position of created item, valid for (Back, Button, Input)
zz position of created item, valid for (Back, Button, Input)
widthpixel width of input box, valid for (Input)
nameid to give object for later reference, valid for (Back, Button, Input)
graphicpath to graphic file, valid for (Button)default for buttons is to have an outline with the text of the button label
holdhold means that the macro will repeatedly execute as long as the button is held down, valid for (Button)default is that it only executes with each distinct click
passwordtyped text will be displayed with stars *****, valid for (Input)default is to show text
try_bottomTry to keep object in bottom screen, but if no bottom screen exists move it up, valid for (Button)
runrepeatedly execute this macro, valid for (Wait)default is no macro will be run
textremaining text will display for Button if there is no graphic, valid for (Button)default is no text

This complex command is used to build custom interfaces and behavior into your game. If you don't understand it you probably don't need to use it, but if you are doing something that isn't quite standard you will probably need this command at one time or another. The four types of gui you can create are:

* Button - This creates a button that can be clicked. When clicked a macro will run. * Back - This is a specialized button which displays the PyWright back button. The game will halt until the back button is pressed, making it pretty easy to create a custom screen for evidence * Input - this will show an input box allowing the player to input text. This text will be saved into a variable which you define. * Wait - this command will pause the script and optionally execute a macro each frame



li [option] result=VALUE

NameDescriptionDefault value
optiontext to display, and if 'result' not given, label to jump to if option is selected
resultspecifically named label to jump to if this option is chosen

Add an item to the current list. When clicked, PyWright will go to a label either matching the option text, or matching the value of 'result' if that was given. Must be used between 'list' and 'showlist' commands.



list tag noback

NameDescriptionDefault value
tagTag this list with some name so PyWright can keep track of which list options the player has tried alreadyDefault is to name the list based on what script it's found in and on what line
nobackNo back button will be displayed if this token is included

Start building a list of options to present the player. By default, each list will be unique. If you have a list appear in multiple parts of the code, but they are meant to appear to the player as the same list, make sure they have the same tag. Also, the tag you give will do double duty, as you can use 'goto [tag]' to jump straight to the list without any other labels. If noback is included, then no back button will be displayed, forcing the player to choose an option. You may not use "noback" as the tag. To actually build the list requires a series of 'li' commands, and then displaying the list will require the command 'showlist'. Upon choosing an option, PyWright will try to jump to a label matching the text of the option. Example below, more info under 'li' and 'showlist'.

"What is your favorite food?"

list faveorite_food li hamburger li HAMBURGER li hamburger? showlist

label hamburger "Wow you like hamburgers too?" exit

label HAMBURGER "Gee, you don't have to be so grumpy about it." exit

label hamburger? "Yes, that is correct. Don't be timid." exit



localmenu examine=VALUE talk=VALUE present=VALUE move=VALUE fail=VALUE

NameDescriptionDefault value
examinewhether to show the examine buttonfalse
talkwhether to show the talk buttonfalse
presentwhether to show the present buttonfalse
movewhether to show the move buttonfalse
faillabel to jump to if the label for an action was not foundnone

Show an investigation menu of options. Should be run after the background of a scene is loaded. When an option is clicked, PyWright will jump to the label of the action, such as "label examine" or "label talk". You can control which options are shown through the keywords described.



menu scene_name examine=VALUE talk=VALUE present=VALUE move=VALUE

NameDescriptionDefault value
scene_nameMenu scene name. Scripts for each action should be named 'scene_name.examine.txt', 'scene_name.talk.txt', 'scene_name.present.txt', and 'scene_name.move.txt'
examinewhether to show the examine buttontrue
talkwhether to show the talk buttontrue
presentwhether to show the present buttontrue
movewhether to show the move buttontrue

Show an investigation menu of options. Should be run after the background of a scene is loaded. When an option is clicked, a separate script will be run for that action, as determined by the value of scene_name. When that external script is finished, the game won't return to this spot automatically, so you will need to be sure you can create the proper menu from the external screen as well. People usually do this by creating a script [scene_name].txt which loads the background and shows the menu. Then, any external script can instantly load the proper scene with "script [scene_name]". You can control which options are shown through the keywords described.



present fail=VALUE noback

NameDescriptionDefault value
faillabel to jump to when a specific evidence label is not found.none
nobackDon't show back button

Displays the court record and allows the player to present evidence. After the presentation, will jump to the label named after the selected evidence tag. If a label for the chosen evidence is not found, will either jump to 'label none', or the value of 'fail'. To disable showing the back button, use the 'noback' token

        #add some evidence
        addev sillyputty
        addev redherring

#show present screen present fail=badpresent

#back was pressed "So you don't want to present anything at all?" goto next

#silly putty was presented label sillyputty "That's just what I needed." goto next

#Something else was presented label badpresent "I don't care about that."

label next #show present with no back button present fail=badpresent noback "the code will never get here" label sillyputty "good I needed that" "by the way, I saw you couldn't press the back button" goto next label badpresent "I don't care about that." label next



region3d x y width height label

NameDescriptionDefault value
xx value of rectangular region on the texture
yy value of rectangular region on the texture
widthwidth of rectangular region on texture
heightheight of rectangular region on texture
labellabel to jump to when region is clicked

Creates a clickable region on a 3d object by binding a rectangular region of the object's texture to a wrightscript label event. Applies to current 3d object if there is one.



showlist

Finish building a list and display it to the user, waiting for the user to choose a list option before script resumes. Must follow 'list' and a series of 'li' commands.



Category: gameflow

endscript

Ends the currently running script and pops it off the stack. Multiple scripts may be running in PyWright, in which case the next script on the stack will resume running.



exit

Deletes the currently running scene/script from execution. If there are any scenes underneath, they will resume.



forgetlist tag

NameDescriptionDefault value
taglist tag to forget

Clears the memory of which options player has chosen from a specific list. Normally, chosen options from a list will be shown with a checkmark to remind the player which options they have tried, and which ones are new. You can make all the options for a list not show checkmarks by clearing the memory.



forgetlistitem tag [option]

NameDescriptionDefault value
taglist to forget item from
optionoption from list to forget state of

Forget checkmark status of a specific option from a specific list.



game game script

NameDescriptionDefault value
gamePath to game. Should be from the root, i.e. games/mygame or games/mygame/mycase
scriptScript to look for in the game folder to run firstintro

Can be used to start a new game or case.



script script_name label=VALUE noclear stack

NameDescriptionDefault value
script_namename of the new script to load. Will look for 'script_name.script.txt', 'script_name.txt', or simple 'script_name', in the current case folder.
labelA label in the loading script to jump to after it loads.Execution starts at the top of the script instead of a label
noclearIf this token is present, all the objects that exist will carry over into the new script.Otherwise, the scene will be cleared.
stackPuts the new script on top of the current script, instead of replacing it. When the new script exits, the current script will resume following this "script" command.The new script will replace the current script.

Stops or pauses execution of the current script and loads a new script. If the token stack is included, then the current script will resume when the new script exits, otherwise, the current script will vanish.



timer ticks command

NameDescriptionDefault value
ticksHow many ticks (1/60 of a second) before the command will be run
commandThe name of a macro to be run after the timer runs out

Schedule a macro to be executed after a certain amount of time. The rest of the game will proceed normally until the timer fires it's macro. Depending on what the macro does, the game may switch to a new mode or resume after the macro has completed.



waitenter

The script will pause until the user presses the enter key. Ok for demos but not recommended for real games, as it won't be obvious to users that they must press enter. gui Button or showing a normal textbox is preferred.



Category: animation

controlanim name=VALUE start=VALUE end=VALUE jumpto=VALUE pause=VALUE loop noloop b t

NameDescriptionDefault value
nameNamed object to controlWill alter animation of all current objects - not recommended to use the default value.
startAlter the starting frame of the animationLeave starting frame what it was.
endAlter ending frame of the animationLeave ending frame what it was.
jumptoInstantly set an animations frame to this valueDon't change frames
pausePause animation
loopForce animation to loop
noloopForce animation not to loop
bAlter blink animation of chars
tAlter talk animation of chars

Alter the animation settings for a currently playing animated object. Normally you will use the settings that come with the animation in the form of a .txt file next to the graphic file. Occasionally you may wish to play an animation differently, such as having a non looping animation play several times, or only playing a portion of a longer animation.



globaldelay speed name=VALUE b t

NameDescriptionDefault value
speedThe speed to set the selected animation to - this is the number of display frames to wait before showing the next animation frame.
nameOnly change the animation speed of objects with the given nameChange animation speed of all objects (if you want to mimic fastforward or slowdown you want to leave name= off)
bSelect blinking animation for char objects
tSelect talking animation for char objects

Changes the default delay value for either all running animations or specific ones. First create the animation with a char, bg, fg, etc command, then call globaldelay to adjust the rate the animation will play. Use b or t to choose blinking or talking animations if used with char. Normally, you will use the delay values stored with the animations themselves, in the .txt files that go alongside the graphics. However, sometimes you may wish something to happen faster or slower.



pause ticks all script priority=VALUE

NameDescriptionDefault value
ticksHow many ticks (1/60 of a second) to wait
allPause EVERYTHINGdefault behavior pauses script execution but lets animation continue
scriptPause only the scriptthis is the default behavior
priorityFine tune what gets paused and what doesnt.10000 (such a high number for priority means that most objects will not be paused

This command will pause execution of various things. It's main use is to pause the script to let an animation finish before continuing.



Category: music

mus [filename]

NameDescriptionDefault value
filenameFilename of song, searches game/case/music, game/music, and PyWright/musicIf no path is listed, music will stop

Stops currently playing music file, and if 'filename' is given, starts playing a new one. If you want to queue up a song to play when the current song is finished, used for situations where you want an intro to a looping track, run this code anytime after the mus command:

set _music_loop track_name
.

Songs can be .ogg, .mod, .it, .mid, .xm, .s3m, or uncompressed .wav



Category: logic

addvar variable amount

NameDescriptionDefault value
variablevariable to save to
amountamount to add to the variable

Adds an amount to a variable. If the variable 'x' were set to 4, the script:

addvar x 1
would set 'x' to 5.



delflag flag_name

NameDescriptionDefault value
flag_nameflag to unset

Deletes a flag. Flags will remain set for the remainder of the game, but can be forgotten with delflag.



divvar variable amount

NameDescriptionDefault value
variablevariable to save to
amountamount to divide the variable by

Divide a variable by a number. If the variable 'x' were set to 10, the script:

divvar x 2
would set 'x' to 5.



flag [flag_expression] <? OR label > fail=VALUE

NameDescriptionDefault value
flag_expressionlist of flag names joined with AND or OR
?
labellabel to jump to if the evaluation is true
faillabel to jump to if evaluation is falsenone

Evaluates an expression with flag names. If the expression is true, jumps to the listed label. Otherwise, will jump to the fail keyword if that was given. If the line ends with a '?', it will execute the next line and the next line only when the flag expression is true.



gamemenu [destination] fail=VALUE

NameDescriptionDefault value
destinationThe destination label to move to
failA label to jump to if the destination can't be found

Can be used to list games in a folder



getprop variable name=VALUE prop=VALUE

NameDescriptionDefault value
variableThe variable to save the value into
nameThe object to get the property from
propThe property to get from the object

Copies the value of some property of an object into a variable



getvar variable [source variable]

NameDescriptionDefault value
variableThe variable to save the value into
source variableThe variable to get the value from. Can use $x to use another variable to point to which variable to copy from, like a signpost.

Copies the value of one variable into another.



goto [destination] fail=VALUE

NameDescriptionDefault value
destinationThe destination label to move to
failA label to jump to if the destination can't be found

Makes the script go to a different section, based on the label name.



is [expression] fail=VALUE <label OR ? >

NameDescriptionDefault value
expression
faillabel to jump to if expression fails
label
?

Evaluates the expression. If the expression is true, will either jump to 'label' or execute the next line if a '?' is used instead of a label name. If 'fail=' is given, will jump to that label when the expression is false.

Expressions are very simplistic, supporting only AND and OR for operations, and numbers/text or $variables for operands.



is_ex [expression2] <label OR ? > fail=VALUE

NameDescriptionDefault value
expression2
label
?
faillabel to jump to if expression fails

Evaluates the expression. If the expression is true, will either jump to 'label' or execute the next line if a '?' is used instead of a label name. If 'fail=' is given, will jump to that label when the expression is false.

Expressions are modelled after ace attorney online, and support () - + / * == < > <= >= AND and OR for operations, and var1 (variables), 'blah' (text) or 239 (numbers) for values. Functions are not supported, use pywright operations to manipulate variables before using the variable in an expression.



isempty variable <label OR ? >

NameDescriptionDefault value
variableVariable to check if it doesn't exist
labela label to jump to if the variable has not been set or is blank
?execute next line only if variable is unset or blank

If the variable has not been set (it is equal to "") then either jump to the given label or execute the next line if the given label is a '?'.



isnot [expression] fail=VALUE <label OR ? >

NameDescriptionDefault value
expressionAn expression that evaluates to true or false
faillabel to jump to if expression fails
labela label to jump to if the expression evaluates to false
?execute next line only if expression evaluates to false

If the expression is false, will jump to the success label. Otherwise, it will either continue to the next line, or jump to the label set by the fail keyword

Expressions are very simplistic, supporting only AND and OR for operations, and numbers/text or $variables for operands.



isnotempty variable <label OR ? >

NameDescriptionDefault value
variableVariable to check if it exists
labela label to jump to if the variable has been set and is not blank
?execute next line only if variable is set and not blank

If the variable has been set (it is not equal to "") then either jump to the given label or execute the next line if the given label is a '?'.



isnumber variable <label OR ? >

NameDescriptionDefault value
variableVariable to check if it exists
labela label to jump to if the variable has been set and is not blank
?execute next line only if variable is set and not blank

If the variable contains a number jump to the given label or execute the next line if the given label is a '?'



joinvar variable [words]

NameDescriptionDefault value
variablevariable to save value to
wordswords to join together

Takes a series of words and joins them together, save the joined string to a variable. For instance:

setvar hour 3
setvar minute 15
joinvar time $hour : $minute
"{$time}"
will output "3:15"



label [label text]

NameDescriptionDefault value
label textThe name of this section of code

Used to mark a spot in a wrightscript file. Other code can then refer to this spot, specifically for making the code reader "goto" this spot.



mulvar variable amount

NameDescriptionDefault value
variablevariable to save to
amountamount to multiply the variable by

Multiply a variable by a number. If the variable 'x' were set to 5, the script:

mulvar x 3
would set 'x' to 15.



noflag [flag_expression] <? OR label > fail=VALUE

NameDescriptionDefault value
flag_expressionlist of flag names joined with AND or OR
?
labellabel to jump to if the evaluation is true
faillabel to jump to if evaluation is falsenone

Evaluates an expression with flag names. If the expression is not true, jumps to the listed label. Otherwise, will jump to the fail keyword if that was given. If the line ends with a '?', it will execute the next line and the next line only when the flag expression is false.



random variable start end

NameDescriptionDefault value
variablevariable name to save random value to
startsmallest number to generate
endlargest number to generate

Generates a random integer with a minimum value of START, a maximum value of END, and stores that value to VARIABLE



resume

Returns to the next line after a jump. Also, in cross examinations, will return the the proper statement.

Example:

"This is just a test. Jumping elsewhere in the code..."
        goto test
        "And now we are back."

label test "Here we have jumped, but now we go back..." resume


This will print:
        "This is just a test. Jumping elsewhere in the code..."
        "Here we have jumped, but now we go back..."
        "And now we are back."



setvar variable [value]

NameDescriptionDefault value
variablevariable name to set
valueText to assign to the variable. Can include $x to replace words of the text with the value of other variables.

Sets a variable to some value.



setvar_ex variable [expression2]

NameDescriptionDefault value
variablevariable name to set
expression2The results of the expression will be stored in the variable.

Sets a variable to some value based on an expression



setflag flag_name

NameDescriptionDefault value
flag_nameflag to set

Sets a flag. Shorthand for setting a variable equal to true. Flags will remain set for the remainder of the game, and can be used to track what a player has done.



setprop variable name=VALUE prop=VALUE

NameDescriptionDefault value
variableThe variable to save the value into
nameThe object to get the property from
propThe property to get from the object

Copies the value of a variable to some property of an object



setvar variable [value]

NameDescriptionDefault value
variablevariable name to set
valueText to assign to the variable. Can include $x to replace words of the text with the value of other variables.

Sets a variable to some value.



setvar_ex variable [expression2]

NameDescriptionDefault value
variablevariable name to set
expression2The results of the expression will be stored in the variable.

Sets a variable to some value based on an expression



subvar variable amount

NameDescriptionDefault value
variablevariable to subtract from and save to
amountamount to subtract from the variable

Subtract an amount from a variable. If the variable 'x' were set to 33, the script:

subvar x 3
would set 'x' to 30.



top

Jumps to the top of the currently running script.



Category: debug

debug <true OR false >

NameDescriptionDefault value
trueturns on debug mode
falseturns off debug mode

Used to turn debug mode on or off. Debug mode will print more errors to the screen, and allow you to skip through any text.



print [text]

NameDescriptionDefault value
textSome text to print

Prints some text to the logfile. Only useful for debugging purposes.



step

Begins stepping each line of code. Only works in debug mode.



Category: effect

fade start=VALUE end=VALUE speed=VALUE name=VALUE nowait

NameDescriptionDefault value
startWhat fade level to start at0
endWhat fade level to end at100
speedHow many fade steps per frame1
nameName a specific object to fadeWill try to fade all objects
nowaitContinue script while fade happensThe script will pause until fade is finished

Fade an object or objects in or out



grey value=VALUE name=VALUE

NameDescriptionDefault value
valueWhether an object should be greyscale or not: 1=greyscale 0=not1
nameName a specific object to set to greyscaleWill try to greyscale all objects

Makes an object display in greyscale.



invert value=VALUE name=VALUE

NameDescriptionDefault value
valueWhether an object should be inverted or not: 1=inverted 0=not1
nameName a specific object to tintWill try to tint all objects

Invert the colors of an object.



rotate degrees=VALUE speed=VALUE axis=VALUE name=VALUE nowait

NameDescriptionDefault value
degreesHow many degrees to rotate
speedHow many degrees to rotate per frame
axiswhich axis to rotate on, z is the only valid valuez
nameName a specific object to rotateWill try to rotate all objects (not what you might expect)
nowaitContinue script while rotation happensThe script will pause until rotation is finished

Begins an object rotation animation. Will wait for rotation to finish unless 'nowait' is included.



scroll name=VALUE filter=VALUE x=VALUE y=VALUE z=VALUE speed=VALUE last nowait

NameDescriptionDefault value
nameName of object to scrollscrolls everything
filterselect only objects on the 'top' screen or 'bottom' screen, leave blank for either'top'
xamount to scroll horizontally0
yamount to scroll vertically0
zamount to scroll into the screen, only really valid for mesh objects0
speedpixels per frame to scroll1
lastselect last added object as scroll target
nowaitcontinue script while scrolling

Scrolls the screen around, can also be used to move individual objects. Positive values for x will move objects LEFT (consider moving the viewpoint/camera RIGHT) and positive values for y will move objects UP (moving the viewpoint/camera DOWN) If the scroll amount does not divide evenly by the speed, it will still stop at the right place. (In older versions you needed to make sure the speed would divide evenly over the distance).



shake ttl offset nowait both

NameDescriptionDefault value
ttlTime for shake to last in frames30
offsetHow many pixels away to move the screen (how violent)15
nowaitContinue executing script during shake
bothShake affects both screens as a whole

Shake the screen for effect.



tint start=VALUE end=VALUE speed=VALUE name=VALUE nowait

NameDescriptionDefault value
startColor tint to start at'ffffff' or no tint (full color)
endColor tint to end at'000000' or full black tint
speedHow many color steps per frame1
nameName a specific object to tintWill try to tint all objects
nowaitContinue script while fade happensThe script will pause until fade is finished

Animate an object's tint from one color to another. You can make an object darker but not brighter. Tinting an object to red subtly can make a blush effect, tinting objects darker if there is a cloud overhead, or mixing tint with greyscale to make a sepia toned flashback scene are different ways this can be used.



zoom mag=VALUE frames=VALUE name=VALUE nowait last

NameDescriptionDefault value
magHow many times to magnify1 (will magnify 1 time, which is 2x magnification)
frameshow many frames for the zoom to take1
nameWhich object to magnifytries to magnify everything
nowaitcontinue script during magnification
lastChoose last added object as target

Causes a single object or all objects to be magnified. The value for 'mag' will be added to the current magnification value of an object, and it will take 'frames' frames to get to the new value. By default, all objects are at a magnification of 1. To shrink an object to half it's size for instance, you would use this command:

zoom mag=-0.5 frames=10
This will subtract half magnification from an object over 10 frames: 1x - 0.5x = 0.5x.



Category: sounds

sfx [filename] after=VALUE

NameDescriptionDefault value
filenameFilename of sound file, searches game/case/sfx, game/sfx, and PyWright/sfx
afterDelay sound for this many frames

Play a sound effect. If 'after' will play the sound after a certain number of frames (useful to time an effect with a specific frame of an animation).

Sound files can be .ogg or uncompressed .wav