Internal commands

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

Previous topic - Next topic

Samario

Quote from: crazyal02 on May 25, 2013, 07:23:42 PM
It might be possible to use gotoroom(x,y) with nearly identical rooms to make the tiles animate. If you had a WHOLE BUNCH OF ROOMS you could even emulate the color changing!
Unfortunately,
A) I don't WANT the colo(u)r changing,
B) that would take up too many rooms, and
C) gotoroom locks controls.

End of story.

Dav999

Quote from: Samario on May 25, 2013, 07:29:24 PM
Quote from: crazyal02 on May 25, 2013, 07:23:42 PM
It might be possible to use gotoroom(x,y) with nearly identical rooms to make the tiles animate. If you had a WHOLE BUNCH OF ROOMS you could even emulate the color changing!
Unfortunately,
A) I don't WANT the colo(u)r changing,
B) that would take up too many rooms, and
C) gotoroom locks controls.

End of story.

A) You can do it without the color changing
B) True, and too many scripts too because you have to make separate ones for each room (unless you use moveplayer(x,y) in a right way)
C) No, it doesn't if you execute it right; does anyone know where that test level is where you can move normally while gotoroom constantly changes the room?

FIQ

#632
Let me rephrase.
You can do this. You cannot use gamestate 200 for it. You must use gotoroom() kinda like how you make scripts execute in the background. And an insame amount of rooms, even w/o color change (4 per room except for the green ones which require 16 IIRC). And an insame amount of scripts, which will hit the limit in no time unless you plan to do this for like 1 room.

That's what I meant with "not in practice".

Samario

#633
Rather annoying, but I'll live with it.
Thanks for your help!

Also, let's discuss createmetroidprime() now.

Fussmatte

no let's disciss createsupermetroid() cause it's better

allison

Quote from: Dav999 on May 25, 2013, 07:39:57 PM
C) No, it doesn't if you execute it right; does anyone know where that test level is where you can move normally while gotoroom constantly changes the room?

I don't remember where I posted it, but here it is again. By using the different tiles instead of different colors, you can get the animation. This would obviously have to be used sparingly.

Samario

Quote from: Doormat on May 26, 2013, 03:43:04 PM
no let's disciss createsupermetroid() cause it's better
Wasn't referring to the game, I was referring to the creature.

Samario

Quote from: crazyal02 on May 26, 2013, 03:47:32 PM
Quote from: Dav999 on May 25, 2013, 07:39:57 PM
C) No, it doesn't if you execute it right; does anyone know where that test level is where you can move normally while gotoroom constantly changes the room?

I don't remember where I posted it, but here it is again. By using the different tiles instead of different colors, you can get the animation. This would obviously have to be used sparingly.

Yeah, but how do you make A DOORWAY with this? Also - proof-of-concept of all instability tiles cycled through coming soon.

FIQ

Quote from: Samario on May 26, 2013, 06:05:59 PM
Quote from: crazyal02 on May 26, 2013, 03:47:32 PM
Quote from: Dav999 on May 25, 2013, 07:39:57 PM
C) No, it doesn't if you execute it right; does anyone know where that test level is where you can move normally while gotoroom constantly changes the room?

I don't remember where I posted it, but here it is again. By using the different tiles instead of different colors, you can get the animation. This would obviously have to be used sparingly.
Yeah, but how do you make A DOORWAY with this? Also - proof-of-concept of all instability tiles cycled through coming soon.
Make 3 scripts. One script for the most part of the room, one part near the exit, and one on the opposite side of the exit. The script at the exit turns on a flag, the "main" script turns it off, and the script on the opposite side checks if the flag is on. If it is, perform a roomchange with gotoroom().

Not sure if it would work, I haven't tested it but it should be doable. Keep in mind this is just theoretically, it isn't really feasible to do an actual level with animating tiles, unless it's like 1 room :P

Samario

Again, not sure if this is the right thread (but it sounds like int. scripting would be used for this...), but is there a way to make a timer that runs in the background (i.e. the player can control  :viridian: while the timer's going), then run a script when it runs out (kind of like the Metroid escape sequence(s) except without the timer)? For example:

Fillerfillerfiller
Code goes here
Fillerfillerfiller



say
TIME HAS RUN OUT.
say(-1)
text(1,0,0,4)
say(15)
hideplayer()
flash(30)
fadeout()
text(1,-1,50,1)
GAME OVER.
backgroundtext
speak
text(1,-1,70,1)
TRY AGAIN?
backgroundtext
speak
text(1,-1,90,1)
[YES]     NO
speak
text(1,0,0,4)
say(4)
endtext
endcutscene()
untilbars()
loadscript(stop)


FIQ

Yes, you can!
But it's quite awkward and requires use of the script backgrounding technique. This in turn requires the room to have no kind of animations (enemies, platforms, conveyors) and the script can only run in that specific room, unless you use some complex tricks which makes everything even more awkward.

Samario

Quote from: FIQ on May 30, 2013, 06:22:08 PM
Yes, you can!
But it's quite awkward and requires use of the script backgrounding technique. This in turn requires the room to have no kind of animations (enemies, platforms, conveyors) and the script can only run in that specific room, unless you use some complex tricks which makes everything even more awkward.

Well? What's the code?

FIQ

Quote from: Samario on May 31, 2013, 08:11:19 AM
Quote from: FIQ on May 30, 2013, 06:22:08 PM
Yes, you can!
But it's quite awkward and requires use of the script backgrounding technique. This in turn requires the room to have no kind of animations (enemies, platforms, conveyors) and the script can only run in that specific room, unless you use some complex tricks which makes everything even more awkward.

Well? What's the code?
Well, I said it was awkward, but you asked for it.

Background scripts executes one per tick. 30 tick is approximately 1s. Say you want it to execute for 10 seconds. I would do it like this:
Set away 5 flags to use as a binary counter before executing a full second, say flag 1-5 for the second ticker. I have 2 choices - a more complex script to make it truly 1s, or to make it 2 ticks slower. Depending on the use case, I probably do the latter.
For the actual seconds, I set away 4 flags as the second counter, say flag 6-9. I also set away a flag for noting that the counter has started, say flag 10. I also use a flag to stop the counter, say 11.
I then do scripts that execute gotoroom(X,Y) where X,Y is the room the script is in. This will make the same script trigger again immediately once it's done executing -- but it wont halt your movement. The actual script looks something like this:
(# TEXT for comments, those aren't included in the script, but it's for explaining what I'm doing)

The actual code is below. Keep in mind I haven't tested it, so there might be typos and I might have thought wrong at some points.

counter_load:
ifflag(11,stop)
iftrinkets(0,counter) # load internal script

counter:
say(5) # this is one of the few needed internal scripts
gotoroom(0,0) # allow "script backgrounding"
customifflag(5,counter5) # increase counter of flag 5
customifflag(10,counter_started) # check if it has started at all
flag(10,on) # it hasn't
text(1,0,0,4)
say(5) # text
text(gray,-1,30,1)
Counter
backgroundtext
speak
text(1,0,0,4)
say(5)
text(red,-1,90,1)
10
backgroundtext
speak
text(1,0,0,4)
say(5) # set the flags to their current time, making it output 9 once a full second pass
flag(6,on)
flag(7,off)
flag(8,off)
flag(9,on)
loadscript(stop)
text(1,0,0,4)

counter_started:
flag(5,on)
delay(0)

counter5:
flag(5,off) # Do the splitsecond counter
ifflag(4,counter4)
flag(4,on)
delay(0) # those are needed to prevent a bug in VVVVVV

counter4:
flag(4,off)
ifflag(3,counter3)
flag(3,on)
delay(0)

counter3:
flag(3,off)
ifflag(2,counter2)
flag(2,on)
delay(0)

counter2:
flag(2,off)
ifflag(2,counter1)
flag(1,on)
delay(0)

counter1:
flag(1,off)
ifflag(1,counter_full0000) # trigger a second, check at the very bottom
delay(0)

# The full counters, sorted by when they occur (in practice). The first part which doesn't exist for odd numbers are continuing branching to other seconds, simulating integers. The second part sets the flags applied for the incoming second. The third part is actual output. While I could merge part 1 and 2 under the same text(1,0,0,4) part in some cirumstances, I didn't, to make it more understandable.

counter_full1001:
say(2)
flag(9,off)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
09
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full1000:
say(2)
customifflag(9,counter_full1001)
text(1,0,0,4)
say(5)
flag(6,off)
flag(7,on)
flag(8,on)
flag(9,on)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
08
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0111:
say(2)
flag(9,off)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
07
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0110:
say(3)
customifflag(9,counter_full0111)
text(1,0,0,4)
say(3)
flag(8,off)
flag(9,on)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
06
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0101:
say(2)
flag(9,off)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
05
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0100:
say(3)
customifflag(8,counter_full0110)
customifflag(9,counter_full0101)
text(1,0,0,4)
say(4)
flag(7,off)
flag(8,on)
flag(9,on)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
04
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0011:
say(2)
flag(9,off)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
03
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0010:
say(2)
customifflag(9,counter_full0011)
text(1,0,0,4)
say(3)
flag(8,off)
flag(9,on)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
02
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0001:
say(2)
flag(9,off)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
01
backgroundtext
speak
loadscript(stop)
text(1,0,0,4)

counter_full0000:
say(5)
customifflag(6,counter_full1000) # those are different states of flags
customifflag(7,counter_full0100)
customifflag(8,counter_full0010)
customifflag(9,counter_full0001)
text(1,0,0,4)
say(5)
text(red,-1,90,1)
00
backgroundtext
speak
text(1,0,0,4)
say(2)
flag(11,on) # stop the script
loadscript(stop)
text(1,0,0,4)

Lollipop

Bump so that it'll appear on the front page (for a while)

i don't use this site anymore, please don't look at my posts