RSS/Atom feed Twitter
Site is read-only, email is disabled

From script-fu to tiny-fu, first problems...

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

From script-fu to tiny-fu, first problems... Ismael Valladolid Torres 20 Nov 15:28
  From script-fu to tiny-fu, first problems... Sven Neumann 20 Nov 16:13
   From script-fu to tiny-fu, first problems... Ismael Valladolid Torres 20 Nov 17:04
  From script-fu to tiny-fu, first problems... Simon Budig 20 Nov 17:00
   From script-fu to tiny-fu, first problems... Ismael Valladolid Torres 20 Nov 18:19
Ismael Valladolid Torres
2006-11-20 15:28:48 UTC (over 17 years ago)

From script-fu to tiny-fu, first problems...

Concerned by the fact that my developed script-fu which used to do the thing nicely in previous GIMP versions, no longer works with 2.3, and also by the fact that it seems like script-fu is no longer being supported in favour of tiny-fu, I am trying to turn my script-fu into a shiny tiny-fu.

To serve as a guideline, I am seeing default scripts. As an example, it seems like addborder.sct and addborder.scm are the same script, where simply all ocurrences of script-fu have been replaced into tiny-fu. I've done the same with my script but when launched it complains:

Error while executing (load "C:\\cygwin\\home\\ivt351\\.gimp-2.3\\scripts\\analogize.sct")

Error: eval: unbound variable:

I am using GIMP 2.3.11 on Windows 2000. Find attached the non-working tiny-fu analogize.sct.

Any ideas, comments and suggestions are welcome.

Cordially, Ismael

Sven Neumann
2006-11-20 16:13:00 UTC (over 17 years ago)

From script-fu to tiny-fu, first problems...

Hi,

On Mon, 2006-11-20 at 15:28 +0100, Ismael Valladolid Torres wrote:

Concerned by the fact that my developed script-fu which used to do the thing nicely in previous GIMP versions, no longer works with 2.3, and also by the fact that it seems like script-fu is no longer being supported in favour of tiny-fu, I am trying to turn my script-fu into a shiny tiny-fu.

We have merged the Tiny-Scheme interpreter into Script-Fu in the meantime. That means that Tiny-Fu doesn't exist any longer. Scripts with the .sct extension are not going to be recognized by GIMP 2.4.

Sven

Simon Budig
2006-11-20 17:00:26 UTC (over 17 years ago)

From script-fu to tiny-fu, first problems...

Ismael Valladolid Torres (ivalladolidt@terra.es) wrote:

To serve as a guideline, I am seeing default scripts. As an example, it seems like addborder.sct and addborder.scm are the same script, where simply all ocurrences of script-fu have been replaced into tiny-fu. I've done the same with my script but when launched it complains:

Error while executing (load "C:\\cygwin\\home\\ivt351\\.gimp-2.3\\scripts\\analogize.sct")

Error: eval: unbound variable:

Actually the naming is not that important: In current CVS all the scripts have the script-fu prefix again although the interpreter has been changed to tinyscheme, no need to change the names.

There is one significant difference though:

(define (tiny-fu-analogize img
drawable
contrast
saturation
bright-opacity
shadow-opacity
duplicate-shadow
flatten
copy)

(set! image (if (= copy TRUE) (car (gimp-image-duplicate img)) img))

(gimp-image-undo-group-start image)

(set! layer (car (gimp-image-flatten image))) (set! image-width (car (gimp-image-width image))) (set! image-height (car (gimp-image-height image)))

[...]

Here you define ("assigning a value") a variables before declaring ("making the variable known to the interpreter") them. This used to work with the SIOD-interpreter of the old script-fu but is considered very broken, because it pollutes the namespace. With the tinyscheme interpreter all variables have to be declared before they can be (re)defined. I suggest that you look at other scripts how they use the let*-construct to simultaneously declare and define variables.

In your case you probably have to assign a lot of dummy-values to the declared variables, since you invoke the undo-group-start on the image very soon. But if the variables are declared in the let*-block you can later use set! to assign new values to them.

(cond ((= duplicate-shadow TRUE)
(set! shadow-layer2 (car (gimp-layer-copy shadow-layer 0))) (gimp-image-add-layer image shadow-layer2 0)))

you can also use (if (condition) (if-part) (then-part)) here, that would make your script a bit more easy to read.

I hope this helps, Simon

Ismael Valladolid Torres
2006-11-20 17:04:00 UTC (over 17 years ago)

From script-fu to tiny-fu, first problems...

Sven Neumann escribe:

We have merged the Tiny-Scheme interpreter into Script-Fu in the meantime. That means that Tiny-Fu doesn't exist any longer. Scripts with the .sct extension are not going to be recognized by GIMP 2.4.

Thanks for the info, anyway any idea why my script could be failing?

Cordially, Ismael

Ismael Valladolid Torres
2006-11-20 18:19:47 UTC (over 17 years ago)

From script-fu to tiny-fu, first problems...

Simon Budig escribe:

Here you define ("assigning a value") a variables before declaring ("making the variable known to the interpreter") them. This used to work with the SIOD-interpreter of the old script-fu but is considered very broken, because it pollutes the namespace. With the tinyscheme interpreter all variables have to be declared before they can be (re)defined. I suggest that you look at other scripts how they use the let*-construct to simultaneously declare and define variables.

Amazingly, this was and end-of-line problem: The script was downloading with UNIX end-of-line and it wasn't working on GIMP for Windows as it expects DOS end-of-line.

I also had to declare variables using let* and changing gimp-palette-set-foreground into gimp-context-set-foreground. Now the script works and, eh, much faster than previously using script-fu!

I hope this helps,

It helped, thanks a lot for the feedback.

Cordially, Ismael