Author Topic: Internal commands  (Read 257670 times)

Samario

  • Crewmate
  • **
  • Posts: 39
  • Current Projects: The Tower, VVVVVV 4
    • View Profile
Re: Internal commands
« Reply #630 on: May 25, 2013, 12:29:24 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

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Internal commands
« Reply #631 on: May 25, 2013, 12:39:57 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

  • Captain
  • *****
  • Posts: 810
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #632 on: May 25, 2013, 12:58:59 PM »
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".
« Last Edit: May 25, 2013, 01:00:32 PM by FIQ »

Samario

  • Crewmate
  • **
  • Posts: 39
  • Current Projects: The Tower, VVVVVV 4
    • View Profile
Re: Internal commands
« Reply #633 on: May 25, 2013, 02:38:35 PM »
Rather annoying, but I'll live with it.
Thanks for your help!

Also, let's discuss createmetroidprime() now.
« Last Edit: May 26, 2013, 04:19:04 AM by Samario »

Hejmstel

  • Captain
  • *****
  • Posts: 502
  • Formerly "Doormat"
    • View Profile
    • My hardly used YT account
Re: Internal commands
« Reply #634 on: May 26, 2013, 08:43:04 AM »
no let's disciss createsupermetroid() cause it's better

allison

  • Captain
  • *****
  • Posts: 924
  • monolithic since 2012??
    • View Profile
    • Allison Fleischer
Re: Internal commands
« Reply #635 on: May 26, 2013, 08:47:32 AM »
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

  • Crewmate
  • **
  • Posts: 39
  • Current Projects: The Tower, VVVVVV 4
    • View Profile
Re: Internal commands
« Reply #636 on: May 26, 2013, 10:16:35 AM »
no let's disciss createsupermetroid() cause it's better
Wasn't referring to the game, I was referring to the creature.

Samario

  • Crewmate
  • **
  • Posts: 39
  • Current Projects: The Tower, VVVVVV 4
    • View Profile
Re: Internal commands
« Reply #637 on: May 26, 2013, 11:05:59 AM »
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

  • Captain
  • *****
  • Posts: 810
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #638 on: May 28, 2013, 05:33:17 AM »
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

  • Crewmate
  • **
  • Posts: 39
  • Current Projects: The Tower, VVVVVV 4
    • View Profile
Re: Internal commands
« Reply #639 on: May 30, 2013, 10:00:17 AM »
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:

Code: [Select]
Fillerfillerfiller
Code goes here
Fillerfillerfiller

Code: [Select]
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

  • Captain
  • *****
  • Posts: 810
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #640 on: May 30, 2013, 11:22:08 AM »
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

  • Crewmate
  • **
  • Posts: 39
  • Current Projects: The Tower, VVVVVV 4
    • View Profile
Re: Internal commands
« Reply #641 on: May 31, 2013, 01:11:19 AM »
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

  • Captain
  • *****
  • Posts: 810
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #642 on: May 31, 2013, 10:35:47 AM »
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.

Code: [Select]
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

  • Captain
  • *****
  • Posts: 419
  • fornite funnys
    • View Profile
Re: Internal commands
« Reply #643 on: April 10, 2016, 07:03:04 PM »
Bump so that it'll appear on the front page (for a while)

Starspire

  • Developer of Deprimerie: STORM of the Future
  • Global Moderator
  • Captain
  • *****
  • Posts: 682
  • Play Persona 3
    • View Profile
Re: Internal commands
« Reply #644 on: April 10, 2016, 07:05:13 PM »
Stickehd