Hello dinasset:
Ages since we've gimp-chatted; I have not visited here as frequently as I should.
Stripped to the essence, perhaps this is what you are trying to do:
#@gimp Hi world: hiworld
#@gimp : hiworld = text("Hello, world!")
#@gimp : sep = separator()
hiworld :
-v -
# Beam me up to the error console, Scotty.
-echo "$1"
-v +
But what you see on the error console ("Output messages = verbose(console)") is:
[gmic]-1./ Start G'MIC interpreter.
[gmic]-1./ End G'MIC interpreter.
which annoys, particularly when -echo seems to be advertised as just the command you need:
-echo (+):
message
Output specified message, on the error output.
(eq. to '-e').
Command selection (if any) stands for displayed scope indices instead of image indices.
This hello world filter is a bit of nefarious artifice, I confess, but fabricated to illustrate the interaction between -verbose (abbreviated -v) and -echo (abbreviated -e).
-verbose is designed to supress ("shut up") -echo commands situated too far from the calling scope. That is, when a G'MIC command -blah invokes command -foo which invokes -hahaha, the last being a command three levels removed from the calling scope of -blah, an -echo command situated within -hahaha may not print to the error console if the last -verbose command designates a scope depth shallower than 3. That is, complaints originating from -hahaha are too far removed from the interest of the (human) invoking -blah.
Now, it so happens that nearly every one of the nearly four hundred gmic-gimp scripts use the verbose command in its canonical form: -v - <script> -v + which usually shuts up -echo commands from the current scope on down. That is, to echo commands in the current scope, as well as all the deeper scopes: just shut up. -verbose supports a relative notation; "-v -" means: 'take the current scope level (whatever it is) and reduce it by one.' "-v +" takes the opposite tack. In a typical run, the scope level begins at 0, so "-v -" sets the scope to -1 and silences everything.
It is quite easy to copy those funny little marks over to your own test script because they seem important and are probably necessary for something. They are: noise suppression, but when you're testing a script you want to hear a little noise. My wont is to leave them out until I need them. You may also set the verbosity level to an absolute number -v 1000 <script> -v 0, meaning that you are interested in hearing echos, even if they're 1000 levels from your calling scope. It's not a good idea to set absolute verbosity levels when releasing a script to the world, noise supression is based on the protocol of scripts relatively dropping the scope level by one on entry and increasing it by one, relatively on exit. When testing, however, it is quite legitimate (and useful) to set the level to a particular value.
For -echo, the right hand selection set, if used, establishes if, and how many, scope levels are displayed to the left of the echo text. So if -blah calls -foo, and foo calls -hahaha, and -hahaha has -echo[0--1] "Hello world." within, then the error console will display /blah/foo/hahaha/ Hello world. (assuming the verbosity setting doesn't suppress the echo command). Similarly -echo[-1] simply places the immediate scope containing the echo command: *hahaha/ Hello world. (note the '*' indicating supressed scope levels). -echo[^-1] "Hello world." supresses the immediate scope, but admits the others: /blah/foo/ Hello world. -echo[] "Hello world." will be printed without any scope indicia: Hello world. If you're familiar with how the notation selects images, then mentally substitute 'scope' for 'image position' you won't go far wrong.
I've been bandying the word 'scope' about without saying what it is, but that is just my attempt at dramatic suspense, so as to keep you reading to the end of this rather longish post. Scope is a count of (1) the number of times commands invoke other commands, plus (2) the number of times the script enters block-oriented commands such as -if ... -endif, -repeat ... -done, -local ... -endlocal. Should ever you require the count of the scope to where a particular command executes, insert an adjacent echo command selecting scopes [0--1] and the entire scope will print out. You can also put the console into verbose (console) mode, which echoes every script line as if invoked with -echo[0--1].
Just as one might select an image that is not there, one can select a scope that is not there, an error. Thus -echo[100] "I'm a hundred decks down in the engine room and there's water coming in here!" will probably launch another torpedo if the -echo command is only 16 levels from the calling scope. Note that -verbose does not set the scope; it indicates at what scope levels from the calling scope -echo commands will be allowed to echo. Scope is an environmental condition indicating how many blocks and commands have been "entered" since the script began execution. It just happens; script writers can't change it.
I hope all this verbiage doesn't make everything entirely murky for you. For me, it is the raw stuff of another command tutorial, so thanks for asking. In the meantime, always keep
!
Garry