Printing from _ready
will only send the value once the game starts.
Also, if you are using gdscript, you shouldn't need the ;
at the end of lines since it is coded similarly to python :)
I am not super versed in the animation stuff sadly, but one thing I noticed is that the idleLoop doesn't loop. (Unless you are calling it from the _process(delta) method or another method altogether in which case it most likely will.)
But another way you could write it is like so:
(Keep in mind that count, IdleCounter in your code, starts at 0, so if your idleCounter is supposed to be 11, it will have 12 frame to count before executing the if's part and not 11.)
func idler(duration = 0): # Feel free to rename how you'd like. The 0 is only there as a default value, so you can change it. This way you can simply call the function if you want to instantly trigger the idleFlourish.
var completed = 0 # you can change it to true or false if you prefer using a boolean when checking
for count in range(duration):
print(count)
if count >= duration:
print(count) # Just so you can see if it actually increased the count variable before executing here. Feel free to comment or remove that print if it does increase. Same with the previous print. This way you don't clutter your debug console
stateMachine.travel("IdleFlourish")
completed = 1
return completed # This way if you use print(idler()), or need to make sure it actually executed, it should return 1 which would indicate everything went through without any crash-worthy problem.
Then when you call your function from elsewhere, you can simply call idler(11) and use the return value as a way to know when the forloop is done this way you don't send the function every frame depending on where you use it.
Hopefully this helps a little.
In any case I am wishing you the absolute best and a wonderful day!