PDA

View Full Version : Questions About Scripting



terrygillooly
07-13-2011, 05:16 AM
I am really excited about the scripting possibilities on 3.5! I color a webcomic and there are certain setup tasks that must be performed each time. Now there is a way to reduce that drudgery... :cool:

I do have some questions about scripting which I hope the ArtRage gurus can answer. If anyone else does too, please feel free to add to this thread!

My first question (more of a comment, really) is that, on my PC, the Scripts folder did not default to the User Content folder! It was instead placed inside of My Documents: ArtRage Paintings. I like things to be consistent, so I manually moved the Script folder to User Content. However, "Tools: User Content: Open Scripts Folder... " still looks in the ArtRage Paintings folder.

terrygillooly
07-13-2011, 05:25 AM
Is there a way to run a script and have it act upon a currently active painting rather than a blank canvas or the painting that was saved with the script?

Someonesane
07-13-2011, 06:35 AM
Is there a way to run a script and have it act upon a currently active painting rather than a blank canvas or the painting that was saved with the script?

I'm not sure about the folder question in your first post, but for your question on having the Playback work over an existing image, there might be a way. Actually, two ways. The first thing that comes to mind, is editing the script file (through a text editor) to include the other drawing somehow. I haven't had enough time to really get into the code yet, though, so I haven't tested that. The other method, which I have just tested, is probably something that's not supposed to be working this way, so I'm not sure if they'll leave this in there, or not, upon updating the program.

Here's what you need to do:

1 - Set the Pencil to 1% pressure, and single click your mouse on a blank layer (Note: This will likely have you scratching your head, but bear with me...).

2 - Copy the layer you made the mark on (Ctrl + C).

3 - Begin Recording (File > Record Script).

4 - Paste what you copied (Ctrl + V).

This is done to get the program to record the process of the pasting. This will be essential for getting your playback to work over a different image during playback.

5 - Do whatever it was you wanted to do for the rest of the image.
Okay, so here's how this will work... After following the steps above, you'll be left with a script that wants to paste something. Because you only recorded the pasting process, and skipped the copy step, the program is going to use whatever is currently copied to the clipboard of the computer. This means if you (or a person playing the script back) goes online, right clicks an image, and selects "copy image" from the menu, that's the image ArtRage is going to paste onto a new layer when the script is played back.

Strandy
07-13-2011, 07:35 AM
I'm really glad to see more people interested in this new feature with much potential. I think it has at least the same potential as stencils which are pretty obvious part of AR. Stencils are even its distinguishing mark, I'd say.

Scripting feature is very new one and this implies some shortcomings at it's current state. What we need, is a bit more options for the script recorder. Option to crate scripts independent of current recorder context is quite essential IMO. We need some more options to eliminate or at least to minimize manual editing of script files. We need also some sort of script reference, just to understand the script file.

I hope this feature will meet some more attention in further development and let it be an another property, which makes AR so unique.

AndyRage
07-13-2011, 08:29 AM
I'm soon going to post a few 'utility' type scripts for use.
One does an automatic drop-shadow, another does a bevel, another does a 'cutout' effect, another draws a grid overlay.

In a text editor you can edit the script. It's a unicode UTF16 text file.
After all the header pre-amble - after "// Script data follows:" - add this line:
int nLayer = CurrentLayerIndex()

Then find any command that acts on a specific layer index, and replace the layer index with nLayer:


Wait: 0.000s EvType: Command CommandID: CID_DuplicateSpecificLayer ParamType: uint32 Value: { nLayer }
Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { nLayer }
Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000000 Idx: nLayer Contrast: 0 Brightness: -1 Saturation: 0 Hue Shift: 0 Flatten: YES Colourize: NO
Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000002 Idx: nLayer Blur Radius: 4
Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerOpacity ParamType: LayerProp Value: { nLayer, 0.5 }
Wait: 0.000s EvType: Command CommandID: LayerXForm Idx: nLayer Scale: (1, 1) Rot: -0 Off: (4, 4) MirH: NO MirV: NO Ras: NO
Wait: 0.000s EvType: Command CommandID: CID_MergeSpecificLayerDown ParamType: uint32 Value: { (nLayer + 1) }

AndyRage
07-13-2011, 08:31 AM
I've got a couple more urgent things to complete this week, then I'm going to take a short break, and then I'm going to make some useful posts about things you can do with scripting.
My brain is a bit fried at the moment.
:)

Strandy
07-13-2011, 08:51 AM
Holy cow! Procedural tools in form of scripts! Take your time Andy :) I'm sure things you're talking about will to convince everybody to use them.

PS: Saying this, I'm certain about technical/programmatical nature of this matter, so I'm looking forward to see more convenient tools to handle AR-scripts. Thank you for insight :)

AndyRage
07-13-2011, 09:30 AM
As with all these things it takes time to get them perfect.
We really needed to get the new update out the door - I think our loyal ArtRage users were getting worried we weren't doing an update because it had been so long.

MSIE
07-13-2011, 09:30 AM
wow, drop shadow, grid overlay! :)

I wonder if it will be easier to use scripts than to manually duplicate the layer, adjust colour (set brightness to -100 to make it black), move layer down, transform to make it look like a drop shadow?
or easier to use a third party filter to create a grid, use another third party filter to get rid of the white background of the grid?

Andy, enjoy your break, but please come back soon ;)

PS: "fried brain" ... sounds like a nice painting :D as soon as I'll get my AR preferences restored I'm gonna work on a Fried Brain painting!! :D

AndyRage
07-13-2011, 09:42 AM
If you want the entire drop-shadow script, it looks like this:




//================================================== =========================
//================================================== =========================
// ArtRage Script File.
//================================================== =========================
//================================================== =========================

//================================================== =========================
// Version Block - Script version and ArtRage version:
//================================================== =========================
<Version>
ArtRage Version: ArtRage 3 Studio Pro
ArtRage Build: 3.5.0
Professional Edition: Yes
Script Version: 1
</Version>

//================================================== =========================
// Header block - Info about the painting/person who generated this script:
//================================================== =========================
<Header>
// === Project data
Painting Name: "Untitled"
Painting Width: 1479
Painting Height: 1122
Painting DPI: 72
// === Author data
Author Name: "Andy Bearsley"
Script Name: "Drop Shadow"
Comment: "This script will generate a drop shadow for the current layer"
Script Type: ""
Script Feature Flags: 0
</Header>

//================================================== =========================
// ArtRage project features. Sets the startup state of the script:
//================================================== =========================

//================================================== =========================
// Script data follows:
//================================================== =========================
<Events>
int nLayer = CurrentLayerIndex()
string sLayerName = LayerName(nLayer)
string sMessage = "Drop Shadow settings for layer %%nLayer"
if (sLayerName.Length() > 0) {
sMessage += " ( %%sLayerName )"
}
// Check we can run on this layer (paint, text, or sticker)
int nLayerType = LayerType(nLayer)
if (nLayerType != 0 && nLayerType != 4 && nLayerType != 5) {
MessageBox("This script wont work on layer groups. (Layer %%nLayer)")
exit
}
real rShadowRadius = 10
real rShadowOpacity = 0.7
real rShadowOffX = 10
real rShadowOffY = 10
flag fMergeResult = true
// Get the user data
InputBox(sMessage + "\n\rShadow Radius (1 to 100): $$rShadowRadius\n\rShadow Opacity (0 - 1): $$rShadowOpacity\n\rShadow Offset X (-100 to 100): $$rShadowOffX\n\rShadow Offset Y (-100 to 100): $$rShadowOffY\n\rMerge Result: $$fMergeResult")
// Clamp user data to sensible ranges.
if (rShadowRadius < 0) rShadowRadius = 0
if (rShadowRadius > 10) rShadowRadius = 10
if (rShadowOpacity < 0) rShadowOpacity = 0
if (rShadowOpacity > 1) rShadowOpacity = 1
if (rShadowOffX < -100) rShadowOffX = -100
if (rShadowOffX > 100) rShadowOffX = 100
if (rShadowOffY < -100) rShadowOffY = -100
if (rShadowOffY > 100) rShadowOffY = 100
// Apply drop shadow
Wait: 0.000s EvType: Command CommandID: CID_DuplicateSpecificLayer ParamType: uint32 Value: { nLayer }
Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { nLayer }
if (nLayerType != 0) {
Wait: 0.000s EvType: Command CommandID: CID_RasteriseSpecificLayer ParamType: uint32 Value: { nLayer }
}
Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000000 Idx: nLayer Contrast: 0 Brightness: -1 Saturation: 0 Hue Shift: 0 Flatten: YES Colourize: NO
Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000002 Idx: nLayer Blur Radius: rShadowRadius
Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerOpacity ParamType: LayerProp Value: { nLayer, rShadowOpacity }
Wait: 0.000s EvType: Command CommandID: LayerXForm Idx: nLayer Scale: (1, 1) Rot: -0 Off: (rShadowOffX, rShadowOffY) MirH: NO MirV: NO Ras: NO
// Apply merge if needed
if (fMergeResult) {
Wait: 0.000s EvType: Command CommandID: CID_MergeSpecificLayerDown ParamType: uint32 Value: { (nLayer + 1) }
}
// Fix names if not merged, then select the original layer.
if (!fMergeResult) {
Wait: 0.000s EvType: Command CommandID: LayerName Idx: nLayer Name: (sLayerName + " Shadow")
Wait: 0.000s EvType: Command CommandID: LayerName Idx: (nLayer + 1) Name: sLayerName
Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { (nLayer + 1) }
}




It's a bit more intelligent than just doing the shadow. It prompts for user input, checks layer type in case it needs to rasterize (text or sticker layer) to get the duplicate layer to blur and adjust, optionally merges the result, and gives sensible names to the shadow layer.
If you're copying the code from this window, make sure you save it as a unicode UTF16 file.

Strandy
07-13-2011, 07:14 PM
Thank you very much for your first procedural tool Andy.
It produces just superb soft shadows! :) Looking forward to see more :)

Please give us some ability to generate custom scripts like this. Even if that takes a bit more time. We will wait :)

Here is before and after:

57706

MattRage
07-13-2011, 09:16 PM
Well actually... For the code-minded among you, you can generate custom scripts already. Scripts are basically text files, and at the end of the scripting section in the manual you'll find a link to the Scripting Guide which explains how the system works.

In the future we will be introducing other types of script recording that may be more appropriate for recording procedures like this, but the ability to write them now is already there.

Glad you like the current ones, we hope to be able to release more in the future (there will be an official Scripts page and Packages page soon, once we've finished off the release process of 3.5).

Someonesane
07-14-2011, 02:28 AM
So it seems that if we remove the <StartupFeatures> block, we can allow for the script to play over what's already on the canvas, right? I'm sure there's more to it, but it seems to be working.

Strandy
07-14-2011, 03:19 AM
...and at the end of the scripting section in the manual you'll find a link to the Scripting Guide which explains how the system works...

:o I know the rule ALWAYS READ THE MANUAL FIRST guys. I just didn't realize one could release update of the program and of the docs simultaneous...This does probably nobody else... Actually I don't know whether I'm more embarrassed or very positive surprised...:o

Thank you very much :)

terrygillooly
07-14-2011, 06:48 AM
Someonesane, that Copy/Paste thing is just... devious :D How on earth did you come up with that?

Andy, thanks for posting the DropShadow script. It's great! I'm waiting eagerly (but patiently ;)) for the other scripts.

And the answer to my question:


Is there a way to run a script and have it act upon a currently active painting rather than a blank canvas or the painting that was saved with the script?


In the <HEADER></HEADER> section, set Script Feature Flags to 0:



<Header>

blah
blah
blah
Script Feature Flags: 0
</Header>

AndyRage
07-14-2011, 09:19 AM
Oh you kids.... leaping in and getting ahead of the days lessons. :)

The startup features is a binary block (encoded into the unicode character block 0x02500 so it can be edited and wont wreck your text editors...) which contains a mini project file. It has the tool settings, paper settings and the like. If you're doing a 'procedural' script, you absolutely dont need it at all.
In a future release we'll add the ability to select what features (if any) you want in the startup block. Often you just want the tool settings and dont care about anything else.

We're about to add a special section to the forum for talking about scripting - I'll post the other procedural scripts there. I'll also give some useful tips on creating scripts, and debugging when it all goes horribly horribly wrong.

terrygillooly
07-14-2011, 09:41 AM
...debugging when it all goes horribly horribly wrong.

Oh, I'm sure that's unlikely to ever happen... :rolleyes:

PS Is there a way to get the color information of a specific pixel on the canvas, and put that information in a variable?

Someonesane
07-14-2011, 09:50 AM
Someonesane, that Copy/Paste thing is just... devious :D How on earth did you come up with that?


I don't know really... It probably has something to do with videos games and the Flash ActionScripting I used to do. Video games, because I play a lot of games that requires quick thinking, and anticipation of what's about to happen next (especially in multiplayer games). ActionScripting, because I used to mess around with creating simple games and whatnot (so step by step instructions are ingrained).


Andy, thanks for posting the DropShadow script. It's great! I'm waiting eagerly (but patiently ;)) for the other scripts.

And the answer to my question:

In the <HEADER></HEADER> section, set Script Feature Flags to 0:Hmm... Yeah, that does allow for the current image to remain there. However, if the user is using their own canvas type, the script is going to change it to the one you used (Note: I'm referring to the canvas texture, not the Layer texture). By removing the <StartupFeatures> code block, the canvas texture of the user is left alone. But again... I'm not sure whether it's a good idea to do that, or not. I only did it, because I saw that it wasn't present in Andy's Drop Shadow Script, and since that script leaves the current art there and added to it, I went with that.

(EDIT) - That's what I get for walking away from my computer, while posting... Cross posted, lol.

Also, I think I saw something in the script guide about color selection. I'll have to look through it again, though.

AndyRage
07-14-2011, 10:02 AM
Oh, I'm sure that's unlikely to ever happen... :rolleyes:

PS Is there a way to get the color information of a specific pixel on the canvas, and put that information in a variable?

The short answer is 'not yet', but will be added in a future update.
The long answer is: Select the sample tool, do a stroke event on the point, access the colour information through the scripting calls in 'Paint colour calls' section of the scripting guide. (ColourH(), ColourL(), ColourS(), ColourR(), ColourG(), ColourB(), ColourMetal(). Note the evil use of British English spelling of Colour. )

terrygillooly
07-18-2011, 01:39 PM
The short answer is 'not yet', but will be added in a future update.
The long answer is: Select the sample tool, do a stroke event on the point, access the colour information through the scripting calls in 'Paint colour calls' section of the scripting guide. (ColourH(), ColourL(), ColourS(), ColourR(), ColourG(), ColourB(), ColourMetal(). Note the evil use of British English spelling of Colour. )

Hm, doing a stroke event doesn't seem to work. Is there something wrong with my script?



<Header>
Script Feature Flags: 0x000000015
</Header>


<Events>

real rHue = 0
real rRed = 0
real rGrn = 0
real rBlu = 0


//Fill the layer with 50% Gray (note the proper American English spelling of 'grey')
SetColourRGB(0.5,0.5,0.5)
Wait: 0 EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4921 (Fill Tool ) }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E65 (Opacity), 1.0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E57 (Spread), 0.0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E47 (Blend Mode), 1 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E58 (Antialias Edge ), 0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E44 (Single Layer), 1 }
<StrokeEvent>
Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>
MessageBox("switching foreground color to red")

//Set foreground color to Red
SetColourRGB(1,0,0)


//Take a color sample
Wait: 0.000s EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4909 (Color Sampler) }
Wait: 0.000s EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E44 (Single Layer), 1 }
Wait: 0.000s EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E45 (With Lighting), 0 }
<StrokeEvent>
Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>


//Read and give feedback on foreground color... it's red!
rHue = ColourH(); rRed = ColourR(); rGrn = ColourG(); rBlu = ColourB()
MessageBox("Foreground color after using Color Sampler: Hue=%%rHue, R=%%rRed, G=%%rGrn, B=%%rBlu")

AndyRage
07-18-2011, 08:42 PM
For a stroke event to occur, it needs a stroke header, as well as a stroke point:



<StrokeEvent>
<StrokeHeader>
<EventPt> Wait: 0.000s Loc: (x, y) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO </EventPt>
</StrokeHeader>
Wait: 0.000s Loc: (x, y) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>


Give that a whirl.

MSIE
07-19-2011, 01:45 AM
Andy: "Note the evil use of British English spelling of Colour."
Terry: "note the proper American English spelling of 'grey'"
/me chuckles ... :D

thank you Andy for the intelligent drop shadow script :cool: and all the other scripts you've already posted elsewhere! :) :)

terrygillooly
07-19-2011, 10:30 AM
Andy, it still doesn't work :confused:

MSIE, you caught me ;)


<Header>
Script Feature Flags: 0x000000015
</Header>


<Events>

real rHue = 0
real rRed = 0
real rGrn = 0
real rBlu = 0


//Fill the layer with 50% Gray (note the proper American English spelling of 'grey')
SetColourRGB(0.5,0.5,0.5)
Wait: 0 EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4921 (Fill Tool ) }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E65 (Opacity), 1.0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E57 (Spread), 0.0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E47 (Blend Mode), 1 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E58 (Antialias Edge ), 0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E44 (Single Layer), 1 }
<StrokeEvent>
<StrokeHeader>
<EventPt> Wait: 0.000s Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO </EventPt>
</StrokeHeader>
Wait: 0.000s Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>


//Set foreground color to Red in order to test if Color Sampler works
MessageBox("switching foreground color to red")
SetColourRGB(1,0,0)


//Take a color sample of the gray background
MessageBox("Taking a color sample at (20,20); this should set the foreground color to gray.")
Wait: 0.000s EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4909 (Color Sampler) }
Wait: 0.000s EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E44 (Single Layer), 1 }
Wait: 0.000s EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E45 (With Lighting), 0 }
<StrokeEvent>
<StrokeHeader>
<EventPt> Wait: 0.000s Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO </EventPt>
</StrokeHeader>
Wait: 0.000s Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>


//Read and give feedback on foreground color... nargh! It's red!
rHue = ColourH(); rRed = ColourR(); rGrn = ColourG(); rBlu = ColourB()
MessageBox("Foreground color after using Color Sampler: Hue=%%rHue, R=%%rRed, G=%%rGrn, B=%%rBlu")
//

AndyRage
07-19-2011, 11:32 AM
Ah - looks like the sampler tool is not processed correctly by script playback. I'll add this to the buglist and update for the upcoming point release.

So both the short and the long answer are currently 'no'. :o

AndyRage
07-19-2011, 12:04 PM
Okay, since you asked me so nicely....

In the next point release you'll have a shiny new function:
SampleColour(x, y)
which will use the current sample tool settings to sample the canvas at point x, y, and update the current colour and metallic.

So in the next point release of ArtRage you can replace all this:



<StrokeEvent>
<StrokeHeader>
<EventPt> Wait: 0.000s Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO </EventPt>
</StrokeHeader>
Wait: 0.000s Loc: (20, 20) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>


with this:
SampleColour(20, 20)
Note that the sample tool doesn't need to be selected before you use the SampleColour statement. It will work regardless of whatever is the current tool. But it would pay to ensure the sample tool does have the settings you expect with regard to single layer and with lighting early in your script.

terrygillooly
07-19-2011, 01:26 PM
Shiny new function looks most excellent.

Andy, thanks for being so patient with all these questions.

You know that's only going to lead to more questions, right? Questions such as: is there a way to retain changes in tool or canvas settings after the script terminates?

AndyRage
07-19-2011, 01:39 PM
You know that's only going to lead to more questions, right? Questions such as: is there a way to retain changes in tool or canvas settings after the script terminates?

There currently isn't any way. I was getting annoyed with the test scripts screwing my workspace all the time. :)
So for the moment, your current state is saved before running a script, and restored when the script is stopped.
There will likely be a future option to have scripts of a defined type for setting up workspace settings, but for the moment that option isn't available.

terrygillooly
07-27-2011, 10:05 AM
Very excited to have 3.5.1 (I may possibly need a life?), but having problems with the feedback I get from sampling white (HLS=0,1,0).

If I use SampleColour(x,y), then test the resulting Luminance with ColourL(), I get a weird result (something like 0.003) when I should get 1.


<Header>
Script Feature Flags: 15
</Header>



<Events>
real rLum = 0


//Fill background with white
SetColourHLS( 0, 1, 0 )
Wait: 0 EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4921 (Fill Tool ) }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E65 (Opacity), 1 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E57 (Spread), 0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E47 (Blend Mode), 1 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E58 (Antialias Edge ), 0 }
Wait: 0 EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E44 (Single Layer), 1 }
<StrokeEvent>
<StrokeHeader>
<EventPt> Wait: 0.000s Loc: (11, 11) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO </EventPt>
<Recorded> No </Recorded>
</StrokeHeader>
Loc: (11, 11) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
Loc: (11, 11) Pr: 1 Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>


//Change foreground color to green
SetColourHLS( 0.33, 0.44, 0.66 )


//Sample color--is it correct?
Wait: 0.000s EvType: Command CommandID: CID_ToolSelect ParamType: ToolID Value: { 4909 (Color Sampler) }
Wait: 0.000s EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E44 (Single Layer), 1 }
Wait: 0.000s EvType: Command CommandID: SetToolProperty ParamType: ToolProp Value: { 0x0B2D05E45 (With Lighting), 0 }

SampleColour(11,11)
rLum = ColourL()
MessageBox("Background filled with HLS=0,1,0\nSampled Luminance: %%rLum")

crgreen
07-27-2011, 10:21 AM
Is there a way to run a script and have it act upon a currently active painting rather than a blank canvas or the painting that was saved with the script?

I found that if I open an existing/recorded script and change the "Script Feature Flags:" value in the Header to:


Script Feature Flags: 0x00000FFFF, then it works on whatever is already open. Very cool.

-crg

[update: oh, I see I missed the existing solution to this. Sorry. Now let's see if I can find my feature request before I post another unnecessary question ....]

[update 2: And thanks to Terry in the following post for pointing out that this ("0x00000FFFF")solution allows for the introductory box to show, whereas the other solution does not]

terrygillooly
07-27-2011, 11:20 AM
crg, that is an awesome discovery, because it will show the Introductory box, unlike the other method.

AndyRage
07-27-2011, 12:03 PM
Very excited to have 3.5.1 (I may possibly need a life?), but having problems with the feedback I get from sampling white (HLS=0,1,0).

If I use SampleColour(x,y), then test the resulting Luminance with ColourL(), I get a weird result (something like 0.003) when I should get 1.


Grargh!
Okay, there is a bug with sampling pure white - it divides the Luminance value by 255. All other colours should be fine - it special-cases pure white and pure black to avoid some math and in testing I missed pure white.
So... next update will have that bug solved. In the meantime if you're using sample colour and you get a luminance value of 1/255 you will need to check R G or B to see if they're 1 (in which case your L value should have been 1 as well).

I'm very sorry about that. The next point release will have that problem solved.

terrygillooly
07-27-2011, 07:31 PM
Well, at least it wasn't me. :rolleyes:

And sorry, I have another question :o: is there a way to tell if a point is inside a selection?

AndyRage
07-27-2011, 09:16 PM
Well, at least it wasn't me. :rolleyes:

And sorry, I have another question :o: is there a way to tell if a point is inside a selection?

Currently there isn't a way to determine if a point is inside the selection set.
I mean, you could do it in a very roundabout kind of way (involving filling a layer, cutting the selection, testing the colour, deleting the layer...) but there isn't anything in the scripting language for that.

Lima
07-27-2011, 10:28 PM
Andy, this is a fantastic amazing addition to the program congratulations to you all. Terry, is giving a large and valuable script contribution. Congratulations Terry and thank you for showing us your work.

Finally I think I found the correct way to use the scripts. I have a question that is related to the time expent to record a given script. For example, a painting can take a long time to be made and so it is performed in different interrupted stages. It seems that once stopped the registration recording of a given script, it can not be resumed at a future(s) session(s) of painting. Is this true?

Someonesane
07-28-2011, 01:49 AM
It seems that once stopped the registration recording of a given script, it can not be resumed at a future(s) session(s) of painting. Is this true?

Hi Lima,

If you stop a recording using the stop button on the recording panel, you will end that recording session, and be unable to resume it. If you've done this by mistake, what you could do, is reopen your painting (if it's not already opened), and start a new recording session, that you would then have to splice in with the other recorded .arscript. When you begin the new recording, you'll be given the option to "Include Current Painting". Check mark that option, and begin recording again. When you're done, you'll then have edit the two .arscript recordings, into a single file.

To forgo all of that work, however, a recording may be saved, and resumed again, with a painting. So let's say you've been painting for an hour, and have been recording a script for it, but you want a break and do not wish to stop the recording. What you'll want to do is go directly to File > Save Painting AS (DO NOT STOP THE RECORDING). By not stopping the recording before saving, ArtRage assumes that you will wish to continue the currently recording script, and saves it's progress along with your painting. When you're ready to begin again, you'll only need to reopen your painting, and begin working again, because the recording session will be automatically running.

Lima
07-29-2011, 09:01 AM
Someone, terrific, thank you very much indeed.:):):)

terrygillooly
08-01-2011, 12:16 PM
Thanks, Lima :)

terrygillooly
08-02-2011, 12:49 PM
There are two things I would like to be able to do with selections (without having to resort to workarounds :mad:):

-Fill Selection with foreground color* and

-use Modes (e.g. Add, Subtract, etc) with Select Layer Contents.

I don't think these are currently possible. Are they reasonable to implement?



*squeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

eduardobedoya
12-08-2012, 04:31 AM
Hi dear Someonesane and AndyRage, congrats for the great software.

I usually record portrait paintings, (It take me a while to know how to do it whitout stoping the recording n recording again 111times xD), my issue is that while painting I tent to swich between oilbrush presets, my question is: there is a way to record a procedural script and asign a shorcut to it, and apply it many times without interfiering an actual recording painting sesion?

Thanks in advanced, sorry mi english.

DaveRage
12-10-2012, 06:11 PM
Hi there,

It's not possible to play a script while recording another script, so you wouldn't be able to do that. You can assign a shortcut to playing script via Edit -> Set Keyboard Shortcuts in the 'scripting' section, but it's not possible to assign a keyboard shortcut to playing a specific script.

nordwick
07-02-2013, 01:47 AM
Hi, everybody

Why are original (1) and script-made (2) paintings different?
(There are depth and/or texture differences ...
The (2) is a lot "softer"
I used only "paint-tube" and "palette knife". (AR 3.5 pro)

7609276093

thank you in advance

MattRage
08-20-2013, 03:00 PM
We're not sure what caused the difference here - Is it possible that paper settings were different between the two samples? In theory the differences you'll see when playing back a script should only relate to values that have some sort of random component such as bristle patterning which isn't present here so as far as we can tell so far there shouldn't be a difference.

Zeropainter
10-22-2013, 11:48 PM
Is it possible that once a day we can use scripting like Macros in Photoshop? Because script running dose close the current artrage .ptg file, but it would be nice, if once a day we can use scripting like photoshop macro.

E.g. I was apinting clouds today and it would be cool if I can dupplicate 5-6 times a layer by script. But its nonsense, because I get every time a new document :rolleyes:

DaveRage
10-23-2013, 04:27 PM
Scripts which are recorded will always open a new painting. However, you can program scripts which can be played back without a new painting being created.

See here for a script which does that and applies a dropshadow to the contents of the current layer:

http://forums.artrage.com/showthread.php?35940-Dropshadow-Script-ArtRage-Studio-Pro-only

You can find more information on script programming in the advanced scripting guide here:

http://www.artrage.com/files/artrage_advancedscriptingguide.pdf

I believe that it relates to setting the 'script feature flags' line in the header to 0, but I'll see if I can get some clarification on that.

DaveRage
10-24-2013, 12:11 PM
That's correct, setting the script feature flags to zero will allow it run on an existing painting.

If you want to reduce the size of the script you can also edit out the block surrounded by <StartupFeatures> ...
</StartupFeatures>

However, that will remove all tool and paint settings from the startup of your script so you would need to explicitly record setting the tool, size and choosing a colour before painting. This way the action script will still be small, and will correctly apply the result to your existing painting.

Script programming isn't something we can provide detailed support for, but I hope this is of some help. The guide linked in my previous post goes into more detail.

arteo
12-20-2013, 09:38 PM
just have a look at it!