mahvin wrote:
Saulgoode: that seems to work, so the clincher was getting the active layer first. I still don't understand how just simply using the toggles caused the first variation to "break".
No offense intended toward Micomicom -- I believe this charcoal script was his first ever -- but there is some margin for improvement in his technique (

) and, combined with the code which you added, I got lost in keeping track of what layer was what in his code. Furthermore, there is a peculiarity in my Extend Layer script (which I should probably re-think) and all of this amalgamated into a cascading succession of failures which, ironically, led to your script actually working (can you tell I used to be a rocket scientist).
Technical explanation (about 20 times more complicated than if we all did things right):
At the point in the script where you wish to scale the layer to the image size, the variable 'drawable' is set to micromicom's original 'charcoal-layer'. However, the active layer will be either 'charcoal-layer' (if no new layer was created) or 'layer-charcoal' (the new layer your added code introduced).
The reason my Extend Layer script functioned properly with your call is because it actually ignores the second parameter passed to it and instead retrieves the image's active layer. Thus the Extend Layer script worked when you passed 'drawable' (i.e., 'charcoal-layer') to it because it was operating on the active layer ('layer-charcoal', your newly created layer). If my script actually honored the second argument, your call would not have worked because 'drawable' was not set to the new layer ('layer-charcoal') but to the original 'charcoal-layer'.
As to why my script ignores the second parameter, my reasoning was that if a layermask were active when the script was called, the second parameter would be the ID of that mask; but in such a situation I would want my script to extend/scale the layer corresponding to the mask, not the mask itself. I thought I would be cute and use 'gimp-image-get-active-layer' to retrieve this layer (if a mask is the active drawable, its associated layer is the active layer). This works great if the script is invoked from the menus, but I did not really consider the case of my script being called from another script (who would ever do such a thing?!) -- though I should have.