This might be something to do with the fact that all of this is happening inside an 'On Created' event in the first place.
What happens is, when my ship is created, it hops to the 'On created' code for the ship, which then creates an icon to accompany it. So the code above is itself inside the ships 'On created' code.
So the ship is created, it then creates the icon, it then sets a variable to the UID of the icon, so that they stay together and then, finally, it attempts to set the icon to an animation frame, as indicated by a variable in the newly created ship. That final part is the part which doesn't work, the rest works perfectly.
So what I have is.
Ship : On created : System Create 'Icon' (works)
Set ship variable to the new icon's UID (works)
Set the icon's frame to a variable which is entered in that ship-type in the editor (doesn't work).
If I remove that third line and put it into a 'System : Each tick' event, it then works fine. Meaning that the code to set the animation from the ship's variable is ok, it just won't do it during the creation process of the ship. It's as if the variable isn't assigned until after the 'On create' or something.
I am aware of course that the code would hop out to do an extra 'On create' for the icon, except in this case, I have no code for that. Not sure if the system hops out to do it's own internal stuff, but it hops back in and completes the 2nd line with no problems, just not the third line.