Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 46

Thread: Questions About Scripting

  1. #11
    Join Date
    Jun 2011
    Location
    Hamburg Germany
    Posts
    472

    superb soft shadow

    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:

    Name:  Smiley.jpg
Views: 369
Size:  17.6 KB

  2. #12
    Join Date
    Mar 2006
    Location
    New Zealand
    Posts
    3,215
    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).

  3. #13
    Join Date
    Oct 2007
    Location
    NC, USA
    Posts
    2,872
    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.
    Nothing is easy to the unwilling.

  4. #14
    Join Date
    Jun 2011
    Location
    Hamburg Germany
    Posts
    472
    Quote Originally Posted by MattRage View Post
    ...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...
    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...

    Thank you very much

  5. #15
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139

    Lightbulb

    Someonesane, that Copy/Paste thing is just... devious 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:

    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?

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

    <Header>
    blah
    blah
    blah
    Script Feature Flags: 0
    </Header>
    Last edited by terrygillooly; 07-14-2011 at 07:54 AM. Reason: prettification
    Cat Boxes, a web comic

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

  7. #17
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139
    Quote Originally Posted by AndyRage View Post
    ...debugging when it all goes horribly horribly wrong.
    Oh, I'm sure that's unlikely to ever happen...

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

  8. #18
    Join Date
    Oct 2007
    Location
    NC, USA
    Posts
    2,872
    Quote Originally Posted by terrygillooly View Post
    Someonesane, that Copy/Paste thing is just... devious 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.
    Last edited by Someonesane; 07-14-2011 at 10:54 AM.
    Nothing is easy to the unwilling.

  9. #19
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,857
    Quote Originally Posted by terrygillooly View Post
    Oh, I'm sure that's unlikely to ever happen...

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

  10. #20
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139
    Quote Originally Posted by AndyRage View Post
    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?

    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>
      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")
    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
  •