Script View Plugin

Nick Pope edited this page Feb 19, 2017 · 17 revisions

Note: This page refers to version 1 of the environment. Documentation for version 2 can be found within the environment itself.

The script view plugin provides the primary and most sophisticated means of input and control of the JS-Eden environment. This page documents characteristics of the script view window and not the script language itself which is detailed elsewhere. Similarly, the role and functionality of agents is also not explained in depth here.

Entering Script

When entering script into the text box, it will automatically highlight the syntax and show in the gutter (margin to the left) an error if you have entered something incorrectly. When you finish typing, if there is still an error indicated you can click on it to get details. The exact location of the error may be indicated by highlighting the word with red.

Executing Script

Once there are no errors, you can execute individual lines of script by clicking in the gutter to the left of the line:

If the statement is a block or goes over multiple lines then all of those lines are highlighted in the gutter and all will be executed as a group. However, it is also possible to select several lines to be executed together. This is done by clicking and dragging the mouse in the gutter over each line, or by holding down the shift key whilst clicking in the gutter. A subsequent click on the selection will execute all selected lines:

To remove a selection, click and drag again or again use the shift key.

In some cases you may wish to execute the entire script as one block, which also has the effect of turning that agent on (meaning that any when statements become active). To do this, right click on the tab at the top and select Run (force).

Live Editing

Holding the mouse down next to a line in the gutter will turn on live editing. This causes any changes to that line to be executed immediately if there are no errors, allowing for immediate feedback:

This is especially useful for editing numbers to tweak something. Any numbers in the script on that line can be changed by holding the mouse down and dragging the number left (to decrease) or right (to increase). In combination with live editing this is a fast way to find the value you want.

To deactivate live editing, click on the star in the gutter.

The Agent Tabs

Each agent or component of a model should have its own little script kept in different tabs. The first default tab is intended as a scratch/play area, ideally once you know what components there might be you should create new tabs for each one. Use the "Add Agent" button:

This will display a dialog to enter a new name, or the name of some existing agent that you wish to edit:

If the agent is already loaded in your browser it should appear in the drop-down list. A small icon to the right of the text box will indicate if the agent exists with one of the following icons:

  • Plus: No agent exists with that name, creates a new agent.
  • Pencil: Agent exists and is loaded so edit it.
  • Download: The agent exists on the server, it will be downloaded and edited.
  • Lock: The agent is already open in another tab, so will open as readonly in this one.
  • Cross: An invalid agent name.

Agent names are like files names, but they cannot contain spaces. You can (and should!) uses forward slashes to create a hierarchy. For example

model/component/name

Closing Tabs

Either right click on the tab and select Hide or use the menu to the bottom right of the script view.

Browsing Agents

The create agent dialogue also has a Browse button. This can also be accessed from the menu to the bottom right of the script view. Clicking this displays something like a file browser for exploring all agents in the system, including those located on the server.

Those shown in bold are already loaded into your browser. Those with ticks are already open in a tab, and you can tick more before clicking Add to also open those in new tabs.

Inspect Mode

Using the magnifying glass icon at the bottom of the script view, you can change into an inspection mode that allows you to query what the value of any particular observable is currently. When in inspect mode you can also click on import paths to open that script in a new tab.

To inspect a value, when in inspect mode click on the observable. Click again to restore the observable name.

History

When you edit a script, after a couple seconds of inactivity it will automatically make a local save of your work. You can use the Undo and Redo buttons to go back through your edits. The double undo and redo icons rewind to beginning or fast-forward to the most recent edit.

NOTE: These autosaves are only in your browser!

For more details on saving and loading your work, look at the Storing Projects page.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.