changing K & L values - possible?

General discussion about Celestia that doesn't fit into other forums.
Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

changing K & L values - possible?

Post #1by bongox » 20.08.2006, 20:23

Is it possible to change the amount of time ratio that is increased and decreased by the k& l keys?
I find that there is too much acceleration of time between each key press, and would like to be more specific with it.

Is there a script adjustment to make, to an .ssc file or something?
I appreciate anyone's advice.
Thanks

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #2by Christophe » 20.08.2006, 21:00

No, this is not adjustable.

You have to recompile to change that, see variable timeScaleFactor line 52 of celestiacore.cpp.
Christophe

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #3by bongox » 20.08.2006, 23:04

Thanks for that!

Is it hard to recompile?
thanks :)

phoenix
Posts: 214
Joined: 18.06.2002
With us: 22 years 5 months
Location: Germany - Berlin

Post #4by phoenix » 20.08.2006, 23:24

line 51 is also of interest ;)

for compiling:
http://celestiaproject.net/forum/viewtopic.php?t=6255
most recent celestia win32-SVN-build - use at your own risk (copy over existing 1.5.1 release)

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #5by bongox » 20.08.2006, 23:29

AWESOME! Thanks a lot! :)

bdm
Posts: 461
Joined: 22.07.2005
With us: 19 years 4 months
Location: Australia

Post #6by bdm » 21.08.2006, 04:18

You can set different values using a script.

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #7by bongox » 22.08.2006, 01:20

A script would be the only way for me it seems, I have Win98, and can't run some of the software nessessary for a recompile.
Any suggestions where or how to make one?
Thanks for your help.

bdm
Posts: 461
Joined: 22.07.2005
With us: 19 years 4 months
Location: Australia

Post #8by bdm » 22.08.2006, 02:07

I don't know much about the finer points of creating and executing CEL scripts. I just happen to have one handy so I can tell you this.

You can use a .CEL script, and the timerate parameter controls the time rate.

After the script executes, I think the timerate that was running remains in place.

Here is a sample .CEL script:

Code: Select all

  timerate     {rate 1}
  time         { utc "2987-10-01T00:00:00.0000" }

The number next to "rate" is what you need to change.

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #9by bongox » 22.08.2006, 02:53

After the script executes, I think the timerate that was running remains in place.

THANKS, man! You saved me a lot of trouble. I'll see about writing a script with those parameters.
All Hail The HypnoToad!

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #10by bongox » 22.08.2006, 02:56

But will it affect the amount of time scale acceleration? That is what I'm hoping to do, to change that rate from 10x times to 5x. Thanks!

bdm
Posts: 461
Joined: 22.07.2005
With us: 19 years 4 months
Location: Australia

Post #11by bdm » 22.08.2006, 06:00

bongox wrote:But will it affect the amount of time scale acceleration? That is what I'm hoping to do, to change that rate from 10x times to 5x. Thanks!

I don't think that's possible without modifying the Celestia code.

You could modify the constant in the source as described by others and then recompile.

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #12by bongox » 22.08.2006, 13:39

Thanks. One of these years ill upgrade from Win98,and I'll recompile my dear Celestia.

Thanks for all your advice everyone!

:)

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

Post #13by hank » 22.08.2006, 18:02

bongox wrote:But will it affect the amount of time scale acceleration? That is what I'm hoping to do, to change that rate from 10x times to 5x. Thanks!

You can do this easily with a CELX (Lua) script.

Look here for an explanation of how to write a CELX script that redefines Celestia keys. With this technique, you simply define Lua functions for changing the time rate by the factor you prefer and assign them in the keymap to the appropriate keys.

The script would look something like this:

Code: Select all

inctimescale =
   function()
      celestia:settimescale(celestia:gettimescale()*5);
   end

dectimescale =
   function()
      celestia:settimescale(celestia:gettimescale()/5);
   end

keymap = {
   k = dectimescale;
   l = inctimescale;
}

celestia_keyboard_callback =
   function(key)
      f = keymap[key]
      if f then
         f()
         return true
      end
         return false
   end

celestia:requestkeyboard(true)
  repeat
      wait()
  until false



- Hank

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #14by bongox » 22.08.2006, 20:50

OMG, Thanks, Hank!!
I better learn the scripting method so I can use this feature! I'm attempting this procedure so that I can capture movie loops for my short films, and I still have a bit to learn about scripting code. I'm sure I'll be able to follow the wiki instructions.

All Hail The...HANK!
:D

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #15by bongox » 22.08.2006, 21:14

WOW, OMG, IT WORKS! IT WORKS, it works, it works, it WORKS!
Ah, nice one Hank, there's thinking outta the box!
Now that I know what and where it is and can change the values, oh, this is great!
Thanks again Hank, Bdm, Phoenix & Christophe! You are all very kind to help.

PS:Should I post here a short film link in a week or so, that allows you to see the product of your advice? If you like, I will.

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #16by bongox » 24.08.2006, 03:59

This is amazing. I have created another script for a factor of 3x as well.

I can see the organization, but I can't find the syntax... now I'm attempting the same technique but with the 'home' and 'end' keys to change zoom in and out factors.
Sorry to ask. Thanks.

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

Post #17by hank » 24.08.2006, 16:12

bongox wrote:This is amazing. I have created another script for a factor of 3x as well.

I can see the organization, but I can't find the syntax... now I'm attempting the same technique but with the 'home' and 'end' keys to change zoom in and out factors.
Sorry to ask. Thanks.

I'm afraid this technique won't work with keys such as 'home' and 'end' that don't generate ascii characters. But you could assign the modified functions to a pair of ascii keys.

- Hank

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #18by bongox » 25.08.2006, 01:01

Thanks, Hank. Are you familiar with the syntax I need to change in order to adapt the existing script for time zoom ratio into one for camera zoom in & out ratios? Pleeeeeze? - I'll send you a nice peice of music...! Or show ya a cool animated movie, soon to incorporate stills and animations from Celestia... I'm logical, just an inexperienced coder.
Thanks for all your help :)

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

Post #19by hank » 31.08.2006, 19:37

bongox wrote:Thanks, Hank. Are you familiar with the syntax I need to change in order to adapt the existing script for time zoom ratio into one for camera zoom in & out ratios?

I'm afraid that what you want will require more than a simple syntax change.

The 'Home' and 'End' keys perform a "dolly" function, continuously changing the observer's position to move closer to or farther from the object. Here's a script that redefines the 'i' and 'o' keys to dolly in and out instantaneously by a specific factor relative to the current distance:

Code: Select all

dolly =
   function(dollyFactor)
      obs = celestia:getobserver();
      obsPos = obs:getposition();
      sel = celestia:getselection();
      if sel == nil or sel:name() == "?" then return end
      selPos = sel:getposition();
      relPos = selPos:vectorto(obsPos);
      newPos = selPos:addvector( relPos * dollyFactor );
      obs:setposition(newPos);
   end

dollyFactor = 0.9;

dollyin =
   function()
     celestia:flash("Dolly In", 0.5);
     dolly( dollyFactor );
   end
   
dollyout =
   function()
     celestia:flash("Dolly Out", 0.5);
     dolly( 1/dollyFactor );
   end
      
keymap =
   {
       i = dollyin;
       o = dollyout;
   }

celestia_keyboard_callback = function(key)
  f = keymap[key]
   if f then
     f()
      return true;
   end
   return false;
   end

celestia:requestkeyboard(true);

celestia:flash("dolly test", 2);
wait(2);
repeat
   wait(0);
until false;


That's probably not quite what you want, but it's a start.

- Hank

Topic author
bongox
Posts: 18
Joined: 30.03.2006
With us: 18 years 7 months

Post #20by bongox » 06.09.2006, 22:04

...Aarg, I can't get it to work. I haven't been able to figure out the problem yet.


Return to “Celestia Users”