In CEL scripts you can goto a URL by pasting the copied URL straight from Celestia into a "goto URL" command in your CEL script.
I can't find an obvious equivalent in CELX.
(ie. There should be an appropriate "observer" method IMO)
Can anyone point me in the right direction please.
Cheers
CC
.CelX equivalent to the Goto URL in .CEL ?
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 18 years 11 months
.CelX equivalent to the Goto URL in .CEL ?
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: .CelX equivalent to the Goto URL in .CEL ?
I don't think there is a Method in CELX which invokes a URL.
However, it's a hack, but you can incorporate a .CEL script in a .CELX script.
However, it's a hack, but you can incorporate a .CEL script in a .CELX script.
Selden
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 18 years 11 months
Re: .CelX equivalent to the Goto URL in .CEL ?
Hmm... damned annoying!selden wrote:I don't think there is a Method in CELX which invokes a URL.
Yep, I've never been too keen on that hack. It should work, but probably not with the speed I need.selden wrote:However, it's a hack, but you can incorporate a .CEL script in a .CELX script.
There are some methods for position:
http://en.wikibooks.org/wiki/Celestia/Celx_Scripting/CELX_Lua_Methods#position
but there seems to be "get" methods only, no "set" methods.
Even if there were, then there's still orientation, frame, etc.. to set as well.
Cheers
CC
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 9 months
- Location: Seattle, Washington, USA
Re: .CelX equivalent to the Goto URL in .CEL ?
I think that this is an unfortunate omission from celx scripting. It shouldn't be hard to fix.
--Chris
--Chris
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 18 years 11 months
Re: .CelX equivalent to the Goto URL in .CEL ?
I'll look forward to that. Thanks.chris wrote:I think that this is an unfortunate omission from celx scripting. It shouldn't be hard to fix.
--Chris
(pls. let me know when fixed and I'll test)
CC
PS. Sent you a PM on another matter (infoURL's)
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-
- Developer
- Posts: 1356
- Joined: 07.01.2005
- With us: 19 years 10 months
- Location: Nancy, France
Re: .CelX equivalent to the Goto URL in .CEL ?
CC,
Here's an example that shows how to set celURL parameters using a celx script:
However, I agree that using a celestia:seturl function would be handier.
Another issue is that celURLs include some rendering options that can't be
"decoded" by the user to be used in the script.
So, if you can compile your own version of celestia, you can try to apply
the following short patch that adds the celestia:seturl function to celx scripting:
Here's an example that shows how to set celURL parameters using a celx script:
Code: Select all
--"cel://SyncOrbit/Sol:Earth/2008-06-21T13:21:05.18439?x=fbeWQgCMEQ&y=fg7E0iILKA&z=PMj5mKdiBg
-- &ow=-0.573595&ox=-5.80523e-006&oy=-0.819139&oz=-3.23302e-006
-- &select=Sol:Earth&fov=60&ts=0<d=0&p=0&rf=18470279&lm=2017986560&tsrc=0&ver=3"
obs = celestia:getobserver()
earth = celestia:find("Sol/Earth")
-- Define Geocentric frame of reference
e_frame = celestia:newframe("planetographic", earth)
-- Define position and orientation using cel-style URL.
u_pos = celestia:newposition("fbeWQgCMEQ", "fg7E0iILKA", "PMj5mKdiBg")
u_rot = celestia:newrotation(-0.573595, -5.80523e-006, -0.819139, -3.23302e-006)
-- Convert position and orientation from Universal to Geocentric coordinates.
e_pos = e_frame:from(u_pos)
e_rot = e_frame:from(u_rot)
obs:setposition(e_pos)
obs:setorientation(e_rot)
-- Set frame of reference
obs:synchronous(earth)
-- Set time
t = celestia:utctotdb(2008, 6, 21, 3, 21, 5.18439)
celestia:settime(t)
-- Set fov
obs:setfov(math.rad(60))
-- Set timescale
celestia:settimescale(0)
However, I agree that using a celestia:seturl function would be handier.
Another issue is that celURLs include some rendering options that can't be
"decoded" by the user to be used in the script.
So, if you can compile your own version of celestia, you can try to apply
the following short patch that adds the celestia:seturl function to celx scripting:
Code: Select all
Index: celx.cpp
===================================================================
--- celx.cpp (revision 4698)
+++ celx.cpp (working copy)
@@ -3303,7 +3303,18 @@
return 0;
}
+static int celestia_seturl(lua_State* l)
+{
+ Celx_CheckArgs(l, 2, 2, "One argument expected for celestia:seturl()");
+ CelestiaCore* appCore = this_celestia(l);
+ string url = Celx_SafeGetString(l, 2, AllErrors, "Argument to celestia:seturl() must be a string");
+ appCore->goToUrl(url);
+
+ return 0;
+}
+
+
static void CreateCelestiaMetaTable(lua_State* l)
{
Celx_CreateClassMetatable(l, Celx_Celestia);
@@ -3388,6 +3399,7 @@
Celx_RegisterMethod(l, "dsos", celestia_dsos);
Celx_RegisterMethod(l, "windowbordersvisible", celestia_windowbordersvisible);
Celx_RegisterMethod(l, "setwindowbordersvisible", celestia_setwindowbordersvisible);
+ Celx_RegisterMethod(l, "seturl", celestia_seturl);
lua_pop(l, 1);
}
@+
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
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 authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 18 years 11 months
Re: .CelX equivalent to the Goto URL in .CEL ?
Thanks for the example Vincent.
That's saved me quite a bit of time. See here: http://shatters.net/forum/viewtopic.php?f=2&t=13666
CC
That's saved me quite a bit of time. See here: http://shatters.net/forum/viewtopic.php?f=2&t=13666
CC
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: .CelX equivalent to the Goto URL in .CEL ?
Vincent,
I just now tested Celestia after applying your patch, and the Celx code
celestia:seturl
works great!
(Of course celestia:geturl would be helpful, too, so one could script their capture.)
I just now tested Celestia after applying your patch, and the Celx code
celestia:seturl
works great!
(Of course celestia:geturl would be helpful, too, so one could script their capture.)
Selden
-
- Developer
- Posts: 1356
- Joined: 07.01.2005
- With us: 19 years 10 months
- Location: Nancy, France
Re: .CelX equivalent to the Goto URL in .CEL ?
CC,Chuft-Captain wrote:Thanks for the example Vincent.
That's saved me quite a bit of time. See here: http://shatters.net/forum/viewtopic.php?f=2&t=13666
You're welcome. And that's a great video !
Selden,selden wrote:I just now tested Celestia after applying your patch, and the Celx code
celestia:seturl
works great!
Once again, thanks for testing the patch.
Yes, that would be indeed a useful feature.selden wrote:(Of course celestia:geturl would be helpful, too, so one could script their capture.)
However, copying an URL to clipboard is a platform dependant process, so I'd suggest to
wait for the Qt cross-platform version before adding the celestia:geturl function to celx.
@+
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
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
-
- Developer
- Posts: 1356
- Joined: 07.01.2005
- With us: 19 years 10 months
- Location: Nancy, France
Re: .CelX equivalent to the Goto URL in .CEL ?
The seturl/geturl and synchronizetime/istimesynchronized methods have been added to the celestia object in celx scripting.
This concerns the current development versions, i.e., both the trunk and the 1.6.1 branch in SVN.
More information about how to use these commands can be found here:
http://en.wikibooks.org/wiki/Celestia/C ... tia#seturl
The following celx script gives an example about how to use these commands.
It shows the day/night length in Paris on the equinoxes and solstices.
This concerns the current development versions, i.e., both the trunk and the 1.6.1 branch in SVN.
More information about how to use these commands can be found here:
http://en.wikibooks.org/wiki/Celestia/C ... tia#seturl
The following celx script gives an example about how to use these commands.
It shows the day/night length in Paris on the equinoxes and solstices.
Code: Select all
-- Title: Show day/night length in Paris on equinoxes and solstices
-- Author: Vincent <vince.gian@free.fr>
obs = celestia:getobserver()
obs:singleview()
wait(1)
obs:splitview("h", 0.5)
obs:splitview("v", 0.5)
obs = celestia:getobservers()
obs[2]:splitview("v", 0.5)
celestia:synchronizetime(false)
celestia:unmarkall()
sol = celestia:find("Sol")
earth = celestia:find("Sol/Earth")
loc = celestia:find("Sol/Earth/Paris")
earth:addreferencemark{type = "visible region", color = "yellow", opacity = 0.5, tag = "terminator", target = sol}
loc:mark("red", "disk", 10, 0.8, "", false)
-- Autumn Equinox
url1 = "cel://Follow/Sol:Earth/2009-09-22T11:00:0?x=mH9RlBJa&y=NzOFNqGfVQE&z=J9A3FXnja////////////w&ow=0.388908&ox=0.591889&oy=-0.590386&oz=-0.387121&select=Sol:Earth:Paris&fov=16.0765&ts=1000<d=0&p=0&rf=1693063&lm=2017986688&tsrc=0&ver=3"
-- Spring Equinox
url2 = "cel://Follow/Sol:Earth/2009-03-20T11:00:0?x=0/pVMFtV&y=wLI7PKGfVQE&z=+ARbV3bja////////////w&ow=0.389986&ox=0.593566&oy=-0.5887&oz=-0.386035&select=Sol:Earth:Paris&fov=16.0765&ts=1000<d=0&p=0&rf=1693063&lm=2017986688&tsrc=0&ver=3"
-- Winter Solstice
url3 = "cel://Follow/Sol:Earth/2009-12-21T11:00:0?x=Dn3js1lc&y=sE1o0KCfVQE&z=WObLkHnja////////////w&ow=0.393271&ox=0.598528&oy=-0.583654&oz=-0.382688&select=Sol:Earth:Paris&fov=16.0765&ts=1000<d=0&p=0&rf=1693063&lm=2017986688&tsrc=0&ver=3"
-- Summer Solstice
url4 = "cel://Follow/Sol:Earth/2009-06-21T11:00:0?x=4tT717VX&y=ILGVqKGfVQE&z=IIpesXjja////////////w&ow=0.390284&ox=0.594004&oy=-0.588258&oz=-0.385734&select=Sol:Earth:Paris&fov=16.0765&ts=1000<d=0&p=0&rf=1693063&lm=2017986688&tsrc=0&ver=3"
obs = celestia:getobservers()
celestia:seturl(url1, obs[1])
celestia:seturl(url2, obs[2])
celestia:seturl(url3, obs[3])
celestia:seturl(url4, obs[4])
text = [[
Spring Equinox Summer Solstice
Autumn Equinox Winter Solstice
]]
while true do
celestia:print(text, 1, 0.5, 0.5, -11, 1)
wait(0)
end
@+
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
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 authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 18 years 11 months
Re: .CelX equivalent to the Goto URL in .CEL ?
Vincent,
Did these make it into 1.6.0 final? ... or just miss?
CC
EDIT: OK, I just gave it a try and it looks like it didn't make it into 1.6.0.
Did these make it into 1.6.0 final? ... or just miss?
CC
EDIT: OK, I just gave it a try and it looks like it didn't make it into 1.6.0.
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 9 months
- Location: Seattle, Washington, USA
Re: .CelX equivalent to the Goto URL in .CEL ?
Chuft-Captain wrote:Vincent,
Did these make it into 1.6.0 final? ... or just miss?
CC
EDIT: OK, I just gave it a try and it looks like it didn't make it into 1.6.0.
The changes are already in the 1.6.1 branch, so you won't have to wait too long...
--Chris
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 18 years 11 months
Re: .CelX equivalent to the Goto URL in .CEL ?
In fact, I don't have to wait at all! (I have finally installed the IDE and Tortoise )chris wrote:Chuft-Captain wrote:Vincent,
Did these make it into 1.6.0 final? ... or just miss?
CC
EDIT: OK, I just gave it a try and it looks like it didn't make it into 1.6.0.
The changes are already in the 1.6.1 branch, so you won't have to wait too long...
--Chris
SetURL confirmed working in svn 4814: Wormhole Travel
... and it looks like either yourself or Vincent has also fixed an orientation problem which was causing an approx 90deg rotation when capturing URL's.
Cheers
CC
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS