It is currently Sat Sep 19, 2026 3:37 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: String problem [Solved by perseverance]
PostPosted: Sat Sep 01, 2012 9:21 pm  (#1) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
GIMP Version: 2.6.11 2.8
Operating System: Windows
OS Version: Win7
GIMP Experience: Basic Level



I have a problem with this command (gimp-drawable-set-name bkg-layer name-string)

I would like to set the name-string = ("background" random_gradient, gradient-type)

random_gradient and gradient-type are strings. Wilbur has scoffed at all my attempts

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Last edited by Graechan on Sat Sep 01, 2012 11:38 pm, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: String problem
PostPosted: Sat Sep 01, 2012 10:48 pm  (#2) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5241
Location: Gimpville
According to the 2.8.2 PDB, that procedure has been been depreciated.

You could use this instead.

(gimp-item-set-name bkg-layer "This is a string")

With either procedure...

In my example, the string is a constant. How are assigning a string to the name-string variable? It appears you are trying to assign multiple strings to a variable that should be a single string. Are you attempting to concatenate those strings?

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: String problem
PostPosted: Sat Sep 01, 2012 11:25 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Gnu-Tux I'm using 2-6-12, Wilbur and I have come to an agreement with this :yes

(set! random_gradient (list-ref (cadr (gimp-gradients-get-list "")) (round (random (car (gimp-gradients-get-list ""))))))
    (set! gradient-type (+ (random 2) 6))
   (gimp-context-set-gradient random_gradient)
   (gimp-edit-blend bkg-layer CUSTOM-MODE NORMAL-MODE gradient-type 100 0 REPEAT-NONE FALSE FALSE 3 0.2 TRUE (/ width 2) (/ height 2) width height)
      (set! gradient-type-name
         (cond
            (( equal? gradient-type 6 ) "GRADIENT-SHAPEBURST-ANGULAR" )
            (( equal? gradient-type 7 ) "GRADIENT-SHAPEBURST-SPHERICAL" )
            (( equal? gradient-type 8 ) "GRADIENT-SHAPEBURST-DIMPLED"  )))
            
   (set! name-string (string-append (car (gimp-drawable-get-name bkg-layer)) "-" random_gradient "-" gradient-type-name))

And at last it worked :rofl :gimp

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: String problem
PostPosted: Sat Sep 01, 2012 11:41 pm  (#4) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5241
Location: Gimpville
Yes, concatenation with string-append. :bigthup

(set! name-string (string-append (car (gimp-drawable-get-name bkg-layer)) "-" random_gradient "-" gradient-type-name))

The syntax can be a little tricky/picky. :hehe

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: String problem [Solved by perseverance]
PostPosted: Sun Sep 02, 2012 1:31 am  (#5) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16173
Awesome! :)

_________________
Image


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group