Internal commands

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

Previous topic - Next topic

Dav999

Quote from: FIQ on November 15, 2012, 10:25:07 PM
Quote from: Dav999 on November 15, 2012, 07:08:04 PM
I wanted to use moveplayer(x,y), but it doesn't seem to work when I use A)Say :( A level I want to make really depends on it working that way, I just can't do it in the say(-1) way. :victoria:
Sounds really odd. I'm speechless to be honest, but I knew there was a possibility of something like this as the fact that the weird method of doing internal scripting works at all is odd. I can try to look how moveplayer() really works (internally) for any clue, but have you considered using gotoposition() instead?

I can't do that, I really need to move :viridian: relative to his current position, I can't just fill every single room with an awful lot of scripts (separate scripts for each possible combination of x-coordinates and y-coordinates. In nearly 400 rooms.)

I'm trying to make a tower level, and I figured it would work if I teleport :viridian: 320 pixels to the right and some pixels down to go to the next room each time, where the walls are always lowered one block. If I do that, I don't need many scripts (I can just reuse the script in every room, and another script for moving to the next row). Gotoroom isn't an option, because :viridian: would get stuck in walls, and even if I used gotoposition, I would still need separate scripts for each combination of x-coordinates and y-coordinates, in nearly 400 rooms, and it would lag as hell. It already lags if I use the traditional say(-1) method, so I really need to do it the A)Say way.

blue626

I've been testing using methods A and C mentioned earlier and also the new method, though I first tested without delay(0) (I forgot about it). I also tested move player to see if it had similar glitches to gotoposition.

I used move player(10,0) with method A.
Result: A grey centered text box with "costumposition..." appeared. I forgot to check if it worked or not. :-X Why did the text box appear?

I used it with method C
Result: It worked normally, no text box, :viridian: was teleported to the right (probably 10 pixels).

I wrote this:

script1:
iftrinkets(0,script1a)

script1a:
A)Say
gotoposition(0,0)
(empty line)

Result: The glitch that happened when I used gotoposition with method A happened. I noticed that when :viridian: touches a vertical grav. line, neither his/her image nor the gravity direction doesn't change and when he/she touches the 2nd time, his/her behavior turns back to normal (his/her feet pointing down when gravity is down and vice-versa and he/she can flip).

I wrote this:

script1:
iftrinkets(0,script1a)

script1a:
A)Say
moveplayer(10,0)
(empty line)

Result: Nothing happened!

I later wrote delay(0) in the line before A)Say and tested both of the previous 2 scripts. They both worked the same as without delay(0)!


FIQ, why did you try "A)Say" instead of (for example) "ASay"?

I wrote this:

script1:
iftrinkets(0,script1a)

script1a:
delay(0)
ASay
changeplayercolour(red)
(empty line)

Result: Worked normally, :viridian: turned into :vermillion: immediately and it could move, flip, etc. (though I didn't test dying, he should turn back to :viridian: then).

I replaced changeplayercolour(red) with play(13)

Result: It worked normally. Pacing Energy started playing immediately.

I replaced ASay with A)Say and then tested both of the previous 2 scripts.

Result: They both worked the same way as with ASay.

So, "ASay" works fine.

FIQ

So basically the ")" is useless and the only thing needed here is something before "Say"? Interesting! Does "Say" work too without anything before it or doesn't it? (Can't try it by myself atm)

ToasterApocalypse

Try this.

say(-1,crewmatename)

Hides the terminal sound and squeaks a crewmate. I didn't really know I could until recently. Pretty good if text is the first command.

Dav999

Quote from: ToasterApocalypse on November 19, 2012, 03:52:11 PM
Try this.

say(-1,crewmatename)

Hides the terminal sound and squeaks a crewmate. I didn't really know I could until recently. Pretty good if text is the first command.

Yeah, but that's 2.1 only.

ToasterApocalypse

Quote from: Dav999 on November 19, 2012, 06:00:37 PM
Quote from: ToasterApocalypse on November 19, 2012, 03:52:11 PM
Try this.

say(-1,crewmatename)

Hides the terminal sound and squeaks a crewmate. I didn't really know I could until recently. Pretty good if text is the first command.

Yeah, but that's 2.1 only.

It still activates the internal scripting code, right?

Dav999

Quote from: ToasterApocalypse on November 19, 2012, 06:32:58 PM
Quote from: Dav999 on November 19, 2012, 06:00:37 PM
Quote from: ToasterApocalypse on November 19, 2012, 03:52:11 PM
Try this.

say(-1,crewmatename)

Hides the terminal sound and squeaks a crewmate. I didn't really know I could until recently. Pretty good if text is the first command.

Yeah, but that's 2.1 only.

It still activates the internal scripting code, right?

Yes, I thought so. But 2.0 users will still hear a terminal.

ToasterApocalypse

Quote from: Dav999 on November 19, 2012, 06:44:12 PM
Quote from: ToasterApocalypse on November 19, 2012, 06:32:58 PM
Quote from: Dav999 on November 19, 2012, 06:00:37 PM
Quote from: ToasterApocalypse on November 19, 2012, 03:52:11 PM
Try this.

say(-1,crewmatename)

Hides the terminal sound and squeaks a crewmate. I didn't really know I could until recently. Pretty good if text is the first command.

Yeah, but that's 2.1 only.

It still activates the internal scripting code, right?

Yes, I thought so. But 2.0 users will still hear a terminal.

Ok, that's good.

blue626

#398
Quote from: FIQ on November 15, 2012, 10:30:46 PM
Quote from: ToasterApocalypse on November 15, 2012, 10:27:42 PM
Quote from: FIQ on November 15, 2012, 10:25:07 PM
Quote from: Dav999 on March 20, 1974, 10:14:44 AM
I wanted to use moveplayer(x,y), but it doesn't seem to work when I use A)Say :( A level I want to make really depends on it working that way, I just can't do it in the say(-1) way. :victoria:
Sounds really odd. I'm speechless to be honest, but I knew there was a possibility of something like this as the fact that the weird method of doing internal scripting works at all is odd. I can try to look how moveplayer() really works (internally) for any clue, but have you considered using gotoposition() instead?

Quote from: FIQ
gotoposition() occasionally doesn't work properly unless it's right after a gotoroom() command.

  ???
Unless you use the third parameter. Dav999 told this but I was slow to realize :p

??? When I tested it (tests mentioned in reply 334) without the 3rd parameter it worked fine (referring to method C)!

EDIT: When I triggered the script :viridian: wasn't flipped and after being teleported he/she wasn't flipped. I didn't try triggering the script when flipped, though.

ToasterApocalypse

Quote from: blue626 on November 20, 2012, 07:44:35 PM
Quote from: FIQ on November 15, 2012, 10:30:46 PM
Quote from: ToasterApocalypse on November 15, 2012, 10:27:42 PM
Quote from: FIQ on November 15, 2012, 10:25:07 PM
Quote from: Dav999 on March 20, 1974, 10:14:44 AM
I wanted to use moveplayer(x,y), but it doesn't seem to work when I use A)Say :( A level I want to make really depends on it working that way, I just can't do it in the say(-1) way. :victoria:
Sounds really odd. I'm speechless to be honest, but I knew there was a possibility of something like this as the fact that the weird method of doing internal scripting works at all is odd. I can try to look how moveplayer() really works (internally) for any clue, but have you considered using gotoposition() instead?

Quote from: FIQ
gotoposition() occasionally doesn't work properly unless it's right after a gotoroom() command.

  ???
Unless you use the third parameter. Dav999 told this but I was slow to realize :p

??? When I tested it (tests mentioned in reply 334) without the 3rd parameter it worked fine (referring to method C)!

EDIT: When I triggered the script :viridian: wasn't flipped and after being teleported he/she wasn't flipped. I didn't try triggering the script when flipped, though.

So, if gotoposition works I can make portals?

If I can...


AWWWWWWWWWWWWWWWWWWYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

Dav999

I'd actually recommend to use the internal commands the way they were meant to work, that means using the third argument too. I've never really had any problem with gotoposition(x,x), but in the scripts of the main game, the third argument is always used. Same with playef(x,10). I still haven't figured out what the second argument is for. :-\

FIQ

Quote from: Dav999 on November 20, 2012, 09:43:19 PM
I'd actually recommend to use the internal commands the way they were meant to work, that means using the third argument too. I've never really had any problem with gotoposition(x,x), but in the scripts of the main game, the third argument is always used. Same with playef(x,10). I still haven't figured out what the second argument is for. :-\
Ask Terry and hope he answers. :p

Toaster: gotoposition() w/o 3rd parameter behaves incorrectly in some cases.

ToasterApocalypse

I got bored and destroyed my telesave by creating a teleporter at co-ordinates: (10,20)
I got stuck in a wall at the end of the tower  :viridian:

Quote from: FIQ on November 20, 2012, 09:58:30 PM
Toaster: gotoposition() w/o 3rd parameter behaves incorrectly in some cases.

But with the third parameter? Does it work then?

FIQ

Quote from: ToasterApocalypse on November 21, 2012, 03:02:58 PM
I got bored and destroyed my telesave by creating a teleporter at co-ordinates: (10,20)
I got stuck in a wall at the end of the tower  :viridian:

Quote from: FIQ on November 20, 2012, 09:58:30 PM
Toaster: gotoposition() w/o 3rd parameter behaves incorrectly in some cases.

But with the third parameter? Does it work then?
It should behave correctly then.

FIQ

#404
I played around to find a way to get the information of what the parser translate strings too, to confirm the list I gave earlier. Basically, what I did was the "opposite" way of doing an internal script -- instead of tricking the parser that I'm going to say something and allow execution of code in say(), I instead tricked the parser that the following simplified script will be executed while in fact being part of a say command

The code looks like this:

say(-1)
text(1,0,0,N+5)
(Simplified command to test)
say(5)
speak_active
endtext
endcutscene
untilbars
loadscript(stop)

N here is the amount of lines the translated string from simplified to internal scripting. flash, for example, is 3 lines (flash(5)|shake(20)|playef(9,10)), and thus N should be 3, and 3+5 is 8, so the line should be text(1,0,0,8).
Do note that you cannot test say() and reply() properly as the commands work with lines below. Also, I bet squeak(on|off) can't be tested also, as that's functionality that doesn't exist internally, but is executed from the parser itself.

This can be used to see what the parser does when it get bogus stuff (it *should* ignore it, but obviously doesn't always do it -- the internal-scripting-without-cutscenes method shows this).

This shows, for example, that the 2.1 squeak() command, which seems to be parsed differently from most other stuff, *ignores* unknown parameters and remove the command completely, instead of, like music(), sends the parameter to play() as-is.