Internal commands

Started by Hilbert, July 28, 2012, 01:23:29 PM

Previous topic - Next topic

blue626

#555
Quote from: FIQ on January 25, 2013, 10:15:19 PM
Try to have 2 lines in script2, having the latest line being the command you want to test. Make sure to have no more than 1 empty line below the last line in script2.

Okay, I recently tried this (test1 is the script inside the script box, obviously):

test1:
iftrinkets(0,test2)
(empty line)

test2:
(empty line)
flash
(empty line)

It worked. Then I replaced flash with play(1). It worked too.
Why would this not work, then?
Quote from: FIQ on December 10, 2012, 05:40:05 PM
For example, this (usually) fail:

a:
iftrinkets(0,b)

b:
flash
iftrinkets(0,c)

c:
say(1)
Test

The solution is to make a third line in b, with whatever content you like (I usually use ifflag(work,around)).
You had 1 empty line in the end of all scripts, right?

Dav999: In the previous test, with play(1), :viridian: didn't stop or became slower when the script was triggered. So, I guess that it shoiuld belong to this list:

Quote from: Dav999 on February 05, 2013, 11:30:29 PM
If you only use things like gotoroom(x,y), gotoposition(x,y,f), playef(x), customiftrinkets(n,s), customifflag(n,s), etc, then you won't notice any interruption with the no-cutscene-bars method, (...)

Quote from: Chillius03 on February 09, 2013, 03:43:43 PM
and color is worldwide or something.

Color is american english (and perhaps australian?).
Why is american english more popular (if it is)? Maybe i's because the population of the USA is very large... there are various reasons.
Apparently, Terry thought of that and, in 2.1. beta, when he added the commands for coloured text boxes, he added "gray" and "grey" (as well as "terminal") to change back to gray text boxes. However, none of the 3 words work, but that isn't related to this.
I personally like british english more (see my profile...)...
When I wrote "coloured" above it autocorrected to "colored" and after adding the "u", underlined the word red...

EDIT: This thread has more posts than the ones I have ever posted.

EDIT 2: I think I set British English as the language used (in my profile). Why doesn't it show? Going to set it again...
EDIT 3: I think it already showed before and I didn't notice.
EDIT 4: I forgot that test1 also has an empty line at the end.

Dav999

Quote from: blue626 on February 09, 2013, 04:56:43 PM
Quote from: FIQ on January 25, 2013, 10:15:19 PM
Try to have 2 lines in script2, having the latest line being the command you want to test. Make sure to have no more than 1 empty line below the last line in script2.

Okay, I recently tried this (test1 is the script inside the script box, obviously):

test1:
iftrinkets(0,test2)

test2:
(empty line)
flash
(empty line)

It worked. Then I replaced flash with play(1). It worked too.
Why would this not work, then?
Quote from: FIQ on December 10, 2012, 05:40:05 PM
For example, this (usually) fail:

a:
iftrinkets(0,b)

b:
flash
iftrinkets(0,c)

c:
say(1)
Test

The solution is to make a third line in b, with whatever content you like (I usually use ifflag(work,around)).
You had 1 empty line in the end of all scripts, right?

I think that is because 'iftrinkets(0,c)' in script b is executed first, and as an internal command, and there's no built-in script called 'c'. The solution would be to add another line at the end of b.

Quote from: blue626 on February 09, 2013, 04:56:43 PM
Dav999: In the previous test, with play(1), :viridian: didn't stop or became slower when the script was triggered. So, I guess that it shoiuld belong to this list:

Quote from: Dav999 on February 05, 2013, 11:30:29 PM
If you only use things like gotoroom(x,y), gotoposition(x,y,f), playef(x), customiftrinkets(n,s), customifflag(n,s), etc, then you won't notice any interruption with the no-cutscene-bars method, (...)

Yeah, but I'm not going to make a full list of all commands which don't stop or slow down :viridian: when giving a few examples is enough...

FIQ

#557
Do anyone know if you can get the auto-refacing behaviour in custom levels with internal crewmates? I.e. have internal crewmates automatically change face direction depending on how you stand. At the moment, I emulate it by having 2 background scripts running at either side of the crewmate in question which runs face(red,player), but is there a better way to do it?

Dav999

Quote from: FIQ on February 11, 2013, 06:15:44 PM
Do anyone know if you can get the auto-refacing behaviour in custom levels with internal crewmates? I.e. have internal crewmates automatically change face direction depending on how you stand. At the moment, I emulate it by having 2 background scripts running at either side of the crewmate in question which runs face(red,player), but is there a better way to do it?

createcrewman(x,y,c,m,faceplayer) :viridian:

FIQ

Just wanted to say a critical thing.
Personally, when I branch to new scripts and want to avoid the line at the bottom being read as an internal script, I use ifflag(work,around). This does not work correctly in the Windows version of VVVVVV. I don't know about the Mac version, but the Linux version doesn't have this issue. For some reason, after chain execution of some scripts, the Windows 2.1 version somehow gets the "correct" behaviour and triggers the command correctly as a simplified script, branching to the script "around". I'll test this further, but if this means what I think it does, it might mean that the "no cutscene method" isn't realible in Windows. The issue I'm having is easy to work around, but if this would happen to a text(1,0,0,4) intended to avoid cutscenes while doing an internal script...

Dav999

#560
Quote from: FIQ on February 14, 2013, 08:16:20 AM
Just wanted to say a critical thing.
Personally, when I branch to new scripts and want to avoid the line at the bottom being read as an internal script, I use ifflag(work,around). This does not work correctly in the Windows version of VVVVVV. I don't know about the Mac version, but the Linux version doesn't have this issue. For some reason, after chain execution of some scripts, the Windows 2.1 version somehow gets the "correct" behaviour and triggers the command correctly as a simplified script, branching to the script "around". I'll test this further, but if this means what I think it does, it might mean that the "no cutscene method" isn't realible in Windows. The issue I'm having is easy to work around, but if this would happen to a text(1,0,0,4) intended to avoid cutscenes while doing an internal script...

Why don't you use an unrecognized command like # instead of ifflag(work,around)? If I use # it works just fine.

EDIT: Oh, you already said that it was easy to work around. So it only happens if you chain a lot of scripts?

FIQ

Quote from: Dav999 on February 14, 2013, 08:40:06 AM
Quote from: FIQ on February 14, 2013, 08:16:20 AM
Just wanted to say a critical thing.
Personally, when I branch to new scripts and want to avoid the line at the bottom being read as an internal script, I use ifflag(work,around). This does not work correctly in the Windows version of VVVVVV. I don't know about the Mac version, but the Linux version doesn't have this issue. For some reason, after chain execution of some scripts, the Windows 2.1 version somehow gets the "correct" behaviour and triggers the command correctly as a simplified script, branching to the script "around". I'll test this further, but if this means what I think it does, it might mean that the "no cutscene method" isn't realible in Windows. The issue I'm having is easy to work around, but if this would happen to a text(1,0,0,4) intended to avoid cutscenes while doing an internal script...

Why don't you use an unrecognized command like # instead of ifflag(work,around)? If I use # it works just fine.

EDIT: Oh, you already said that it was easy to work around. So it only happens if you chain a lot of scripts?
That's what I saw. I'll test further and see exactly how many scripts this was, and if it applies to text(1,0,0,4) as well.

Keep in mind "a lot of scripts" was around 20+ in my case, so it shouldn't be that big of a problem.

Dav999

Quote from: FIQ on February 14, 2013, 08:47:51 AM
Keep in mind "a lot of scripts" was around 20+ in my case, so it shouldn't be that big of a problem.

More than 20 scripts chained in a row? I think we should expect something huge now ::) :P

Maybe it's the same kind of limit as the 20 text boxes on the screen limit. Maybe there is a connection?

FIQ

Quote from: Dav999 on February 14, 2013, 09:12:43 AM
Quote from: FIQ on February 14, 2013, 08:47:51 AM
Keep in mind "a lot of scripts" was around 20+ in my case, so it shouldn't be that big of a problem.

More than 20 scripts chained in a row? I think we should expect something huge now ::) :P
I use 20 scripts (in fact I use 32, but things broke in the middle) for keeping a history of the 4 latest teleporter destinations that you set (or try to set!) in Back to VVVVVV, which is used in my cheat system. Nothing too special. Reason that I need that many scripts is due to VVVVVV's very limited scripting capabilities.


Quote from: Dav999 on February 14, 2013, 09:12:43 AM
Maybe it's the same kind of limit as the 20 text boxes on the screen limit. Maybe there is a connection?
I don't think there's a direct connection between them (especially not as the Linux version of VVVVVV doesn't have this issue, while it has the textbox issue), but there might be a similar reason.

FIQ

#564
This is just confusing...

The issue does NOT seem related to the amount of scripts that is ran, but it seems to rely on something else. I tried the following:

* Make 40 scripts: test, test2, test3, ..., test40 with following content:

test:
iftrinkets(0,test2)

test2:
iftrinkets(0,test2)
ifflag(work,around)

...

test39:
iftrinkets(0,test39)
ifflag(work,around)

test40:
say
Worked?


This worked without issues (it went happily to test40).
I then tried to set the flags that I set during execution in my own level for which this screwed up (flag 1-16, 42-45, 91-93 and 95) and made a script named "around" with the following content:

around:
say
!!! ERROR !!!


Things still worked as expected.

I then proceed to check if I had run into a critical hard limit for scripts in total which would have been boring. I did this by copying the necessary scripts to trigger the bug from my level (and nothing else) into this test level. The bug was still there, so this wasn't the problem.

I'll test further and try to isolate why this is happening.

EDIT: It's not caused by internal commands usage other than ifflag(work,around). The exact way the bug happens is very weird too...

EDIT2: OK, I've managed to only include the scripts which are in use that triggers the bug. Run "testfail" twice to see it. This doesn't happen in the Linux version, but it DOES happen in the windows one. I cannot test the mac version...

EDIT3: It happens in the 2.1 beta 2 and 2.0 (all windows). I guess I can test it on 2.1 beta 1 too, but it's not really relevant...

EDIT4: I think I've managed to find something. No matter what you do, updatehistory6_2 never seems to work properly -- branching to it as the first script gives instant fail. I'll try to check exactly why this happens.

EDIT5: flag(6,on) causes problems. Somehow, this fail after the first execution (for which it somehow works):

test:
iftrinkets(0,test2)

test2:
flag(6,on)
iftrinkets(0,test3)
ifflag(work,around)

test3:
say
!! WORKS !!
ifflag(work,around)

around:
say
!! ERROR !!


I cannot find a reason for why this shouldn't work. Anyone else?

EDIT6: flag(7,on) works without issues. That's editing nothing but the flag number.

Dav999

Quote from: FIQ on February 14, 2013, 01:11:54 PM
This is just confusing...

The issue does NOT seem related to the amount of scripts that is ran, but it seems to rely on something else. I tried the following:

* Make 40 scripts: test, test2, test3, ..., test40 with following content:

test:
iftrinkets(0,test2)

test2:
iftrinkets(0,test2)
ifflag(work,around)

...

test39:
iftrinkets(0,test39)
ifflag(work,around)

test40:
say
Worked?


This worked without issues (it went happily to test40).
I then tried to set the flags that I set during execution in my own level for which this screwed up (flag 1-16, 42-45, 91-93 and 95) and made a script named "around" with the following content:

around:
say
!!! ERROR !!!


Things still worked as expected.

I then proceed to check if I had run into a critical hard limit for scripts in total which would have been boring. I did this by copying the necessary scripts to trigger the bug from my level (and nothing else) into this test level. The bug was still there, so this wasn't the problem.

I'll test further and try to isolate why this is happening.

EDIT: It's not caused by internal commands usage other than ifflag(work,around). The exact way the bug happens is very weird too...

EDIT2: OK, I've managed to only include the scripts which are in use that triggers the bug. Run "testfail" twice to see it. This doesn't happen in the Linux version, but it DOES happen in the windows one. I cannot test the mac version...

EDIT3: It happens in the 2.1 beta 2 and 2.0 (all windows). I guess I can test it on 2.1 beta 1 too, but it's not really relevant...

EDIT4: I think I've managed to find something. No matter what you do, updatehistory6_2 never seems to work properly -- branching to it as the first script gives instant fail. I'll try to check exactly why this happens.

EDIT5: flag(6,on) causes problems. Somehow, this fail after the first execution (for which it somehow works):

test:
iftrinkets(0,test2)

test2:
flag(6,on)
iftrinkets(0,test3)
ifflag(work,around)

test3:
say
!! WORKS !!
ifflag(work,around)

around:
say
!! ERROR !!


I cannot find a reason for why this shouldn't work. Anyone else?

So it only fails when you use flag 6? That's strange... What does flag 6 do in the main game?

FIQ

#566
Quote from: Dav999 on February 14, 2013, 02:02:39 PM
Quote from: FIQ on February 14, 2013, 01:11:54 PM
This is just confusing...

The issue does NOT seem related to the amount of scripts that is ran, but it seems to rely on something else. I tried the following:

* Make 40 scripts: test, test2, test3, ..., test40 with following content:

test:
iftrinkets(0,test2)

test2:
iftrinkets(0,test2)
ifflag(work,around)

...

test39:
iftrinkets(0,test39)
ifflag(work,around)

test40:
say
Worked?


This worked without issues (it went happily to test40).
I then tried to set the flags that I set during execution in my own level for which this screwed up (flag 1-16, 42-45, 91-93 and 95) and made a script named "around" with the following content:

around:
say
!!! ERROR !!!


Things still worked as expected.

I then proceed to check if I had run into a critical hard limit for scripts in total which would have been boring. I did this by copying the necessary scripts to trigger the bug from my level (and nothing else) into this test level. The bug was still there, so this wasn't the problem.

I'll test further and try to isolate why this is happening.

EDIT: It's not caused by internal commands usage other than ifflag(work,around). The exact way the bug happens is very weird too...

EDIT2: OK, I've managed to only include the scripts which are in use that triggers the bug. Run "testfail" twice to see it. This doesn't happen in the Linux version, but it DOES happen in the windows one. I cannot test the mac version...

EDIT3: It happens in the 2.1 beta 2 and 2.0 (all windows). I guess I can test it on 2.1 beta 1 too, but it's not really relevant...

EDIT4: I think I've managed to find something. No matter what you do, updatehistory6_2 never seems to work properly -- branching to it as the first script gives instant fail. I'll try to check exactly why this happens.

EDIT5: flag(6,on) causes problems. Somehow, this fail after the first execution (for which it somehow works):

test:
iftrinkets(0,test2)

test2:
flag(6,on)
iftrinkets(0,test3)
ifflag(work,around)

test3:
say
!! WORKS !!
ifflag(work,around)

around:
say
!! ERROR !!


I cannot find a reason for why this shouldn't work. Anyone else?

So it only fails when you use flag 6? That's strange... What does flag 6 do in the main game?
Yep.
Flag 6 is used for 2 things: telling that you can't pass before crewmate X is over to the next screen (in intermission 1), and at comms relay. It's never used in internal scripts.

EDIT: I found the first issue - ifflag(work,around) - "work" (or any other non-number) is somehow controlled by flag 6 internally (don't ask me why, lol), not flag 1, or what would make even more sense, flag 0. This explains the flag 6 issue. However, there was also a second issue I was having with internal scripts being ignored (as seen as the script branched to the CUSTOM script "around" when it shouldn't even have been able to). I bet this will be harder to test...

EDIT2: Found the issue!

An important thing with the internal scripting without cutscenebars method is that the last line isn't moved to the top and executes internally, it's copied.

Try this and you'll understand what I mean.

test:
iftrinkets(0,test2)

test2:
delay(30)
flash(1)


As most commands doesn't have a custom counterpart, this is hardly ever seen, but needs to be taken into account. Thus, there are no real limits unless you know this:

* Flag 6 turned on makes work-arounds like ifflag(work,around) at the bottom fail. Use delay(0) instead.
* Flag 12 is the internal counterpart to flag 6 (i.e. makes customifflag(work,around) branch to around).
* The bottom line of scripts called by ifflag, iftrinkets, etc isn't moved but copied. Take this into account and stop the script too early if there's a custom counterpart that you don't want to trigger

The two first issues can both be solved by not using ifflag() with bogus content.

FIQ

You cannot have more than 500 scripts in a level. Just saying.

Dav999

Quote from: FIQ on February 14, 2013, 04:33:44 PM
You cannot have more than 500 scripts in a level. Just saying.

What happens if you make more?

FIQ

#569
Quote from: Dav999 on February 14, 2013, 04:39:25 PM
Quote from: FIQ on February 14, 2013, 04:33:44 PM
You cannot have more than 500 scripts in a level. Just saying.

What happens if you make more?
If you try to make a 501st script, VVVVVV crashes. If you try to load a level with 501+ scripts (i.e. by inserting them manually in the file), VVVVVV level editor crashes on load. In addition, VVVVVV also crashes if you load it from the "play level" menu. In other words, it's impossible to have more than 500 scripts. While this is kind of boring, it should be very hard to reach the limit in question.. after all I seem to have been the first that stumbled upon it, lol.

In addition, the limit on the amount of script lines is 198. So the theoretical maximun on the amount of script lines is 198*500=99000 lines. If every script you use is internal, and you maintain 2.0 compatibility, you get around 70k lines of code max in theory (however, most scripts will be smaller than 198 lines, of course).