Command lines count in celx scripts

All about writing scripts for Celestia in Lua and the .cel system
Topic author
ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 6 months
Location: Rome, ITALY

Command lines count in celx scripts

Post #1by ANDREA » 27.10.2008, 22:42

Sorry to trouble with this probably silly question, but it's a big problem for me.
I tried to modify a celx script, in order to shorten it.
Launching it everything goes OK, but at half of the script it stops with this error message:
"In line 116=Second argument to celestia:print must be a number"

Well, I counted the lines as normally we do, i.e. one after the other starting from the beginning, but line 116 is way BEFORE the point in which the error message popped on the screen.
Moreover, I have no commands written as celestia:print
Where is the trick?
Please help me, I'm getting mad to understand how it works. :cry:
Thanks a lot.
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 11 months
Location: Nancy, France

Re: Command lines count in celx scripts

Post #2by Vincent » 27.10.2008, 23:03

Andrea,

Could you provide the whole script? That would help.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 6 months
Location: Rome, ITALY

Re: Command lines count in celx scripts

Post #3by ANDREA » 28.10.2008, 00:35

Vincent wrote:Andrea, Could you provide the whole script? That would help.
Sure, Vincent, you can find it here:
http://ftp.tiscali.it/andrea_celestia/futuro_del_sole-no2.celx
BTW, it's your script future_of_our_sun_celestia1.5 that I translated in Italian and slightly modified mainly to shorten it a bit, due to time problems (just one hour to show Sun birth, life and death, alas!). :(
Thanks a lot, Vincent.
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 11 months
Location: Nancy, France

Re: Command lines count in celx scripts

Post #4by Vincent » 28.10.2008, 09:39

Andrea,

First of all, you may want to use notepad 2 to edit your scripts.
Unlike the version of notepad provided with Windows, notepad 2
offers many features dedicated to code and script editing.

Then, to fix the issue you're getting with your Italian version of the script,
just replace line 497 ('Seconda fase di Gigante rossa' section):

Code: Select all

displaySunInfo(sun_age,sun_radius, sun_lum, sun_temp, 2)
with:

Code: Select all

displaySunInfo(text23, sun_age,sun_radius, sun_lum, sun_temp, 2)


and line 506:

Code: Select all

displaySunInfo(sun_age,sun_radius, sun_lum, sun_temp, 4)
with:

Code: Select all

displaySunInfo(text23, sun_age,sun_radius, sun_lum, sun_temp, 4)

In both cases, the text argument was missing in the displaySunInfo function,
which is declared in line 116 and called many times all along the script.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 6 months
Location: Rome, ITALY

Re: Command lines count in celx scripts

Post #5by ANDREA » 28.10.2008, 13:28

Vincent wrote:Andrea, First of all, you may want to use notepad 2 to edit your scripts. Unlike the version of notepad provided with Windows, notepad 2 offers many features dedicated to code and script editing.
Thank you Vincent, I forgot that notepad2 gives the line number on left (and many more advantages over Microsoft Notepad, BTW), and this is very useful for this purpose.

Vincent wrote:Then, to fix the issue you're getting with your Italian version of the script,
just replace line 497 and line 506.
In both cases, the text argument was missing in the displaySunInfo function,
which is declared in line 116 and called many times all along the script.
OK, now I can understand the function of the line 116, i.e. it gives the general rule for text displaying all along the script. :oops:
I changed the lines as you suggested and now all works flawlessly.
Thanks a lot, VERY appreciated. :wink:
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO


Return to “Scripting”