Scripting: Difference between revisions

no edit summary
(Additional info about movement/interaction commands.)
No edit summary
Line 3: Line 3:
__TOC__
__TOC__


== Introduction ==
= Introduction =
[[File:Inter.png|thumb|An example of a script with three options.]]
[[File:Inter.png|thumb|An example of a script with three options.]]
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 Kemoverse Online character script (which I call Action Script) directs what characters do, including your own. So by scripting yourself, you can make your character do stuff, and start acting without your control. A script is actually quite simple, it's just a text file that you write in the editor in-game.
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.


To explain how it works, first know that every character has two scripts - a "life script" and an "interaction script". Life script runs automatically at random, so basically, it has a life on its own. It's used to make characters 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.
Every character has two scripts - a "life script" and an "interaction script".


Script files are divided in to ''options'', basically sub-sections of both life and interaction scripts. When you click on someone and want to interact with them, it will list all the options. When the life script is running, it decides things based on the option titles. It's just a handy way to slice up the script and provide some more flexibility rather than creating a bunch of different files.  
* 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.


It's pretty interesting to make yourself "become"/"act" like an NPC. Since it's a rather fresh concept, I named it '''SPC''' (for Scripted Playable Character). By default, the interaction/life scripts won't bother you as you play, but you can enable ''SPC mode'' by pressing Alt+V (or the bottom right icon), in which case, your scripts will start to run automatically. So, by enabling SPC mode, you basically start acting like an NPC.
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.


Anyways, I've tried to make Action scripts be as simple/intuitive as possible. Let's check out an example!
== SPC Mode ==


== Example ==
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 =
  <nowiki>
  <nowiki>
= Say Hello
= Say Hello
t t
tn t
+ Hello there.
+ Hello there.
l left
lk left
l right
lk right
l l
lk l
- I'll tell you a secret.
- I'll tell you a secret.
+ What?
+ What?
- I have a snail in my pocket.</nowiki>
- I have a snail in my pocket.
Here's a short example. It presents and option to interact ("say hello"), and clicking on it, starts the script. Both players turn to each others, exchange dialog, and the script player looks 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.  
</nowiki>
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 letter that starts each line? It's the command - this determines what you want the character to do. After that first letter, you type in parameters to specify even more. 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. Let's have a look of all the commands you can do.


== Script Commands ==
= Script commands =


=== Movement ===
=== Movement ===