distractionware forums

VVVVVV => VVVVVV Levels => Topic started by: FIQ on February 20, 2012, 10:52:06 PM

Title: Need help/tips about scripting
Post by: FIQ on February 20, 2012, 10:52:06 PM
Hi.
First at all, is there any way to see if a flag is off? I know I can see if it's on, but not the opposite. I can do something ugly like this, but I prefer a better way;

sample1
ifflag(N,sample3)
flag(N,on)
ifflag(N,sample2)

sample2
flag(N,off)
(do things)

sample3
stop

I was thinking on creating a way to store and check exactly which trinkets the user has gotten. I was going to do this this way:

Room w/o trinket ----- Room with trinket
    [SCRIPTBOX1] ----- [SCRIPTBOX2]

The scriptbox2 would do the following:

Store the amount of current trinkets. This can be done by storing in a binary table. Say, I have 15 trinkets in my level. Then, I can use for example flag 90-93, and store them binary. For example, if I have 1 trinket, I will store them this way:
90 - off
91 - off
92 - off
93 - on

And if I have ten, I will store them this way:
90 - on
91 - off
92 - on
93 - off

Then, scriptbox1 is used to compare the previous count, stored in these flags, with the current one. If they mismatch, the user took the trinket in that other room. Then, you can store the "trinket found" data in another flag.

First, I was going to create a scriptbox that is placed at the exact point that the trinket is. However, this doesn't seem to work - you have to mis-align them by 1 pixel in some direction. I don't like this - it enables you to trigger the script while dodging the trinket (probably only done intentionally, but i don't like quirks like this in my levels! :p). Another possibility is to place the trinkets in a pit (forcing you to take it once you go into it), but that limits a bit where I can place trinkets.

Second - is there a possibility to execute an external script without checking for flags or trinkets? I guess I can do iftrinketsless(21,script), but there should be a better way...

EDIT: I MIGHT be able to place a scriptbox and a trinket in the same position by editing the .xml file manually, but I prefer avoiding manual edit.