Visual Script Builder for Remote Control Plugin #4882
kutaibaa-akraa
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
OMG! I think ALL script authors have dreamed of this for the last 15 years. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Feature: Visual Script Builder for Remote Control Plugin
Author: @kutaibaa-akraa
Date: 2026-04-21
Type: New Feature / UI Enhancement
Stellarium: v26.1
Status: Partially ready - not released
Overview
This feature introduces a Visual Script Builder to the Remote Control Plugin, replacing the need to manually write
.sscscript files. The interface provides a drag-and-drop canvas where users can construct Stellarium scripts by selecting from a library of available actions, configuring parameters through intuitive controls, and generating executable code in real-time.The Script Builder bridges the gap between the existing "Actions" panel (which executes single commands) and the "Scripts" panel (which runs pre-written files). It enables users to create, edit, save, and share complex scripts without writing a single line of code.
Key Features
Phase 1-4 Complete (Current State)
/api/stelaction/list) and Scripting API functions (manually defined with parameters).ssccode updates instantly as actions are added, removed, or modifiedcore.wait()after movement/zoom actions with configurable durationduration: 3.0→core.wait(3.5))for,for-in, andwhileloops with nested child actionsif/elseblocks with separate "then" and "else" action lists.sscfilesIn Development (Phase 5 - Planned)
.sscfiles into editable actions (currently partial)Technical Implementation
New Files Created
webroot/js/ui/scriptbuilder/scriptbuilder.jswebroot/js/ui/scriptbuilder/scriptbuilder-actions.jswebroot/js/ui/scriptbuilder/scriptbuilder-parser.js.sscfiles into action objects (supports variables, loops, conditions, 30+ command patterns)webroot/js/ui/scriptbuilder/scriptbuilder-templates.jswebroot/scriptbuilder.cssModified Files
webroot/index.htmltab_actionswebroot/tablet7in.htmlwebroot/js/mainui.jswebroot/js/main.jsKey API Endpoints Used
/api/stelaction/list/api/stelaction/do/api/scripts/list.sscfiles/api/scripts/info/api/scripts/stop/api/scripts/statusData Flow Architecture
Current Capabilities Demonstrated
Successfully Parsed Actions (30+ Patterns)
The parser currently recognizes and converts the following command patterns:
core.clear("state")→ Clear View actioncore.wait(seconds)→ Wait actioncore.moveToAltAzi(alt, azi, duration)→ Move to Alt/Azimuth actioncore.setDate("date", "spec")→ Set Date actioncore.setTimeRate(rate)→ Set Time Rate actionStelMovementMgr.zoomTo(fov, duration)→ Zoom To FOV actionStelMovementMgr.autoZoomIn(duration)→ Auto Zoom In actionStelMovementMgr.setFlagTracking(bool)→ Set Tracking actionLandscapeMgr.setFlagLandscape(bool)→ Show Landscape actionConstellationMgr.setLines(bool)→ Show Constellation Lines actionStarMgr.setStars(bool)→ Show Stars actionSolarSystem.setPlanets(bool)→ Show Planets actionExample: Parsing
analemma.sscWhen loading the built-in
analemma.sscscript, the parser successfully extracts:JD,color,label,labelWeek,labelWinter,labelSummer,labelFinalcore.goHome(),core.setGuiVisible(),core.setTimeRate(),core.clear(),LabelMgr.labelScreen(),StelMovementMgr.autoZoomIn(),StelMovementMgr.zoomTo(),GridLinesMgr.setFlagAzimuthalGrid(),core.wait(), and morefor (i=0; i<53; i++)loop is correctly identified as a Loop actionif (week==1)andif (week==26)conditions are correctly parsedResult: The script is reconstructed in the canvas as 25+ editable actions, ready for modification.
Challenges Encountered
1. Script Content Retrieval
Problem: The Remote Control API does not provide a direct endpoint to retrieve the raw content of
.sscfiles. Endpoints tested:/api/scripts/get/api/scripts/content/api/scripts/read/scripts/bennett.ssc(direct path)/api/scripts/infoWorkaround: Currently using
/api/scripts/infowith HTML stripping to extract code content. A proper/api/scripts/rawendpoint would be beneficial.2. StelAction to Script Command Mapping
Problem: StelActions (from
/api/stelaction/list) do not have direct script command equivalents. For example,actionShow_Constellation_Linesexecutes via API but cannot be directly written as a script command.Current Solution: Maintain a manual mapping of ~60 common StelActions to their script equivalents (e.g.,
actionShow_Constellation_Lines→ConstellationMgr.setLines(true)). Unknown actions display as comments in generated code.Ideal Solution: Stellarium could expose a mapping API or include script syntax in the StelAction metadata.
3. Parser Limitations
Current Limitations:
{x: 10, y: 20})Planned Improvements:
4. Auto-Wait Timing Accuracy
Problem: Different movement actions require different wait durations. The current "smart wait" uses the action's
durationparameter but may not account for acceleration/deceleration curves.Observation: From testing,
duration + 0.5seconds works reliably for most cases, but very short durations (< 1s) may need proportionally longer waits.Proposed Enhancements (Discussion Points)
1. Native Script Content API
Suggestion: Add a new endpoint to the Remote Control API:
This would return the raw, unprocessed content of the script file with proper MIME type
text/plain. Currently, the lack of this endpoint requires HTML scraping from/api/scripts/info.2. StelAction Metadata Extension
Suggestion: Extend the StelAction system to include script syntax information:
{ "id": "actionShow_Constellation_Lines", "text": "Constellation lines", "isCheckable": true, "scriptSyntax": "ConstellationMgr.setLines(true)" }This would eliminate the need for manual mapping and ensure all actions can be properly exported to
.sscfiles.3. Script Execution State Feedback
Suggestion: Add WebSocket or Server-Sent Events support to notify the Remote Control when a script completes execution. Currently, the UI relies on timeout-based estimates, which can be inaccurate for scripts with variable durations.
4. Collaborative Script Editing
Suggestion: Consider adding real-time collaboration features using the existing multi-client architecture. Multiple users could edit the same script simultaneously, with changes synchronized across all connected Remote Control instances.
5. Script Versioning / History
Suggestion: Integrate with Stellarium's existing script management to support version history or undo/redo across sessions. This would be particularly valuable for educational and presentation contexts.
Files Modified/Created Summary
webroot/js/ui/scriptbuilder/scriptbuilder.jswebroot/js/ui/scriptbuilder/scriptbuilder-actions.jswebroot/js/ui/scriptbuilder/scriptbuilder-parser.js.sscfile parserwebroot/js/ui/scriptbuilder/scriptbuilder-templates.jswebroot/scriptbuilder.csswebroot/index.htmlwebroot/tablet7in.htmlwebroot/js/mainui.jsNext Steps
I am actively working on the following improvements:
Figure 1: Script Builder interface showing the dual-panel layout (Actions Library left, Script Canvas right) with generated code preview at bottom.
Figure 2: Edit Modal for configuring action parameters with appropriate input controls (sliders for numbers, checkboxes for booleans, color pickers).
Figure 3: Variables panel showing user-defined variables with type indicators and delete functionality.
Figure 4: Children Editor for adding actions inside loops and condition blocks.
Beta Was this translation helpful? Give feedback.
All reactions