ID:264948
 
Code:
mob
verb
AdvancedFlick(T as text)
for(var/advancedflick/E in advancedflicks)
if(E.name == T)
var/myicon = icon
var/myiconstate = icon_state
icon = E.icon
pixel_y = -32
pixel_x = -32
flick(E.icon_state,src)
sleep(3)
icon = myicon
icon_state = myiconstate
pixel_y = 0
pixel_x = 0


Problem description:

There's a delay between the icon being set and the pixel_y, causing some flickering issues. I can't figure any way to work around it.

It's due to the sleep() holding up the for() for 3 ticks while looping through.

Fix: Change it to spawn(3) AND INDENT EVERYTHING BELOW IT. If you do not indent the event under the spawn(), it'll not happen after 3 ticks - instead, it'll happen right away.
In response to GhostAnime
GhostAnime wrote:
It's due to the sleep() holding up the for() for 3 ticks while looping through.

Fix: Change it to spawn(3) AND INDENT EVERYTHING BELOW IT. If you do not indent the event under the spawn(), it'll not happen after 3 ticks - instead, it'll happen right away.

I've tried this, it's not the problem, and it makes no difference.
How big are the icons? Do you mean delay between i.icon = E.icon and pixel_y=-32?

Also, what are the flicks, are they all animations, or are they just frames
In response to GhostAnime
sleep(3)'s not between the icon being set and the pixel_y changing
In response to Ill Im
Ill Im wrote:
How big are the icons? Do you mean delay between i.icon = E.icon and pixel_y=-32?

Also, what are the flicks, are they all animations, or are they just frames

The icons change sizes. The flicks are animations, but they could just be still frames.
It may be because they're different sizes; I've experienced delay problems because the icon was a different size before (like, for example, if you use rgb on a big icon), this may have been fixed; not sure. Does it also do this with icons of the same size?
In response to Ill Im
No, but that'd defeat the whole point of this, which is to flick to an icon of a larger size.
You could create an invisible object of the larger size and pixel-offset it. Make it visible for the duration of the animation, then make it invisible again.
In response to Hazman
This is actually a great idea. I forsee a few small issues though
It will flicker regardless, unless you have a premade object already there (like, there before you even call the procedure, or you'll have a small delay before the procedure st arts). BYOND doesn't handle big icons well, it just allows them.