08-31-2017, 02:44 PM
A quick observation is that the procedure browser entry for gimp-floating-sel-to-layer shows that it doesn't return the id of the new layer - but just makes it the active layer, so you will have to set VARIABLE2 to the currently active layer using gimp-image-get-active-layer