| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Script Editing Tips

Page history last edited by LauraJMixon 14 years, 11 months ago

Here are detailed descriptions of some of the editing conveniences we provide. 

 

Cut, copy, and paste

 

All of the regular cut, copy, and paste tools work inside Scripts. When you use them, they act on the selected Operator and all its arguments. Thus, you can move big chunks of script around with cut and paste. Here's an example. Suppose that you need to reverse the order of subtraction in this Script:

 

BDifference of:

    Blend of:

        Nasty_Nice of:

             ThisSubject

        Nasty_Nice of:

             ThisDirObject

        0.0

   0.5

 

so that the 0.5 is on top and the Blend is on the bottom. To do this, simply select the Blend Operator, cut, select the 0.5 Operator, and paste. Lastly, enter the 0.5 value in the upper slot.

 

Outsertion

 

If you select an Operator in a Script and hold down the Control key (Ctrl key on Windows) while choosing a new Operator from a Menu, that new Operator will be "outserted"—placed above the selected Operator. Here's an example.

 

Existing Script:

    BSum of:

        Fearful_Angry of:

             Joe

        0.5

 

Select Operator "BSum," then click on "BSum of:" and hold down the Control key (Ctrl key on Windows) while opening the Arithmetic menu. Select menu item "BInverse" and get this result:

 

    BInverse of:

        BSum of:

             Fearful_Angry of:

                  Joe

             0.5

 

You'll use outsertion quite often in your daily scripting work.

 

Replacement:

 

You can replace one Operator with another by holding down the Option key (Alt key on Windows) before opening a menu. Example:

 

Existing Script:

    BSum of:

        Fearful_Angry of:

             Joe

        0.50

 

Select the Operator BSum, then hold down the Option key (Alt key on Windows) and open Arithmetic menu, selecting "BDifference." Get new Script:

 

BDifference of:

        Fearful_Angry of:

             Joe

        0.50

 

What's especially nice about this trick is that it preserves the arguments of the original Operator. If you used the direct route, you'd have to erase those internal arguments. This way, you don't erase them. There is a catch, however. You can't just replace any Operator with any other Operator. The only Operators that will be available for you to select are those whose argument types match the argument types of the original Operator.

 

This capability extends even to Operators with fewer or more than the number of arguments of the original Operator. For example, if you replace AND3 with AND4, the new AND4 will contain the previous three boolean arguments and add a fourth, undefined boolean Operator at the end. If you go in the other direction, replacing AND4 with AND3, then the last boolean argument will be deleted.

 

Collapsing a Script

 

Suppose you have this Script:

 

AND

   AreSameActor of:

        ThisSubject

        ReactingActor

   NOT

        AreSameActor of:

             ThisDirObject

             CandidateActor

 

And you want to get rid of the first "AreSameActor" term. Just click on the NOT Operator, Copy, click on AND, and Paste. Now it reads:

 

NOT

   AreSameActor of:

        ThisDirObject

        CandidateActor

 

Commenting Script Nodes

 

As your scripts become more complex and deeply nested, you can comment individual nodes of a script so when you revisit them weeks or months later you'll have an idea what they do at a glance without having to trace throught the underlying scripting elements.

 

Let's say you're working on an Acceptable script for the direct object (DirObject) of a verb Greet. 

 

 

 

This Acceptable script for the Greet verb will populate the DirObject (3Actor) wordsocket with the CandidateActors who fulfill all following criteria:

 

1. The CandidateActor must not be the Subject.

 

 

2. The CandidateActor must be at the same location as the Subject of the Verb.

 

 

To comment a node, select the node you wish to comment and press the Enter key (this key might be marked "Return" on some computers). A text field will appear above the selected node where you can type a brief comment to remind you what that particular piece of script is designed to accomplish. When you have finished entering your comment, press the Enter or Return key again to complete your editing.

 

 

Once you've entered comments you can collapse the nodes underneath the comments to make scripts more readable.

 

 

Auxiliary Operator Popup

 

If you select an Operator and tap the Spacebar, or if you right-click on it, then you'll see a menu pop up next to the selected Operator, containing every single Operator that you could enter in its stead and a textfield that can be used to filter the menu elements. You can move the selection with the arrow keys and browse the menu with the PageUp and PageDown keys. Hitting Enter or clicking on a menu elements selects it. (Mac users, you can reach the right-click/context-sensitive menu by holding down the Control key when clicking on the Operator.) 

 

 

Next Tutorial: Scriptalyzer

Previous Tutorial: Spying

 


Creative Commons License  This tutorial by Storytron, Inc. is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

 

Comments (0)

You don't have permission to comment on this page.