distractionware forums

VVVVVV => VVVVVV => Topic started by: zaratustra on July 30, 2011, 04:38:28 PM

Title: some scripting commands
Post by: zaratustra on July 30, 2011, 04:38:28 PM
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

Title: Re: some scripting commands
Post by: 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.
Title: Re: some scripting commands
Post by: TheoX on July 30, 2011, 06:02:03 PM
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.
Title: Re: some scripting commands
Post by: zaratustra on July 30, 2011, 06:07:10 PM
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)
Title: Re: some scripting commands
Post by: Terry on July 30, 2011, 08:03:11 PM
Oh right, yeah - they're the scripting commands from the old flash version. Is there a decompiled version floating around or something?
Title: Re: some scripting commands
Post by: TheoX on July 30, 2011, 08:23:41 PM
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"..
Title: Re: some scripting commands
Post by: Terry on July 30, 2011, 08:33:31 PM
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 )
Title: Re: some scripting commands
Post by: TheoX on July 30, 2011, 09:10:05 PM
Yeah that looks a bit more complicated!  Looking forward to the scripting demo so I know how to use the easier commands!
Title: Re: some scripting commands
Post by: zaratustra on July 31, 2011, 12:04:12 AM
Actually I just opened the executable in a text editor.
Title: Re: some scripting commands
Post by: PJBottomz on August 02, 2011, 04:43:47 AM
THANK YOU! If it wasn't for you finding all this, I never would've learned how to script! Thank you. :viridian:
Title: Re: some scripting commands
Post by: Gwinnell on August 03, 2011, 09:24:53 PM
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.
Title: Re: some scripting commands
Post by: Arkatox on August 07, 2011, 08:09:29 PM
What is the command to destroy a script box after it's used?
Title: Re: some scripting commands
Post by: TheoX on August 07, 2011, 11:48:56 PM
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.
Title: Re: some scripting commands
Post by: 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!  :(
Title: Re: some scripting commands
Post by: Dav999 on August 24, 2012, 03:05:27 PM
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 (http://distractionware.com/forum/index.php?topic=1038.0), 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)
Title: Re: some scripting commands
Post by: blue626 on August 24, 2012, 03:15:44 PM
Also, the script box with flag(n,on) shouldn't be in the same place as the trinket, or it might not work. It shouldn't be in the same place as the other script box either, and it should be closer to the trinket than the other script box (if you put the other one closer it will never work).

And, yes, you should have posted in the thread that Dav999 mentioned, as the last post in that one was much more recent than the last post in this one.
Title: Re: some scripting commands
Post by: MoogiGMD on September 06, 2012, 04:37:01 PM
I Tryed Destroy(platforms)

i think a trigger where the platforms are replaced with gravitylines quickly but that would be stupid...what about a new one where it makes something step on it (invisible viridan or something) when the trigger is excecuted however it turns into the well destroyable!
Title: Re: some scripting commands
Post by: Dav999 on September 06, 2012, 05:01:57 PM
Quote from: Hacker3443 on September 06, 2012, 04:37:01 PM
I Tryed Destroy(platforms)

i think a trigger where the platforms are replaced with gravitylines quickly but that would be stupid...what about a new one where it makes something step on it (invisible viridan or something) when the trigger is excecuted however it turns into the well destroyable!

I think it's very hard to implement for some reason, as the only thing that happens is: the sprite is deleted. And turning it into a disappearing platform and making an invisible :viridian: step on it would create glitches, for sure.
Title: Re: some scripting commands
Post by: MoogiGMD on September 06, 2012, 05:30:56 PM
yea...but it would also crash the game...because of the objects ID not being changed for 0.5 seconds instead of 0.1 (time it takes for an object to swap animations and like not mess up!
Title: Re: some scripting commands
Post by: Dav999 on September 06, 2012, 05:35:35 PM
Quote from: Hacker3443 on September 06, 2012, 05:30:56 PM
time it takes for an object to swap animations and like not mess up!

How do you know that? Have you 'cheated'? 8)
Title: Re: some scripting commands
Post by: MoogiGMD on September 06, 2012, 05:47:54 PM
no...it would crash because viridan can't be invisible...(never knew how to spell it) and he would fall into a hole of death...that would crash the game!
Title: Re: some scripting commands
Post by: FIQ on September 06, 2012, 05:50:43 PM
The problem is not the entity ID, but how platforms are implemented. They set a specific place (the place that the platforms are) as solid. What destroy(platforms) does is that it just removes the entity, not the fact that the place where it were was solid, I think.
Title: Re: some scripting commands
Post by: Dav999 on September 06, 2012, 06:57:29 PM
Quote from: Hacker3443 on September 06, 2012, 05:47:54 PM
no...it would crash because viridan can't be invisible...

Viridian CAN be invisible, but you can't have more than 1 on the screen... And you don't want him to flash off and on if you have a lot of platforms. If you look at the internal commands list, you can see there are two commands, showplayer() and hideplayer(), which toggle visibility. That trick could be used to remove disappearing platforms that are blocking the way (if you can't stand on them from above or below), in a custom level with internal scripting. Maybe I'm gonna use that, if it isn't too slow! :viridian:
Title: Re: some scripting commands
Post by: MoogiGMD on September 06, 2012, 06:58:34 PM
lol  :-*