Page 1 of 2

changing K & L values - possible?

Posted: 20.08.2006, 20:23
by bongox
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

Posted: 20.08.2006, 21:00
by Christophe
No, this is not adjustable.

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

Posted: 20.08.2006, 23:04
by bongox
Thanks for that!

Is it hard to recompile?
thanks :)

Posted: 20.08.2006, 23:24
by phoenix
line 51 is also of interest ;)

for compiling:
http://celestiaproject.net/forum/viewtopic.php?t=6255

Posted: 20.08.2006, 23:29
by bongox
AWESOME! Thanks a lot! :)

Posted: 21.08.2006, 04:18
by bdm
You can set different values using a script.

Posted: 22.08.2006, 01:20
by bongox
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.

Posted: 22.08.2006, 02:07
by bdm
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.

Posted: 22.08.2006, 02:53
by bongox
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!

Posted: 22.08.2006, 02:56
by bongox
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!

Posted: 22.08.2006, 06:00
by bdm
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.

Posted: 22.08.2006, 13:39
by bongox
Thanks. One of these years ill upgrade from Win98,and I'll recompile my dear Celestia.

Thanks for all your advice everyone!

:)

Posted: 22.08.2006, 18:02
by hank
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

Posted: 22.08.2006, 20:50
by bongox
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

Posted: 22.08.2006, 21:14
by bongox
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.

Posted: 24.08.2006, 03:59
by bongox
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.

Posted: 24.08.2006, 16:12
by hank
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

Posted: 25.08.2006, 01:01
by bongox
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 :)

Posted: 31.08.2006, 19:37
by hank
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

Posted: 06.09.2006, 22:04
by bongox
...Aarg, I can't get it to work. I haven't been able to figure out the problem yet.