Calling external programs: 'os nil value'

All about writing scripts for Celestia in Lua and the .cel system
Topic author
manoweb
Posts: 8
Joined: 07.01.2005
With us: 19 years 10 months

Calling external programs: 'os nil value'

Post #1by manoweb » 10.01.2005, 17:32

Hi, I would like to call an external program in the middle of my celestia script:

ret = os.execute("/usr/bin/mplayer -fs /path/intro.mpg")

(I tested also other commands of course)

I always get this error:
Celestia encountered an error while processing your script
Details
[string "/home/alesan/lavori/planetarium/celestia/scripts/t..."]:15: attempt to index global `os' (a nil value)

I tried to set celestia.cfg' ScriptSystemAccessPolicy both to "Ask" and "Allow" without luck.

Any suggestion?

thank you
Alessio Sangalli

Topic author
manoweb
Posts: 8
Joined: 07.01.2005
With us: 19 years 10 months

Post #2by manoweb » 10.01.2005, 18:45

ok sorry I didn't RTFM enough. I added a:

celestia:requestsystemaccess()


and now everything is fine.

Thank you
Alessio Sangalli

Newbe

What would the complete Windows line be?

Post #3by Newbe » 15.01.2005, 23:48

shatters crashed before I could get the manual.

how would you play a sound file?

Topic author
manoweb
Posts: 8
Joined: 07.01.2005
With us: 19 years 10 months

Post #4by manoweb » 16.01.2005, 00:10

do you use windows? me not :)
anyway, in windows I would do:
os.execute("start c:\\path\\file.mp3")
this will start your mp3 player and immediately release the control back to celestia so it can go on displaying 3D animations. Open a DOS console and type "start /?" for more information.

If you're a linux user you can choose many ways, I'd write a small bash script that launches some command line audio player (play, mpg123, etc) in the background.

ciao
Alessio Sangalli


Return to “Scripting”