Scripting: Difference between revisions

1,161 bytes added ,  15 May 2023
m
Added some more examples regarding life scripts.
m (Added information about how to make characters talk and chat messages appear.)
m (Added some more examples regarding life scripts.)
Line 20: Line 20:
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.
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 =
= Examples =
==Interaction Scripts==
  <nowiki>
  <nowiki>
= Say Hello
= Say Hello
Line 34: Line 35:
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.  
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.
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.
 
==Life Scripts==
Let's talk quickly about life scripts. Life scripts are scripts that you can trigger to just happen randomly. They make good idle scripts for your SPC as well as allow you to automatically do somewhat complex tasks without any interaction.
 
<nowiki>
= random 50
mv forward
mv back
= random 40
tn left
tn right
tn right
tn left</nowiki>
 
With this script the SPC has a 50 percent chance to move forwards and backwards and if that fails... your SPC have a 40% chance to look around. Random allows you to trigger those sections of the life script with a certain percentage chance. You can also do <code> = random 100</code> to ensure the code always runs. In the next example, lets look at a script that always runs.
 
<nowiki>
= random 100
eq
eq fishingpole
eq fishingpole use
. 60
eq fishingpole use</nowiki>
 
This fishing script will always run and repeat itself. There is a 100% chance you'll cast your fishingpole, wait 60 seconds, and unreel hoping to catch a fish. This is a great simple script for automatically catching fish. Be sure to hit alt + v and run your character in Scripted Player Character mode, as this will automatically repeat your life scripts.


= Script commands =
= Script commands =
62

edits