Internal Scripting Tutorial

Started by Ally 🌠, May 14, 2016, 02:12:36 PM

Previous topic - Next topic

Ally 🌠

As I see this is the first result on google, I'm gonna put this here:
http://distractionware.com/forum/index.php?topic=3181.0
That's the updated version.
Please use that instead.


Original post:


-=Internal Scripting Tutorial=-

-=THE BASICS=-

Lets learn how to internal script, shall we?
So first lets trick the parser.
Remember that say() command?
That simple command starts it all.
say(-1).
See that?
That is tricking the parser to load your very first internal command.
Now put an internal command below it.
say(-1)
changeplayercolour(green)

Now it turns you green (I think...) but there is also a bunch of garbage.
To get rid of it...
say(-1)
text(1,0,0,4)
say(4)
[Internal]
endcutscene()
untilbars()
loadscript(stop)

So see that?
text(1,0,0,4) is an internal command.
So do you see that say(x)?
That is how many internal commands you have.
Reminder: any number in say() cannot go above 50.
Anyways, you MUST have
endcutscene()
untilbars()
loadscript(stop)

at the end.

-=FIRST INTERNAL SCRIPT=-

So... you ready for your first internal script?
Type this in to the VVVVVV editor.
say(-1)
text(1,0,0,4)
say(8)
changeplayercolour(blue)
delay(30)
changeplayercolour(green)
delay(30)
changeplayercolour(purple)
endcutscene()
untilbars()
loadscript(stop)


And what does it do?
It activates cutscene bars, makes Viridian blue, waits a second, makes them green, waits a second and then makes them purple.

So, you can have ANY command in there.

say(-1)
text(1,0,0,4)
say(4)
alarmon()
endcutscene()
untilbars()
loadscript(stop)


That turns the alarm on.

say(-1)
text(1,0,0,4)
say(4)
alarmoff()
endcutscene()
untilbars()
loadscript(stop)


That turns it back off.
Now, lets convert simplified scripting into internal scripting.

say
It has been 5 years since I last saw them...
say
I really miss them...
say
SIGNAL LOST
sad
delay(30)
reply
Who was that...?

Now lets change that.

squeak(terminal)
text(grey,69,420,1)
It has been 5 years since I last saw them...
position(center)
speak_active
squeak(terminal)
text(grey,69,420,1)
I really miss them...
position(center)
speak_active
squeak(terminal)
text(grey,69,420,1)
SIGNAL LOST
position(center)
speak_active

changemood(cyan,1)
delay(30)
squeak(cyan)
text(cyan,69,420,1)
Who was that...?
position(player,above)
speak_active


And that is it.

Now, do you hate the cutscene bars?
Well, we can deal with that, too.
Now you have to use 2 scripts per 1 script.
wait what

So if I want Viridian to be green, it only takes 1 script with cutscene bars, but 2 without.

CUTSCENE BARS:

script1:

say(-1)
text(1,0,0,4)
say(4)
changeplayercolour(green)
endcutscene()
untilbars()
loadscript(stop)


NO CUTSCENE BARS:

script1:
iftrinkets(0,script2)

script2:
changeplayercolour(green)


With that method, we can't have more than 1 line.
Do you want more than 1?
Well, do this:

script1:
iftrinkets(0,script2)

script2:
say(4)
flip
delay(30)
flip
loadscript(stop)
text(1,0,0,4)



And tada! It's finished!

I hope you enjoyed, and a list of all commands is here: http://tolp2.nl/forum/index.php?topic=21.0
Have fun!

Asmodean_

Quote from: Luigi master on May 14, 2016, 02:12:36 PM
say(8)

Congrats you accidentally emoji'd. Maybe use code blocks for also better readability?

moth ✨

or i dunno, [nobbc][/nobbc] like a normal person?

Ally 🌠


Funny Topical Meme

How do I create cutscenes, like in Dimension Open?

moth ✨

Quote from: VVVVVViridian on May 21, 2016, 06:04:24 PM
How do I create cutscenes, like in Dimension Open?
I'd give you a tutorial but I'm too lazy
don't ask anyone who isn't crazya or dav because their explanation will be sub-par and convoluted

Funny Topical Meme

Quote from: ShinyKitten07 on May 21, 2016, 07:22:46 PM
Quote from: VVVVVViridian on May 21, 2016, 06:04:24 PM
How do I create cutscenes, like in Dimension Open?
I'd give you a tutorial but I'm too lazy
don't ask anyone who isn't crazya or dav because their explanation will be sub-par and convoluted
Also, what are the colours for createcrewman?

moth ✨

cyan,blue,red,yellow,green,purple,gray

Dav999

You can create cutscenes by making a script box or a terminal, and giving it a name. Then go to the script editor (in VVVVVV it's in the menu after pressing esc, in Ved there's a Scripts button on the right) and you'll find a new script with the name you just created.

In that script you can type simplified scripting commands, there are several posts about that (this and this are some examples).

If you want to not let your cutscene be run more than once per playthrough (highly recommended for cutscenes) you need to use flags in two different scripts like this:
Code (yourcutscene_load) Select
ifflag(f,stop)
flag(f,on)
iftrinkets(0,yourcutscene)
Code (yourcutscene) Select
say(1)
This is a cutscene!
reply(1)
Nice!

Where f is a number between 0 and 99, but if you use Ved you can also think of names instead of numbers. Each cutscene that shouldn't repeat needs a different flag. (The script "stop" doesn't have to exist and "stop" doesn't have any special meaning in VVVVVV, it can be "nonono" "iowqrjw" or whatever, as long as it's something that doesn't exist.)

If you want to use internal commands (createcrewman is one of them), you have to do something special, but I recommend learning how to use simplified scripting first.

Ally 🌠

Quote from: Dav999 on May 21, 2016, 08:47:52 PM
You can create cutscenes by making a script box or a terminal, and giving it a name. Then go to the script editor (in VVVVVV it's in the menu after pressing esc, in Ved there's a Scripts button on the right) and you'll find a new script with the name you just created.

In that script you can type simplified scripting commands, there are several posts about that (this and this are some examples).

If you want to not let your cutscene be run more than once per playthrough (highly recommended for cutscenes) you need to use flags in two different scripts like this:
Code (yourcutscene_load) Select
ifflag(f,stop)
flag(f,on)
iftrinkets(0,yourcutscene)
Code (yourcutscene) Select
say(1)
This is a cutscene!
reply(1)
Nice!

Where f is a number between 0 and 99, but if you use Ved you can also think of names instead of numbers. Each cutscene that shouldn't repeat needs a different flag. (The script "stop" doesn't have to exist and "stop" doesn't have any special meaning in VVVVVV, it can be "nonono" "iowqrjw" or whatever, as long as it's something that doesn't exist.)

If you want to use internal commands (createcrewman is one of them), you have to do something special, but I recommend learning how to use simplified scripting first.
Quote from: VVVVVViridian on May 21, 2016, 06:04:24 PM
How do I create cutscenes, like in Dimension Open?
I think he means fadeout() and fadein()

allison

Quote from: Dav999 on May 21, 2016, 08:47:52 PM
(The script "stop" doesn't have to exist and "stop" doesn't have any special meaning in VVVVVV, it can be "nonono" "iowqrjw" or whatever, as long as it's something that doesn't exist.)
It's actually possible to do this:
ifflag(f,)
Leaving the second argument blank will ensure that no script is triggered. (Keeping the comma is still important, though.)

Funny Topical Meme

Quote from: Dav999 on May 21, 2016, 08:47:52 PM
You can create cutscenes by making a script box or a terminal, and giving it a name. Then go to the script editor (in VVVVVV it's in the menu after pressing esc, in Ved there's a Scripts button on the right) and you'll find a new script with the name you just created.

In that script you can type simplified scripting commands, there are several posts about that (this and this are some examples).

If you want to not let your cutscene be run more than once per playthrough (highly recommended for cutscenes) you need to use flags in two different scripts like this:
Code (yourcutscene_load) Select
ifflag(f,stop)
flag(f,on)
iftrinkets(0,yourcutscene)
Code (yourcutscene) Select
say(1)
This is a cutscene!
reply(1)
Nice!

Where f is a number between 0 and 99, but if you use Ved you can also think of names instead of numbers. Each cutscene that shouldn't repeat needs a different flag. (The script "stop" doesn't have to exist and "stop" doesn't have any special meaning in VVVVVV, it can be "nonono" "iowqrjw" or whatever, as long as it's something that doesn't exist.)

If you want to use internal commands (createcrewman is one of them), you have to do something special, but I recommend learning how to use simplified scripting first.

I can cutscene with simplified scripting, but I mean having a custon crewmate walk on and off of screen. That's what I can't do, I can do text in internal scripting.

Ally 🌠

Well, use createcrewman.
You can make a crewmate.
Now use a walk command.



DAV SENPAI TEACH THIS PEASANT pls

because I am on iOS

Dav999

Quote from: VVVVVViridian on May 22, 2016, 08:19:59 AM
I can cutscene with simplified scripting, but I mean having a custon crewmate walk on and off of screen. That's what I can't do, I can do text in internal scripting.
Oh, your original question made me think you were new to scripting.

createcrewman(x,y,colour,mood,ai)
colour: cyan/blue/red/yellow/green/purple/gray(?)/player(?)
mood: 0 for happy, 1 for sad
ai: faceleft/faceright/faceplayer/face<colour> and I think panic was also an option

walk(direction,pixels) - make the player walk
direction: left/right

changeai(colour,ai)
colour: player/cyan/blue/red/yellow/green/purple/gray(?)
ai: faceleft/faceright/faceplayer/face<colour>/panic(?)

changeai(colour,ai,x)
colour: player/cyan/blue/red/yellow/green/purple/gray(?)
ai: followposition
x: the x position the crewmate should approach


Quote from: Luigi master on May 22, 2016, 12:01:12 PM
DAV SENPAI TEACH THIS PEASANT pls

because I am on iOS
This entire post was written on iOS :P

Ally 🌠