Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 46

Thread: Questions About Scripting

  1. #21
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,867
    For a stroke event to occur, it needs a stroke header, as well as a stroke point:

    Code:
    <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.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  2. #22
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    1,070
    Andy: "Note the evil use of British English spelling of Colour."
    Terry: "note the proper American English spelling of 'grey'"
    /me chuckles ...

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

  3. #23
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139
    Andy, it still doesn't work

    MSIE, you caught me

    Code:
    <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")
    //
    Cat Boxes, a web comic

  4. #24
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,867
    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'.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  5. #25
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,867
    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:

    Code:
    <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.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  6. #26
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139
    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?
    Cat Boxes, a web comic

  7. #27
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,867
    Quote Originally Posted by terrygillooly View Post
    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.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  8. #28
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139

    Is this a bug?

    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.

    Code:
    <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")
    Last edited by terrygillooly; 07-27-2011 at 10:06 AM. Reason: entitling
    Cat Boxes, a web comic

  9. #29
    Join Date
    Jul 2011
    Location
    Berkeley, CA
    Posts
    8

    hack script to make it play over exising art

    Quote Originally Posted by terrygillooly View Post
    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:

    Code:
        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]
    Last edited by crgreen; 09-06-2011 at 06:33 PM.

  10. #30
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139
    crg, that is an awesome discovery, because it will show the Introductory box, unlike the other method.
    Cat Boxes, a web comic

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •