Anda di halaman 1dari 12

How to Use This API

Note that anything that is underlined is variable, meaning that it


requires you to replace it with your own data.
Ex:
<playchanSOUND:STRINGCHANNEL:INT>
SOUND:STRING will be replaced with the name of your sound in
Stencyl. The word following the colon indicates the type of
variable it expects.
CHANNEL:INT will be replaced with the sound channel you
would like to play the sound on. Since the word following the
colon is INT, it expects an integer.
To learn more about the types of variables, see the bottom of this
document.

Dialog Options
<choice [[OPTION_TEXT:STRING
DIALOG_CHUNK_ID:STRING CONDITION:BOOL] ...]>
Display a list of options for the player to choose from.
Ex: Where would you like to go today?
<choice[
["ThePool""PoolPart1"]
["Mars""SpaceCenter"<getattr[game"Space
Unlocked"]>]
["BackHome"Home]
]>

("The Pool", "Mars", and "Back Home" options are listed out for
the player, and they lead to dialog chunks name "Pool Part 1",
"Space Center", and "Home" respectively. However, the "Mars"
option is only shown if the associated game attribute, "Space
Unlocked", is true.)

Extra Glyphs
<glyph IMAGE:STRING>
Includes an image in your dialog, inline with the text.
Ex: I love you!! <glyphheart>
(Displays the image "heart.png" from the extras folder after the
text)

Character Scripts
<showname NAME:STRING>
Displays a character name + namebox
Ex: <shownameLenny>
(Display the name Lenny in a namebox)
<hidename>
Removes the namebox.

<face IMAGE:STRING>
Display a character face/portrait.
Ex: <faceLenny>
(This actually depends on the preference you have set for this
extension. Assuming faceImagePrefix="Face", this would
show image "Face Lenny.png" from your extras folder)
Ex 2: <facenone>
(Removes the face graphic)

Flow Scripts
<waitattr [ATTR VALUE:ANY]>
Dialog will wait for some attribute to reach a value before
proceeding.
Ex: <waitattr["game""CutsceneOngoing"false]>
(Will wait until the game attribute, "Cutscene Ongoing", becomes
false before continuing with the dialog.)
(You can refer to the bottom of this document for info on potential
values for ATTR.)

<wait TIME:FLOAT>
Inserts a pause into the dialog.
Ex: <wait.5>
(Dialog will be paused for half a second before continuing.)

<but>
Shows a pointed and waits for user input.
Ex: Oh, hello!<but> My name is Chuck.<but> And what's
yours??<but>
(The player has to press the continue button, set in this
extensions prefs, in order to continue the dialog at the three
<but> points. Careful, this example is probably overkill as far as
causing stops in the dialog.)

<bc>
Like <but> but when dialog continues, the dialog box is
automatically cleared.

Logic
<if CONDITION:BOOL>
<elseif CONDITION:BOOL>
<else>
<endif>
Control what's seen and what isn't. Personalize messages, or
give the player valuable info based on his current status in the
game.
Ex: <if<getattr[game"Dragon1Defeated
Again"]>>We'll be forever in your debt, hero! Allow me to give

you a special discount...


<elseif<getattr[game"Dragon1Defeated"]>>The
legends say that the dragon will come back with a vengeance for
he who sealed him... I hope it's just hearsay.
<else>Business is sure good with the dragon around, warying
the townsfolk, but I have to keep an eye on my stock, make sure
it doesn't steal anything.
<endif><dg"GeneralShop">
(From the place you enter an <if> tag, it can be followed by
multiple <elseif> tags and then a single <else> tag if
desired.)
(Eventually, it has to be followed by and <endif> tag so that the
dialog system knows where to resume normal dialog.)

Messaging Scripts
<setattr [ATTR VALUE:ANY]>
Sets an attribute.
Ex: <setattr[actorPlayer"HealthBehavior"
_health100]>

<getattr [ATTR]>
This tag is primarily intended for use WITHIN other tags, if you
want to refer to some value that can't be expressed normally in
this dialog editor.
Ex: <setattr[actorPlayer"TargetBehavior"

_currentTarget<getattr[game"Boss2"]>]>
(Yeah, I really don't know where I'm going with these examples.
But let's break that one down a little, shall we?)
(<setattr[actorPlayer"TargetBehavior"
_currentTarget...]>)
(There we have a setattr tag. Pretty basic, okay. But what if we
were trying to set, for example an Actor Attribute?)
(So, we have an Actor Attribute stored in the game attribute
"Boss 2", so let's use that to fill in the ... area we left blank)
(<setattr[actorPlayer"TargetBehavior"
_currentTarget...<getattr[game"Boss
2"]>...]>)

<showattr [ATTR]>
This takes the text representation of some attribute and inserts it
into this position in the dialog.
Ex: WOW! YOU'VE SAVED UP <showattr[game
Rupees]> RUPEES!! AWESOME!
(...I guess that's supposed to be a Majora's Mask banker
reference?)

<messagescene BEHAVIOR_NAME:STRING
MESSAGE:STRING [ARG:ANY ...]>
Sends a message to a scene behavior attached to the current
scene.

<messageactor ACTOR_NAME:STRING
BEHAVIOR_NAME:STRING MESSAGE:STRING
[ARG:ANY ...]>
Sends a message to an actor.

Skip Scripts
<skip>
This enables the ability to skip text by holding the text skipping
buttons if it was previously disabled.

<noskip>
Disables ability to skip through text. Maybe use it for a cutscene
when timing of the dialog is crucial.

Sound Scripts
<playsound SOUND:STRING>
Plays a sound.
Ex: <playsound"Howl"><wait.1>! ? ! <wait .5> Did you
hear that??<but>

<loopsound SOUND:STRING>
Loops a sound. Like above, but can be used for ambient BG
sounds or music.

<stopsound>
Stops currently playing sounds.

<playchan SOUND:STRING CHANNEL:INT>


Plays sound on a specific channel.

<loopchan SOUND:STRING CHANNEL:INT>


Loops sound on a specific channel.

<stopchan CHANNEL:INT>
Stops sounds on a specific channel.

Dialog Base
<clear>

Clears the content of the dialog box. Typing begins again at the
top left corner.

<close>
Closes the dialog box, but doesn't remove it completely, so you
can use it again without adding the dialog box back into the
Dialog system.

<end>
Closes Dialog Box and removes it from Dialog System.

<dg DIALOG_CHUNK_ID:STRING>
Opens up another Dialog Chunk.
Ex: <dgShop>
(Opens up a dialog chunk named #Shop in dialog.txt)

Text Effects
<shake>
</shake>
Begin and end the text vibration effect.

<sine>
</sine>
Begin and end the text sinewave effect.

<rotate>
</rotate>
Begin and end the text revolve effect.

<grow>
</grow>
Begin and end the text grow effect.

Typing Scripts
<font FONT:STRING>
Change the Font used to type dialog. These Fonts are NOT the
Fonts in your Stencyl Dashboard. They are the ones defined in
extras/fonts.txt.

<color COLOR>
Change the color of the font. -1 for default font color, or

hexadecimal color code, such as (#ff0000) or (0xff0000) for pure


red.

<typespeed SPEED:FLOAT>
Change the type speed of the dialog. 0.1 would case a character
to be typed ever 10th of a second.

<typesound SOUND:STRING>
or
<typesound [SOUND:STRING ...]>
Change the sound that plays when a character is typed, or set it
to "none" for no sound.
Using the second tag, you can provide a list of sounds, one of
which will be played at random when a character is typed.

Tag Parameter Reference


Text is normally enclosed in quotes, but if you only have one
word, its okay to omit the quotes.
Ex: soup, soup, and good soup each count as their own
strings, but good soup would count as two separate strings.
ATTR:
"game" gameAttributeName:STRING
"scenebhv" behaviorName:STRING attributeName:STRING

"actorbhv" ACTOR behaviorName:STRING


attributeName:STRING
"actor" ACTOR actorValueName:STRING
(The following option is available only for the "Messaging Scripts"
extension)
"dialog" attrName:STRING
A list is a pair of brackets with comma-separated values.
[Value1, Value2, Value3, [Value4, Is, A, List]]
ACTOR: Name of Actor using the Actor Identifier. To name an
actor, use the following code from anywhere:
"GlobalActorID.set("Name of Actor", _actorAttribute);"
FONT: Name of Font resource in Stencyl or "none" for default
COLOR: Hexadecimal Int (0xffffff) or (#ffffff) or -1 for default
SOUND: Name of Sound resource in Stencyl or "none"
STRING: Text
FLOAT: Floating point number, such as .1
INT: Integer number.
DIALOG_CHUNK_ID: ID of Dialog (following the # in dialog file)
ANY: Can be a string, number, bool, or list.
IMAGE: Name of .png image (minus ".png" extension) stored in
extras folder, or "none" for default.

Anda mungkin juga menyukai