Scripts: What are the guidelines for using core.wait()? #3062
Replies: 2 comments
-
You have run into a problem with how Stellarium has been written. Specifically, I don't think there is an answer. I start with 0.1, and if there is a problem I double the previous value, until it works or I run it on another machine. |
Beta Was this translation helpful? Give feedback.
-
The calls are executed when it comes to the script manager's time to do something. In above script, the waits are here to let the viewer actually look into the intended view for a second (or 10). |
Beta Was this translation helpful? Give feedback.
-
I have been learning how to development scripts by studying the scripts that are integrated with Stellarium and the scripts that are in the 'test' folder.
After many of the API calls there is a core.wait().
Example (from constellations_tour.ssc) :
for (i=0; i<constellations.length; i++)
{
objName = constellations[i];
core.selectConstellationByName(objName);
StelMovementMgr.autoZoomIn(6);
core.wait(1);
StelMovementMgr.zoomTo(40,8);
core.wait(1);
ConstellationMgr.setFlagArt(true);
core.wait(10);
ConstellationMgr.setFlagArt(false);
}
Is the purpose of the core.wait() statements to synchronize the running of the script with the completion of the API calls?
In general, are API calls asynchronous operations?
Are there any general guidelines for using core.wait() in scripts?
Should a statement like StelMovementMgr.autoZoomIn(6) be followed by core.wait(1) or core.wait(6)?
Should a statement like StelMovementMgr.zoomTo(40,8); be followed by core.wait(1) or core.wait(8)?
Beta Was this translation helpful? Give feedback.
All reactions