Author Topic: Internal commands  (Read 260893 times)

Dav999

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Internal commands
« Reply #390 on: November 15, 2012, 03:05:06 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

  • Captain
  • *****
  • Posts: 672
  • I changed my avatar!
    • View Profile
Re: Internal commands
« Reply #391 on: November 16, 2012, 10:32:26 AM »
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

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #392 on: November 16, 2012, 01:26:46 PM »
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

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Internal commands
« Reply #393 on: November 19, 2012, 07:52:11 AM »
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

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Internal commands
« Reply #394 on: November 19, 2012, 10:00:37 AM »
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

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Internal commands
« Reply #395 on: November 19, 2012, 10:32:58 AM »
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

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Internal commands
« Reply #396 on: November 19, 2012, 10:44:12 AM »
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

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Internal commands
« Reply #397 on: November 19, 2012, 11:04:20 AM »
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

  • Captain
  • *****
  • Posts: 672
  • I changed my avatar!
    • View Profile
Re: Internal commands
« Reply #398 on: November 20, 2012, 11:44:35 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.
« Last Edit: November 20, 2012, 11:47:16 AM by blue626 »

ToasterApocalypse

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Internal commands
« Reply #399 on: November 20, 2012, 01:31:50 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?

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

  • Global Moderator
  • Captain
  • *****
  • Posts: 2173
    • View Profile
    • The Open Level Project
Re: Internal commands
« Reply #400 on: November 20, 2012, 01: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. :-\

FIQ

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #401 on: November 20, 2012, 01:58:30 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

  • Captain
  • *****
  • Posts: 1010
  • le lenny face
    • View Profile
Re: Internal commands
« Reply #402 on: November 21, 2012, 07:02:58 AM »
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:

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

But with the third parameter? Does it work then?

FIQ

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #403 on: November 21, 2012, 07:39:23 AM »
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:

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

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Internal commands
« Reply #404 on: November 21, 2012, 07:59:22 AM »
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.
« Last Edit: November 21, 2012, 08:06:48 AM by FIQ »