Scripting: Difference between revisions
No edit summary |
No edit summary |
||
Line 117: | Line 117: | ||
{{HeaderNoTOC|Stop turning}} | {{HeaderNoTOC|Stop turning}} | ||
<code>tn</code> to stop turning. | <code>tn</code> to stop turning. | ||
==Looking== | ==Looking== | ||
Line 166: | Line 144: | ||
{{HeaderNoTOC|Stop looking}} | {{HeaderNoTOC|Stop looking}} | ||
<code>lk</code> to stop looking. | <code>lk</code> to stop looking. | ||
==Equipment== | |||
<code>eq</code> or <code>equip</code> lets you equip, unequip, and use equipment. | |||
{{HeaderNoTOC|Equip item}} | |||
You can equip your fishing rod by simply <code>eq fishingpole</code> if you have the fishing rod. | |||
Check the [[#Equipment List]] below for things you can equip. | |||
{{HeaderNoTOC|Use item}} | |||
You can use your fishing rod by simply <code>eq fishingpole use</code>. | |||
Check the [[#Equipment List]] below for things to use. | |||
{{HeaderNoTOC|Unequip item}} | |||
You can unequip your item by simply using <code>eq</code>. | |||
{{HeaderNoTOC|Equipment list}} | |||
A list of a few valid items to equip or use: | |||
<nowiki> | |||
watergun, fishingpole, waterbucket, glowstick, stickynote, spraycan, slingshot, shovelknife, catchnet, foodbowl, phone, planner</nowiki> | |||
Most items are required to be in your pack before you can use them. Exceptions are phone and planner as they kind of just always exist. | |||
==Facial Expression== | ==Facial Expression== |
Revision as of 09:55, 11 May 2023
Scripting is a way for characters to behave in-game. You can even script yourself!
Introduction
Scripting. What is it, anyways? Well, think of a movie script - you read it from top to bottom to check what you have to do or say next. In this case, the character script (which I call Action Script) directs what characters do and behave, including you. So if you script yourself, your character can start doing stuff by themselves without your control. A script is actually quite simple, it's just a text file that you write in the in-game script editor.
Every character has two scripts - a "life script" and an "interaction script".
- A life script runs automatically at random, so basically, it makes your character have a life on its own. It's used to make them automatically do stuff, like walking around, sitting down, think for themselves and generally act like an NPC.
- An interaction script is the script that does stuff in response to interaction, so when you (or someone else) walk up to an NPC (or you) and click, the interaction script will be shown.
Script files are divided in to options, basically sub-sections of both life and interaction scripts. Options are important - neither life script or interaction script will execute if you don't have options. You specify options by beginning a line with "=" and typing the title after. In interaction scripts, writing "= Hello" makes others see a button "Hello" when interacting with you, and executes the script under that option when they click it. In life scripts, writing "= random 10" tells the automated life script to execute that part of the script 10% of the time, so essentially a random choice.
SPC Mode
By default, the interaction/life scripts won't bother you as you play (you have to explicitly run the options through the "Run" button in the script editor). If someone wants to interact with you, you can approve that one interaction request by clicking on them and clicking "Answer".
However, there is a way to auto-accept any request and run your loaded scripts automatically - I name this SPC mode (SPC being Scripted Playable Character). You can enable it by pressing Alt+V. By enabling SPC mode, your interaction script auto-accepts any interaction, and your life script starts living out by itself, letting the game pick options based on the "= random" title.
Example
= Say Hello tn t + Hello there. lk left lk right lk l - I'll tell you a secret. + What? - I have a snail in my pocket.
Here's a short interaction script example. It presents and option to interact ("say hello"). Let's say that you wrote this script and put it on your character. If a player clicks on this option when interacting with you, it starts this script. Both players turn to each others, exchange dialog, and the script player (you) look to the left, right, then continues the dialog. As you can see, it's very easy to make a simple conversation. But there's way more than that! You can make your character walk around, animate, do facial expression... and such.
See the first word/symbol that starts on each line? It's the command - this determines what you want the character to do. After that command, you type in parameters to specify what exactly you want it to do. Let's have a look of all the commands you can do.
Script commands
Movement
mv
or move
is one of the most important movement commands. There is various ways to get a character to move.
mv forward mv left mv back mv right
You can also specify how many steps you want a character to take. mv forward 5 will move 5 steps forward.
mv to sera_hammock
Tip: To get the name of an object you wish to move to middle click it twice while having the script text cursor at the place you want the name to be pasted into your code.
mv to sera_hammock 3
Move up to 3 meters next to sera's hammock.
It also accepts decimals such a 0.5 meters.
Tip: To get the name of an object you wish to move to middle click it twice while having the script text cursor at the place you want the name to be pasted into your code.
You can move to an exact spot in the world using coordinates.
mv to -38.35 1.77 41.12
Tip: To get the coordinates you can right click the life script as you are working on it and hit paste coordinates. It'll paste the current coordinates you are standing on. This is very helpful.
mv
to stop moving.
Interaction
in
or interact
is a command used to interact with objects.
Interacting with objects is fairly reasonable.
in sera_hammock
You can also interact with an object that has multiple interaction options.
in kitchen_chair 2
Tip: To get the correct interaction of an object you wish to interact with middle click the interaction you wish to choose twice while having the script text cursor at the place you want the interaction to be pasted into your code.
Turning
turn
or tn
is a command used to turn your character.
tn north tn west tn east tn south
tn to sera_hammock
Tip: To get the name of an object you wish to turn to middle click it twice while having the script text cursor at the place you want the name to be pasted into your code.
You can turn to an exact spot in the world using coordinates.
tn to -38.35 1.77 41.12
Tip: To get the coordinates you can right click the life script as you are working on it and hit paste coordinates. It'll paste the current coordinates you are standing on. This is very helpful.
tn
to stop turning.
Looking
lk
or look
is a command used to turn your head to look at something.
lk north lk west lk east lk south
lk to sera_hammock
Tip: To get the name of an object you wish to look at middle click it twice while having the script text cursor at the place you want the name to be pasted into your code.
You can look at an exact spot in the world using coordinates.
lk to -38.35 1.77 41.12
Tip: To get the coordinates you can right click the life script as you are working on it and hit paste coordinates. It'll paste the current coordinates you are standing on. This is very helpful.
lk
to stop looking.
Equipment
eq
or equip
lets you equip, unequip, and use equipment.
You can equip your fishing rod by simply eq fishingpole
if you have the fishing rod.
Check the #Equipment List below for things you can equip.
You can use your fishing rod by simply eq fishingpole use
.
Check the #Equipment List below for things to use.
You can unequip your item by simply using eq
.
A list of a few valid items to equip or use:
watergun, fishingpole, waterbucket, glowstick, stickynote, spraycan, slingshot, shovelknife, catchnet, foodbowl, phone, planner
Most items are required to be in your pack before you can use them. Exceptions are phone and planner as they kind of just always exist.
Facial Expression
fc
or face
lets you make a facial expression.
fc happy
for a happy expression.
fc sad
for a sad expression.
fc close
to close your eyes.
fc tongue
to put your tongue out.
fc angry
for an angry expression.
fc fear
for a fearful expression.
fc happy 3
will be happy for 3 seconds.
fc
to stop facial expressions.
Play Animation
an
or animate
to play an animation.
an yes
will play an animation where you nod your head yes.
an dance 3
will play the dance animation 3 times.
an dance -1
will play the dance animation forever.
an bow 3 0.5
plays the bow animation for 3 seconds, however, it starts the animation from the middle instead of the beginning.
Social Animations:
yes, no, shrug, clap, bow, yawn, wave
Emotive Animations:
admire, giggle, angry, sada, scared, rave
Other Animations:
poke, pose, think, type
Duo Animations:
hug
Standing & Sitting & Laying Animations:
groundstand, groundstand2, groundstand3, groundsit, groundsit2, groundlay, groundsleep
an