How does one internally script?

Started by A quite MEDICal Derpfish, February 18, 2013, 03:31:52 PM

Previous topic - Next topic

A quite MEDICal Derpfish

Just want a short tutorial, maybe some commands. I only know CreateEntity.  :viridian:

allison

#1
Quote from: Dav999 on July 28, 2012, 01:43:41 PM
HOW TO USE INTERNAL COMMANDS:

There are two methods to do it. Those methods are listed below, and I attached an example with those two methods as a vvvvvv level.

--- METHOD 1 - THE SAY(-1) METHOD ---

say(-1)
text(1,0,0,4)
say(5)
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(5)
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(5)
...


It has to end with:

...
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(4)
endtext
endcutscene()
untilbars()
loadscript(stop)


You don't have to use say(5) if you want to use less than 4 commands in a row, you can use say(4) to have 3 commands in a row, say(3) to have 2 commands in a row, et cetera. For example:

say(-1)
text(1,0,0,4)
say(4)
[internal]
[internal]
[internal]
text(1,0,0,4)
say(5)
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(2)
[internal]
text(1,0,0,4)
say(4)
endtext
endcutscene()
untilbars()
loadscript(stop)


Text boxes in internal scripting are a bit hard to do, because you can only use 4 lines in a row. There's a post somewhere else in this topic which explains how to do it. This post is already REALLY long.

--- METHOD 2 - WITHOUT CUTSCENE BARS---

If you want to use internal commands without cutscene bars, put this in the script box which Viridian walks through:

Code (script1) Select
iftrinkets(0,script2)

Then make a new script. In this case the new script is called 'script2' (you can use any name using a-z or 0-9, note that A-Z and some special characters should not be used). Delete the script box, so that Viridian doesn't activate it directly. The script has to be activated by the script containing iftrinkets(0,script2).

The second script should look like this:

Code (script2 first part) Select
say(5)
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(5)
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(5)
...


It has to end with:

Code (script2 last part) Select
...
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(2)
endtext
loadscript(stop)
text(1,0,0,4)


Note that in the last part of this script, there has to be one blank line after the last text(1,0,0,4). Not 0, because then things get deleted because of a bug in the script editor, and not more than 1, because then it won't work. 'text(1,0,0,4)' has to be the second last line, and the last line has to be empty.

Just like in the say(-1) method, you don't have to use say(5) if you want to use less than 4 commands in a row, you can use say(4) to have 3 commands in a row, say(3) to have 2 commands in a row, et cetera. For example:

Code (script2) Select
say(4)
[internal]
[internal]
[internal]
text(1,0,0,4)
say(5)
[internal]
[internal]
[internal]
[internal]
text(1,0,0,4)
say(2)
[internal]
text(1,0,0,4)
say(2)
endtext
loadscript(stop)
text(1,0,0,4)


Those are the methods for getting it to work. View the Internal Commands thread for more commands and info.

Dav999

Quote from: Derpfish on February 18, 2013, 03:31:52 PM
Just want a short tutorial, maybe some commands. I only know CreateEntity.  :viridian:

Make a script called script_load. You can call it whatever you want, as long as you know that it's the load script.

Then make a script called script. Again, you can call it whatever you want, but don't use capital letters or special characters, use only small letters, numbers and _ to be safe.

Delete the terminal/script box you used to create the last script. The terminal/script box for the first script has to be where you want the script to execute.

In script_load (or whatever you called the load script) you should type this:
iftrinkets(0,script)
Make sure you have at least one empty line after that command.

In script (or whatever you called the actual script) you should write the internal commands after say blocks, and the the last line should be text(1,0,0,4), after that exactly ONE blank line. 1.
say(5)
[internal command]
[internal command]
[internal command]
[internal command]
text(1,0,0,4)
say(5)
[internal command]
[internal command]
[internal command]
[internal command]
((etc.))
text(1,0,0,4)
say(3)
[internal command] likely endcutscene()
[internal command] likely untilbars()
loadscript(stop)
text(1,0,0,4)
[[ONE blank line]]]


You can write the internal commands in blocks of 1, 2, 3 or 4 commands in a row and between blocks, there should be text(1,0,0,4) and say(x), so this:
say(5)
[internal command]
[internal command]
[internal command]
[internal command]
text(1,0,0,4)
say(2)
[internal command]
text(1,0,0,4)
say(4)
[internal command]
[internal command]
[internal command]
text(1,0,0,4)
say(3)
[internal command]
[internal command]
text(1,0,0,4)
say(3)
endcutscene()
untilbars()
loadscript(stop)
text(1,0,0,4)
[one blank line]

works too.

This method doesn't insert cutscene bars automatically, so you have to insert them manually at the beginning and remove them at the end.

Some basic commands:

cutscene() - inserts cutscene bars
endcutscene() - removes cutscene bars
untilbars() - wait until cutscene() or endcutscene() is completed
loadscript(stop) - stops the script (necessary at the end). Instead of loadscript(stop), you can also use customiftrinkets(0,x) to go to another script instead

gotoroom(x,y) - go to another room. Note that coordinates start at 0 here instead of 1 in the editor, so to go to room (9,15) you need gotoroom(8,14). Just subtract one.
gotoposition(x,y,f) - go to a position in the same room. This is mostly trial and error. Anyway, x and y are coordinates in the current room, f is whether you're flipped or not, 0 to have normal gravity, 1 for reversed gravity.
moveplayer(x,y) - moves :viridian: x pixels to the right and y pixels down (and of course you can also use negative numbers to make him move up or to the left)

createentity(x,y,id,m1,m2) - create an entity
createcrewman(x,y,color,mood,face) - create a crewman at x,y, with color any of the following: blue, red, yellow, green, purple (not pink) and teleporter (that's right!), colors can't be names. Gray is also possible, but you can't change anything about him anymore. Mood can be 0 for happy and 1 for sad, and face can be faceleft, faceright or faceplayer (faceplayer makes them change automatically to :viridian:) Going to another room makes the crewmate disappear.

changeplayercolour(x) - changes :viridian:'s color (and note the colour in the command) to one of the following: blue, red, yellow, green, purple (not pink) and teleporter. Colors can't be names. Note that dying resets the color, so you have to make a script for changeplayercolour(x) at every checkpoint
restoreplayercolour() - changes you back to cyan. changeplayercolour(cyan) basically does the same.
changecolour(a,b) - changes the color of a crewmate (created with createcrewman) with color a, to color b. Colors are mentioned before.
changeai(color,facedirection) - Changes the face direction of a crewmate (color can also be 'player' for :viridian:) to faceleft, faceright or faceplayer.
changeai(color,followposition,x) - Makes a crewmate walk to a certain x position. If you want to move :viridian: better use walk(x,x) instead
walk(direction,x) - Makes :viridian: walk. Direction can be left or right, and x is number of tiles.
flip - makes :viridian: flip
tofloor - makes :viridian: flip to the floor if he isn't already
flipgravity(color) - flips a crewmate, colors are mentioned before

changemood(color,mood) - changes the mood of someone (color can also be 'player' for :viridian:) to 0 for happy, 1 for sad
everybodysad() - makes everyone sad at once

hideplayer() - makes :viridian: totally invisible
showplayer() - makes :viridian: visible again

fadeout() - fades the screen to black
fadein() - fade in from fadeout()
untilfade() - waits until fadeout() or fadein() is completed
befadein() - immediately fade in, without 'fading' in but just restoring the screen from black.

alarmon - turns the ship alarm on
alarmoff - turns the ship alarm off

musicfadeout() - fades out music
play(x) - plays music (note: song numbers are different, go up to 14)
playef(x,10) - plays a sound effect. I don't know what the 10 is for, but it's always used in the main game so...

setcheckpoint() - sets the respawn position to your current position

destroy(gravitylines/warptokens) - same as in simplified scripting

flag(x,on/off) - same
customifflag(x,script) - same as ifflag(x,script) in simplified scripting
customiftrinkets(x,script) - same as iftrinkets(x,script) in simplified scripting

Text boxes should be like this if you have 1 line of text:
say(2)
squeak(color) - makes someone squeak, player for :viridian:
text(1,0,0,4)
say(5)
text(color,x,y,1) - makes a text box with a certain color (cyan for :viridian:), x and y can both be 0. 1 is number of lines
Text - this is just your text of course :P
position(x[,x]) - position(player,above) for above :viridian: can also be below, position(color,above/below) for above/below a crewmate with createcrewman, position(center) for centered text box
speak_active - always use this, it makes the text box appear

text(1,0,0,4)
say(x)
endtext - only if there's not a text box after this, or if there's a delay in between. It makes the text box disappear.

Text boxes should be like this if you have 2 lines of text:
say(2)
squeak(color) - makes someone squeak, player for :viridian:
text(1,0,0,4)
say(5)
text(color,x,y,2) - makes a text box with a certain color (cyan for :viridian:), x and y can be -500,-500 for centered, otherwise you'll have to try to find correct coordinates. 2 is number of lines
Text - this is just your text of course :P
It has two lines - the second line
speak_active - always use this, it makes the text box appear

text(1,0,0,4)
say(x)
endtext - only if there's not a text box after this, or if there's a delay in between. It makes the text box disappear.

allison

Quote from: Dav999 on February 18, 2013, 04:45:43 PM
Quote from: Derpfish on February 18, 2013, 03:31:52 PM
Just want a short tutorial, maybe some commands. I only know CreateEntity.  :viridian:
(cool stuff)

Wow, this taught me stuff *I* didn't know :P