Page 1 of 1

Using change distance command in a cel script

Posted: 02.07.2017, 18:15
by fsgregs
Hi all:

I am writing a simple script to display some text on the screen while Celestia is flying through space. I have an old script that sends the program through space with the"changed distance" command. An example would be:

select { object "HIP 83266" }

changedistance { duration 15.0 rate -0.01 }
print { text " Live long and prosper\n\n \n\n " row -14 column 26}
wait { duration 10.0 }

The problem with the above set of commands is timing. The script begins the program flying toward HIP 83266 slowly over a 15 second duration ... THEN the fly-in stops and the program displays the text "Live long and prosper". What I want to do is display the text simultaneously, while the fly-in is occurring.

Can that be done either in a cel or celx script?

Thanks in advance
Frank

Using change distance command in a cel script

Posted: 02.07.2017, 22:27
by Goofy
Hi Frank.
Probably I misunderstood what you need, but if I didn't, this works as I understand you requested for:

Code: Select all

[color=#008040][b]{
select {object "Sol"}
goto {time 1.0 distance 50}
wait {duration 1}
center {}
follow {}
print { text "Live long and prosper" origin "topleft" duration 15 row 5 column 3}
changedistance { duration 15.0 rate 1.7 }
wait { duration 15.0 }
} [/b][/color]

Try it, hope it works for you.
Bye
Goofy :smile:

Posted: 02.07.2017, 22:42
by selden
As Goofy mentions, you might be able to fake it: use multiple "change distance" commands with the first going to some intermediate object that you've defined which is only part way to the final destination. The print statement could be in between the first and second changedistance commands, for example.

What is really needed is some kind of asynchronous event trigger which would cause the string to be emitted. I think it might be possible to do something like this from within a ScriptedOrbit or ScriptedRotation, but those declarations can only be used for SSC objects.

Lua (celx scripts) supports multitasking, but I dunno if it'll work within Celestia.

Posted: 03.07.2017, 09:39
by jogad
Your script is almost correct.

- You must follow the object before the changedistance command.
In the print command the text is displayed duration seconds but the next command is processed immediately.
You just have to invoque the printcommand before the changedistance command and specify the same duration.

Here is the working code :

Code: Select all

{
select { object "HIP 83266" }
follow{}
print { text " Live long and prosper\n\n \n\n " duration 15 row -14 column 26}
changedistance { duration 15.0 rate -0.01 }
}

Posted: 03.07.2017, 12:53
by fsgregs
Thanks guys for the reply. I can indeed print some text first, then start the program changing distance. I tried that and the print did occur, then the fly-in began, and nothing else happened on the screen until the fly-in was done. The print stayed on screen during the entire fly-in. It was sequential. What I meant to explain was my hope that there would be a way to display 4 or five text messages on a screen one after the other, while the fly-in is occurring. Sort of like the credits of a movie. The movie is playing in the background (the fly-in), while multiple credits appear on the screen in front of the moving scene one after the other. Both actions would have to be simultaneous.

I am hoping that we could use a "while / then" loop, or something like it. While a counter is counting or the changeddistance command is being executed, we can also print X, then print Y, then print Z, one after the other.

Is that possible in LUA?

Frank

Posted: 03.07.2017, 13:30
by jogad
I don't see any way to do that with only one changedistance instruction.
The simplest way is the one that Selden proposes : cut out the journey into several parts and display a text for each part.

Using change distance command in a cel script

Posted: 04.07.2017, 13:25
by Goofy
Hi Frank, try this cel script, it allows some text typing on the screen and changing text while action occurs.
May be it is what you wish.
Bye
Goofy :smile:

Tryme.rar
Little .cel script for text-on-screen variations
(744 Bytes) Downloaded 98 times