Author Topic: Ifflag/destroy commands not working right?  (Read 5647 times)

ToasterApocalypse

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Ifflag/destroy commands not working right?
« on: July 26, 2012, 03:26:54 PM »
So I was making a level (With internal scripting, yay) and then I found that destroy() and ifflags don't work.

what do

Hilbert

  • Captain
  • *****
  • Posts: 574
  • Yup. This is my name. Not Black, Hilbert.
    • View Profile
Re: Ifflag/destroy commands not working right?
« Reply #1 on: July 26, 2012, 03:29:48 PM »
I dunno about destroy, but or ifflag you have to use
Code: [Select]
customifflag(???,???) (I think...)

Dav999

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Ifflag/destroy commands not working right?
« Reply #2 on: July 26, 2012, 03:34:42 PM »
Not all of the simplified commands work in internal scripting, I don't think any gravity lines or warp tokens are destroyed in the real game.
And AFAIK, if you refer to a script in internal scripting, it loads a built-in script, and I think it also works with flags from the real game.

ToasterApocalypse

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Ifflag/destroy commands not working right?
« Reply #3 on: July 26, 2012, 03:47:49 PM »
Not all of the simplified commands work in internal scripting, I don't think any gravity lines or warp tokens are destroyed in the real game.
And AFAIK, if you refer to a script in internal scripting, it loads a built-in script, and I think it also works with flags from the real game.

Oh ok. I don't think I can create a warp gate then.

I like how internal scripts won't even work anymore now.

Dav999

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Ifflag/destroy commands not working right?
« Reply #4 on: July 26, 2012, 04:06:58 PM »
You can create a warp gate, you just have to stop the internal code without using loadscript(stop) and without dialog rubbish, so something like this:

Code: [Select]
say(-1)
text(1,0,0,4)
say(5)
text(gray,0,0,1)
Text box 1.
position(center)
speak_active
text(1,0,0,4)
say(3)
text(gray,0,0,2)
The warp tokens will
now be destroyed.
destroy(warptokens)
say(-1)
text(1,0,0,4)
say(5)
Etc.

You won't need position(x) and speak_active for the last text box, because it's already put at the end of the say command. And if you don't want to use a text box at all in that script, and you can't put it at the very beginning, then I don't know... But there should be a way.

EDIT: maybe you can use gotoroom(x,x) to teleport to a similar room in which the walls are destroyed or something like that.
« Last Edit: July 26, 2012, 04:11:12 PM by Dav999 »

blue626

  • Captain
  • *****
  • Posts: 672
  • I changed my avatar!
    • View Profile
Re: Ifflag/destroy commands not working right?
« Reply #5 on: July 26, 2012, 04:19:51 PM »
I don't think any gravity lines or warp tokens are destroyed in the real game.

After you complete the Gravitron, the bottom line is destroyed.

Btw: I suspect that when :viridian: enters the Gravitron, a script is started, and it's similar to this:

hascontrol()
(command to create upper grav. line)
(Gravitron command)

delay(1800)
destroy((the lower grav. line))

The facts that some people here know about internal scripting, that some (like me) learn something about it from those people and that some make levels with that scripting are interesting.
EDIT: I'm not going to make a level with internal scripting, though.
« Last Edit: July 26, 2012, 04:23:01 PM by blue626 »

Dav999

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Ifflag/destroy commands not working right?
« Reply #6 on: July 26, 2012, 04:36:20 PM »
I don't think any gravity lines or warp tokens are destroyed in the real game.

After you complete the Gravitron, the bottom line is destroyed.

Btw: I suspect that when :viridian: enters the Gravitron, a script is started, and it's similar to this:

hascontrol()
(command to create upper grav. line)
(Gravitron command)

delay(1800)
destroy((the lower grav. line))

The facts that some people here know about internal scripting, that some (like me) learn something about it from those people and that some make levels with that scripting are interesting.

The gravitron is activated by a gamestate, and the lower gravity line is destroyed in another way than how they are destroyed in custom levels. In the gravitron it disappears from left to right, in custom levels it disappears immediately.
And I'm sure it doesn't use delay(1800), because then it would disappear 60 seconds after the gravitron is started, so if you die, it doesn't disappear when it should; that means when the timer reaches 0.
But I get the idea. It has to be programmed somewhere. (and if it's hardcoded in, then it just won't work without using simplified scripting. I would use simplified scripting in this case)

FIQ

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Ifflag/destroy commands not working right?
« Reply #7 on: July 27, 2012, 09:27:50 AM »
I don't think any gravity lines or warp tokens are destroyed in the real game.

After you complete the Gravitron, the bottom line is destroyed.

Btw: I suspect that when :viridian: enters the Gravitron, a script is started, and it's similar to this:

hascontrol()
(command to create upper grav. line)
(Gravitron command)

delay(1800)
destroy((the lower grav. line))

The facts that some people here know about internal scripting, that some (like me) learn something about it from those people and that some make levels with that scripting are interesting.

The gravitron is activated by a gamestate, and the lower gravity line is destroyed in another way than how they are destroyed in custom levels. In the gravitron it disappears from left to right, in custom levels it disappears immediately.
And I'm sure it doesn't use delay(1800), because then it would disappear 60 seconds after the gravitron is started, so if you die, it doesn't disappear when it should; that means when the timer reaches 0.
But I get the idea. It has to be programmed somewhere. (and if it's hardcoded in, then it just won't work without using simplified scripting. I would use simplified scripting in this case)
destroy() works just fine in the internal scripting scope, even though it's never used (Face this - the simplified scripting is converted to internal scripting by the parser - this is why you can access internal scripting at all by tricking it. This means that destroy() is converted to something internally - in this case, simply destroy()). Make sure that you're calling the script with the right command, i.e. customifflag(), not ifflag(). This is your problem I think.

The Gravitron uses gamestates (as stated). Gamestates calls specific hard-coded functions that Terry has programmed manually, outside of scripting scope. This is why gamestates allow "custom" things to happen w/o stopping Viridian (as usual scripts do).

Also, Stalefish was the first that discovered that you could access internal scripting in 2.0, I discovered a new method of doing it in both 2.0 and 2.1, and used it in my level and provided some examples in the forum - which I think kinda started the trend of people playing with it :p

ToasterApocalypse

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Ifflag/destroy commands not working right?
« Reply #8 on: July 27, 2012, 09:30:06 AM »
I don't think any gravity lines or warp tokens are destroyed in the real game.

After you complete the Gravitron, the bottom line is destroyed.

Btw: I suspect that when :viridian: enters the Gravitron, a script is started, and it's similar to this:

hascontrol()
(command to create upper grav. line)
(Gravitron command)

delay(1800)
destroy((the lower grav. line))

The facts that some people here know about internal scripting, that some (like me) learn something about it from those people and that some make levels with that scripting are interesting.

The gravitron is activated by a gamestate, and the lower gravity line is destroyed in another way than how they are destroyed in custom levels. In the gravitron it disappears from left to right, in custom levels it disappears immediately.
And I'm sure it doesn't use delay(1800), because then it would disappear 60 seconds after the gravitron is started, so if you die, it doesn't disappear when it should; that means when the timer reaches 0.
But I get the idea. It has to be programmed somewhere. (and if it's hardcoded in, then it just won't work without using simplified scripting. I would use simplified scripting in this case)
destroy() works just fine in the internal scripting scope, even though it's never used (Face this - the simplified scripting is converted to internal scripting by the parser - this is why you can access internal scripting at all by tricking it. This means that destroy() is converted to something internally - in this case, simply destroy()). Make sure that you're calling the script with the right command, i.e. customifflag(), not ifflag(). This is your problem I think.

The Gravitron uses gamestates (as stated). Gamestates calls specific hard-coded functions that Terry has programmed manually, outside of scripting scope. This is why gamestates allow "custom" things to happen w/o stopping Viridian (as usual scripts do).

Also, Stalefish was the first that discovered that you could access internal scripting in 2.0, I discovered a new method of doing it in both 2.0 and 2.1, and used it in my level and provided some examples in the forum - which I think kinda started the trend of people playing with it :p

So the timeline of internal scripting

Terry-Stalefish-You-Afewotherpeople

Dav999

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Ifflag/destroy commands not working right?
« Reply #9 on: July 27, 2012, 10:12:27 AM »
I tested the destroy(x) command in internal scripting, and everything seemed to work like it does using simplified scripting. destroy(gravitylines) destroys gravity lines, destroy(warptokens) destroys warp tokens, and destroy(platforms), well, stops moving platforms and makes them invisible.

blue626

  • Captain
  • *****
  • Posts: 672
  • I changed my avatar!
    • View Profile
Re: Ifflag/destroy commands not working right?
« Reply #10 on: July 28, 2012, 05:37:01 AM »
In the gravitron it disappears from left to right, in custom levels it disappears immediately.
And I'm sure it doesn't use delay(1800), because then it would disappear 60 seconds after the gravitron is started, so if you die, it doesn't disappear when it should; that means when the timer reaches 0.

In the graviton it disappears immediately, I think. I will check that. The upper line appears from left to right, you might have confused those two actions.

So the timeline of internal scripting

Terry-Stalefish-You-Afewotherpeople

Stalefish only found how to make coloured text. He/she also taught other people.

EDIT: One of those, PJBottomz, found how to do the other things internal scripting can do, like changing the player's color, make a crewmate follow :viridian: (but not exactly like Int. 1, and it only works on :vermillion:) and play as VVVVVVMan (spoiler: the combined person)
« Last Edit: July 28, 2012, 06:13:25 AM by blue626 »

Dav999

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Ifflag/destroy commands not working right?
« Reply #11 on: July 28, 2012, 06:28:00 AM »
In the gravitron it disappears from left to right, in custom levels it disappears immediately.
And I'm sure it doesn't use delay(1800), because then it would disappear 60 seconds after the gravitron is started, so if you die, it doesn't disappear when it should; that means when the timer reaches 0.

In the graviton it disappears immediately, I think. I will check that. The upper line appears from left to right, you might have confused those two actions.

I just checked it, and it does disappear from left to right, so it doesn't disappear immediately.

So the timeline of internal scripting

Terry-Stalefish-You-Afewotherpeople

Stalefish only found how to make coloured text. He/she also taught other people.

EDIT: One of those, PJBottomz, found how to do the other things internal scripting can do, like changing the player's color, make a crewmate follow :viridian: (but not exactly like Int. 1, and it only works on :vermillion:) and play as VVVVVVMan (spoiler: the combined person)

I also played with internal scripting after Stalefish found it out, and I wanted to use the alarm in my level, so I searched for 'alarm' in the binary, and found 'alarmon' and 'alarmoff'. But that was one year ago, and I never released levels at that time (because I just read the forum, and I didn't make an account on the forum yet.) The levels I made at that time were just because I wanted to use the level editor, without actually releasing the levels.

ToasterApocalypse

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Ifflag/destroy commands not working right?
« Reply #12 on: July 28, 2012, 07:03:42 AM »
When I change  :viridian:'s colour to, say  :vermillion: using changecolour.

But when he dies,  :vermillion: becomes  :viridian: again.

Dav999

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Ifflag/destroy commands not working right?
« Reply #13 on: July 28, 2012, 07:11:53 AM »
When I change  :viridian:'s colour to, say  :vermillion: using changecolour.

But when he dies,  :vermillion: becomes  :viridian: again.

I also noticed that, and that's why it isn't possible to die where I use that in my new level!

blue626

  • Captain
  • *****
  • Posts: 672
  • I changed my avatar!
    • View Profile
Re: Ifflag/destroy commands not working right?
« Reply #14 on: July 28, 2012, 11:33:30 AM »

In the graviton it disappears immediately, I think. I will check that. The upper line appears from left to right, you might have confused those two actions.

I just checked it, and it does disappear from left to right, so it doesn't disappear immediately.

I was wrong, then.
Also, I fixed the script above (that I wrote) and added some commands:

hascontrol()
music(2)
Command to create upper gravity line from left to right
gamestate(Gravitron number)
destroy(lower gravity line from left to right)
music(6)

If you know what to write where I wrote in italic, you know how to create a Gravitron in a user level! I suppose that the gamestate command creates the timer too, am I right? Does it delay the next actions to when timer reaches 0,00? If no, then it needs something else...
The music commands should work, if you really can use simplified scripting next to internal scripting, like you said. Of course, you don't need to change music, change it twice or change exactly to those songs; but those are the ones that are changed in the main game, in the Gravitron.