Page 1 of 1

How do I get scripts to loop?

Posted: 30.08.2004, 17:02
by Size_Mick
I'd like an explanation for both types, if possible.

I searched the forums before asking, and didn't find a satisfactory answer. Is it not possible?

What'd be really boffo is just knowing how to call a script at the end of another, and chain them together, then loop the whole thing again by having the last one call the first one.

Re: How do I get scripts to loop?

Posted: 30.08.2004, 18:36
by Harry
Size_Mick wrote:I'd like an explanation for both types, if possible.

For CEL: not at all (but see below)
For CELX:

Code: Select all

while true do
... script ...
end


Looping a CEL-script embedded in a CELX-script (not testest, just to give you the idea):

Code: Select all

while true do
  celscript = celestia:createcelscript( [[
   ... CEL-script ...
  ]] )
  while celscript:tick() do end
end


What'd be really boffo is just knowing how to call a script at the end of another, and chain them together, then loop the whole thing again by having the last one call the first one.

You can try using "dofile" in CELX, but it's probably better to combine both scripts in one, and then loop that.

Harald

Posted: 05.01.2005, 01:31
by L2Cache
I've tested this, and it works. Just had to add the wait command.

Code: Select all

while true do
  celscript = celestia:createcelscript( [[
   ... CEL-script ...
  ]] )
  while celscript:tick() do
      wait(0)
    end
  end

Posted: 05.01.2005, 01:34
by L2Cache
I've tested this, and it works. Just had to add the wait command.

Code: Select all

while true do
  celscript = celestia:createcelscript( [[
   ... CEL-script ...
  ]] )
  while celscript:tick() do
      wait(0)
    end
  end