some scripting commands

Started by zaratustra, July 30, 2011, 04:38:28 PM

Previous topic - Next topic

zaratustra

cribbed from the existing levels

music(X) - plays music X (0: silence, 1: pushing onwards, 2: positive force, 3: potential for anything, 4: passion for exploring, 5: ???, 6: predestined fate, 7: popular poutpourri, 8: pipe dream, 9: pressure cooker, 10: paced energy, 11: piercing the sky)
say(X) - says the text contained in the next X lines (default:1)
reply(X) - player says the text contained in the next X lines (default:1)
delay(X) - pause of X ticks
happy - yay
sad - bawww
flash - flash of light
destroy(gravitylines)
destroy(platforms) - doesn't quite work properly according to terry
destroy(warptokens)
flag(X,on) - turns flag on. X= 1-99
flag(X,off) - turns flag off
iftrinkets(X,script) = if trinkets are more or equal to X execute script
iftrinketsless(X,script)= if trinkets are less than X execute script
ifflag(X,script) = if flag is on, execute script


Terry

Heh, how did you find out about "destroy(platforms)"? :P It doesn't work properly yet in this version, so I didn't mention it when I was listing commands on twitter.

TheoX

This will actually be a very helpful thread if you edit your post and keep putting in commands.  Starting to understand scripting better.  Insani mentioned in one of the sticky threads about an 'end' command (no quotes) that stops the script safely, if you want to put that in.

zaratustra

#3
Quote from: Terry on July 30, 2011, 06:01:37 PM
Heh, how did you find out about "destroy(platforms)"? :P It doesn't work properly yet in this version, so I didn't mention it when I was listing commands on twitter.

your window was almost unlocked!

>cough<

activateteleporter(X), altstates(X), befadein(X), blackon(X), blackout(X), changeai(X,X,X), changecolour(X,X), changedir(X,X), changemood(X,X), changeplayercolour(X), changetile(X,X), companion(X), createactivityzone(X), createcrewman(X,X,X,X,X,X), createentity(X,X,X,X,X), createlastrescued(X), createrescuedcrew(X), cutscene(X), delay(X), destroy(X), endcutscene(X), everybodysad(X), face(X,X), fadein(X), fadeout(X), finalmode(X,X), flipgravity(X), foundtrinket(X), gamemode(X), gamestate(X), gotoposition(X,X,X), gotoroom(X,X), hascontrol(X), hidecoordinates(X,X), hideplayer(X), hidesecretlab(X), hideship(X), hidetargets(X), hideteleporters(X), hidetrinkets(X), ifcrewlost(X,X), ifexplored(X,X,X), ifflag(X,X), iflast(X,X), ifskip(X), loadscript(X), missing(X), musicfadeout(X), nocontrol(X), playef(X,X), position(X), position(X,X), rescued(X), rollcredits(X), setcheckpoint(X), shake(X), showcoordinates(X,X), showplayer(X), showsecretlab(X), showship(X), showtargets(X), showteleporters(X), showtrinkets(X), specialline(X), squeak(X), stopmusic(X), teleportscript(X), telesave(X), text(X,X,X,X), tofloor(X), trinketbluecontrol(X), trinketyellowcontrol(X), undovvvvvvman(X), untilbars(X), untilfade(X), vvvvvvman(X), walk(X,X)

(most of these do not actually work)

Terry

Oh right, yeah - they're the scripting commands from the old flash version. Is there a decompiled version floating around or something?

TheoX

#5
Quote from: zaratustra on July 30, 2011, 06:07:10 PM(most of these do not actually work)

Would you be kind enough to list what kind of arguments those functions take?  I want to use some of them :D

And just what is "vvvvvvman()"  :o

@Terry - Does this bother you or are you ok with extra commands being leaked?

EDIT:  Oops, I read it as "do actually work" instead of "do not"..

Terry

#6
Well, they don't actually do anything - they're the commands the internal scripts in VVVVVV use, and they're a bit more techy. The ones in the editor are actually a simplified version of these.

For example, this cutscene in the editor:


iftrinkets(1,newtrenchwarfare)

reply(1)
Ohh! I wonder what that is?

reply(3)
I probably don't really need it,
but it might be nice to take it
back to the ship to study...



... looks like this when it's translated into VVVVVV's actual scripting language:


cutscene()
untilbars()

iftrinkets(1,newtrenchwarfare)

squeak(player)
text(cyan,0,0,1)
Ohh! I wonder what that is?
position(player,above)
speak_active

squeak(player)
text(cyan,0,0,3)
I probably don't really need it,
but it might be nice to take it
back to the ship to study...
position(player,above)
speak_active

endtext

endcutscene()
untilbars()


(if you think that's cumbersome, you should see Nexus City :P )

TheoX

Yeah that looks a bit more complicated!  Looking forward to the scripting demo so I know how to use the easier commands!

zaratustra

Actually I just opened the executable in a text editor.

PJBottomz

THANK YOU! If it wasn't for you finding all this, I never would've learned how to script! Thank you. :viridian:

Gwinnell

Is there a command for detecting whether a flag is off? I'm trying all sorts but I can't get the behaviour I'm after.

Arkatox

What is the command to destroy a script box after it's used?

TheoX

Quote from: Arkatox on August 07, 2011, 08:09:29 PM
What is the command to destroy a script box after it's used?
There isn't one.  You have to use what I call "trigger scripts", or secondary scripts, that use ifflags to make sure a script doesn't run twice.  It's kind of a pain, and one of the reasons my level is taking so long to make.  Example of what I do:

Example script: "talking1trigger"
ifflag(1,talking1)
end()


Example script: "talking1"
say(2)
this script will
only run once!
flag(1,off)
end()


This assumes the flag used was turned "on" previously.

Smort

I don't understand how to use the iftrinkets commands. I want Captain Viridian to say something whenever he walks up to the trinket, but never again once it has been collected. Help!  :(

Dav999

Quote from: Smort on August 24, 2012, 11:37:33 AM
I don't understand how to use the iftrinkets commands. I want Captain Viridian to say something whenever he walks up to the trinket, but never again once it has been collected. Help!  :(

It would have been better to put it in this thread, because this one is a year old!

Anyway, iftrinkets works like iftrinkets(number,script name). If you have collected at least number trinkets, then you will go to another script, otherwise skip this command. The script name can not contain capital letters or spaces, because then it will always skip the command. So just put this in the script box near the trinket:

iftrinkets(1,nothing)
iftrinkets(0,trinketscript)


Then, make a script called trinketscript, which has this:

reply(2)
I want to get that trinket!
I'd better go and get it!


If there is more than one trinket in the level, it's much better to use flags, because the other trinkets also add up to the trinket count, and you may or may not have collected them, which changes the behaviour for this trinket. In that case, put this in the script near the trinket:

ifflag(n,nothing)
iftrinkets(0,trinketscript)


trinketscript stays the same, and you have to make another script, which is when you collect the trinket, in which you have to put this:

flag(n,on)

n has to be the same number in both scripts, and it can be anything from 1-99. The reason why this is in different scripts, is that if there is a say or reply command in the script, it will always turn on the cutscene bars (the black bars at the top and bottom of the screen), and you don't want those to appear and be stuck there every time you approach the trinket which is not there anymore. iftrinkets(0,trinketscript) is to load the other script, because there is no command to load a script directly, and this will work because you can't have less than 0 trinkets (actually, you can, but you have to mess with your save data to also glitch the game itself)