ArtRage Script Playback Tidy

Here are some instructions to get ArtRage scripts to work and to generally tidy up the final render.

 
1. Remove all canvas zooms, run the following command in Cygwin :

iconv -f ucs2le -t utf8 Untitled.arscript | sed s/CanvasXForm//g | iconv -f utf8 -t ucs2le > Untitled-fixed.arscript

2. Remove all references, tracing and global views
 
Use Notepad to search for :
 end of reference
 end of tracing
Ctrl Alt B at bottom brace to remove whole section and then Ctrl L to remove the line
Search for add view and remove the line
If the .arscript file is too large then run the following command in Cygwin :

split -b 100M Untitled-fixed.arscript

which will split into xaa, xab, xac into 100M sections
Edit xaa (Usually having tracing and references, haven't figured out how to edit others yet as format is wrong!)
Then merge back to whole file following Cygwin command :
cat x* > Untitled-fixed-no-ref.arscript

DEBUG

1. To show the line number that is currently running to help to debug any issues

iconv -f ucs2le -t utf8 Untitled-fixed-no-ref.arscript | sed -r 's/.*<EventPt>.*(Wait.*Loc.*).*<\/EventPt>/<EventPt>\1<\/EventPt>\r\nDismissNoteBox(1)\;\r\nNoteBox\("\1", 600, 20, 512, 384, 1, 0.5, 1\)\;/g' | iconv -f utf8 -t ucs2le > Untitled-fixed-no-ref-Debug.arscript

OUTSTANDING ISSUES

1. A bit of Warp weirdness, I seemed to somehow select briefly but no Warp menu came up but it recorded and didn't
switch back the tool properly.  Not quite sure what i did, but I was playing around with shortcuts.
-> Fix
Search for: Warp
Remove block up to solomode 0
 
2. When you import a layer and that layer is selected, the replay doesn't select the layer imported.
-> Fix
Search for: ImportLayer
<Ctrl> b -> to go to matching brace
at end of block insert the following:
Wait: 0.100s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { CurrentLayerIndex()+1 }