18ixv3fdp8bdhktzyihil0i8gttoir

Example Script Code

User Guides > Scripts > Script Editing > Example Script Code

Sample Script File Code

A script file includes several standard blocks of data that require little coding knowledge to understand. It will often be very long as there will be many lines for every stroke, but it is also possible to delete entire sections or edit individual lines.

A standard recorded script will contain the following blocks of data:

  1. Version
  2. Header
  3. Startup Features
  4. Events

This is the code from a recorded script from creating a painting inside ArtRage. A custom script written specifically to generate an action may look very different, but requires more advanced programming knowledge to create. However, you can edit a basic recorded script to alter the playback, or create a customized script quite easily.

Note: It is highly recommended that you use a code editing program such as Notepad++ to edit scripts, as normal text editors may be very slow and difficult to work with.


Version Block

Version data about the edition of ArtRage the script was recorded in. The script will warn the user when played back in earlier versions.

The Version block lists version details about the script and edition of ArtRage used to create it. This section is optional, but helps different editions of ArtRage figure out if the script will be compatible with that edition, or if there may be unsupported features that might not work.

<Version>
ArtRage Version: ArtRage 3 5

ArtRage Build: 5.0.4
Professional Edition: Yes

Script Version: 1
</Version>
Edition of ArtRage used to record the script. Will always say ‘ArtRage 3 [Studio Pro/4/5/etc]’
Build number of that edition.
Choose ‘Yes’ or ‘No’ to control whether the script will add a warning when playing back in Lite or Studio.
Don’t change, later versions prevents script being played back in current version of ArtRage

The Version block lists version details about the script and edition of ArtRage used to create it. This section is optional, but helps different editions of ArtRage figure out if the script will be compatible with that edition, or if there may be unsupported features that might not work.

Header Block

The header block sets up the canvas and initial script dialogue and options.

The Header block controls what happens when the script first opens. It lets you choose the new canvas size and active painting area, or whether the script starts a new painting or continues in the current one. It also lets you decide if a dialogue box with playback options pops up, and what text and options appear in the dialogue box.

Painting Name: “White”
Painting Width: 2500
Painting Height: 1050
Painting DPI: 72
Mask Edge Map Width: 2500
Mask Edge Map Height: 1050
Sets new document title
Sets up canvas width and height

Sets DPI
Active Window (monitor resolution).
Author Name: “”
Script Name: “Test script”
Comment: “About this script”
Script Type: “”
Sets information displayed in the script dialogue box (can also be added when saving a script from inside ArtRage).
Script Feature Flags: 0x000001034
Controls what info dialogue option pops up, if any. Set to ‘0’ to play script inside existing painting instead of starting a new one.
0x000001034 – default
0x000000000 or 0 – no pop up, plays script inside current painting
0x00000FFFF – flags as ‘includes current painting’, so disables resizing

Startup Features Block

The Startup Features sets up starting image and canvas data. Remove to retain current painting settings instead of overwriting with new settings.

The Startup Features are not directly editable, but code all the image data for the canvas and any content that exists before the actual script begins. For example, the canvas color and grain, reference images, strokes made before the script started recording, and other settings. Some of this information is only included if ‘Include Current Painting’ was checked when recording, but some of it will always be included. This data will overwrite the current settings ArtRage is using when you start the script. It is safe to delete this section, and that means that the new script will not change any of the settings, or add any paint data, before it starts playing.

<StartupFeatures>
Script Startup Features: {
╁╭╢╩╥╮╴┠╄╥╳╩╧╮┠═╲╯╪╥╣╴┠╦╩╬╥┮┠┍┊─╁
</StartupFeatures>
The StartupFeatures block of code will be very long. It will contain all the canvas setting and paint data that the scripted file will begin with before the script starts playing.

Events Block

The Events section is the final section of the script and the part that you watch play out on your screen. All strokes, commands, and menu interactions will go here.

The Events block is the most important part of the script, as this is where all the menu commands and strokes are made. Any action in ArtRage that can be recorded can be added here, as well as custom functions.

You can add or delete new lines here, but the order of events is very important, as any changes you make will affect every action after it (for example, if you add a new layer and do not add a command to switch back to the previous layer, all new strokes will be on the new layer even if that does not make sense for what you wanted to do).

Wait Events
Wait: 0.000s EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4900 (Oil Paint) }
There is a ‘Wait’ event at the beginning of every new line. This is the time between specific actions in seconds when the stylus is just hovering or interacting with menus instead of adding paint. Choosing ‘accelerated playback’ in the Script playback dialogue will ignore all Wait events (automatically set them to 0.000s).

Select Tool Preset Command
EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4916 (Watercolor) }
EvType: Command CommandID: ToolPreset ToolID: 4916 (Watercolor) Tool Data: {
┴┓──┘───────│─■┿━──────────┿━───└───◷┴╂┿──▀┿
━─────────▀┿─╅─◿╘───────┇───────╤╞◐▲──▀┿────┵╞◐▲────────╆
╞◐▲────━───╤╞◐▲────━───┵╞◐▲──▀┿━───┶╞◐▲────━───╆╞◐▲──── } // End of tool preset binary data.

Loads the preset data for a tool when switching to it, so the script always plays back with the exact same tool settings.

Select Tool Command
EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4900 (Oil Paint) }
EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4917 (Inking Pen) }

Selects a new tool without changing any settings (so it will use whatever ArtRage is currently set to, no matter what the original strokes used).

Stroke Events

Individual strokes contain many lines of script data recording every individual datapoint during that stroke. Stroke events contain the Stroke Header and the actual stroke itself. Every single stroke will have its own Stroke Event in the script.

Stroke Header Events
<StrokeEvent>
<StrokeHeader>
Wait: 0.000s Loc: (1119.32, 448.864) Pr: 1 Ti: 1 Ro: 0 Fw: 1 Bt: 0 Rv: NO Iv: NO
Yes
0x000000000, 0x000000000
Count: 3
Loc: (1119.32, 448.864) Pr: 0 Ti: 1 Ro: 0 Fw: 1 Bt: 0
Loc: (1117.05, 448.864) Pr: 0 Ti: 1 Ro: 0 Fw: 1 Bt: 0
Loc: (1115.91, 448.864) Pr: 0 Ti: 1 Ro: 0 Fw: 1 Bt: 0
Loc: (0, 0) Pr: 1 Ti: 1 Ro: 0 Fw: 1 Bt: 0
Loc: (0, 0) Pr: 1 Ti: 1 Ro: 0 Fw: 1 Bt: 0
Loc: (1117.05, 448.864) Pr: 0 Ti: 1 Ro: 0 Fw: 1 Bt: 0 Dr: (0.999379, 0.0352338) Hd: (-0.0352338, 0.999379)
Loc: (1119.32, 448.864) Pr: 0 Ti: 1 Ro: 0 Fw: 1 Bt: 0 Dr: (0.999623, 0.0274414) Hd: (-0.0274414, 0.999623)
</StrokeHeader>

The Stroke Event Header sets the starting information for the beginning of the stroke (canvas position, randomised image data and initial pressure/tilt/other input).

Stroke Data
Wait: 0.018s Loc: (1032.74, 591.833) Pr: 1 Ti: 1 Ro: 0 Fw: 1 Bt: 0 Rv: NO Iv: NO
Wait: 0.152s Loc: (1034.09, 590.909) Pr: 1 Ti: 1 Ro: 0 Fw: 1 Bt: 0 Rv: NO Iv: NO </StrokeEvent>

After the Stroke Header comes the input data for the actual stroke, including canvas location, pressure, stylus rotation, and more. Each tool will have a default pressure assigned that is used if there is no varying stylus pressure.

Other Commands

There are various other possible commands, including Layer Commands, Undo commands, and anything else that you can do in ArtRage.

Layer Commands
EvType: Command CommandID: Add New Layer
EvType: Command CommandID: Add New Layer
EvType: Command CommandID: CID_ToggleSpecificLayerVisible ParamType: LayerProp Value: { 1, 0 }
EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { 2 }
EvType: Command CommandID: CID_MoveSpecificLayer ParamType: LayerTwoOp Value: { 2, 1 }
EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { 1 }
EvType: Command CommandID: CID_MergeSpecificLayerDown ParamType: uint32 Value: { 1 }

These act on layers to add, delete, merge, export, adjust visibility, and so on.


Tips

The actual script will include multiple comments explaining what each section is in slightly more detail, but ArtRage only plays back the code outside of the comments. Comment lines begin with //. Any line starting with two forward slashes can be ignored or deleted safely. You can also add your own comments this way.

To find the ArtRage code for different commands, it is usually easiest to record that action and then study the generated script. You can then modify the parameters to change the number, stylus pressure, position, or other properties.

Different commands can be added and removed at any point between other commands or Stroke Events.

You can remove entire blocks of code (e.g. the entire <Version> </Version> section) if you do not want that information in the script, as long as you understand the effect it will have.

Some color related commands use the UK spelling ‘colour’.