//"ChatList" is a list of 10 text vars, representing the last
//10 things sent to the chat box.
FadeText(mob/u)
var/list/x = u.ChatList
spawn(10)
//if the list hasnt changed since the proc was called
if(x == u.ChatList)
for(var/GUI/Text/msg in u.ChatList)
//fade everything
animate(msg, alpha = 0, time = 4)
Problem description:
FadeText() is called whenever I want to "fade" all GUI maptext of a certain kind. But there may be many things calling this proc more or less at once - so I need to make sure I only execute the proc ONCE when the proc hasn't been called in the last second. If it keeps getting called - so be it, the GUI stays there.
This is basically supposed to be code to cause the GUI to fade out on inactivity.
In the above method, I'm trying to see if the contents of List1 are the same as List2. Ideally the only way it would fail is if someone spammed the exact same thing over and over 10+ times - for which I would handle seperately.
Is there maybe a better method of doing this, instead?
This is especially pronounced for the anticipated fade time of about 5 seconds when out of testing.
It really needs to only call animate() from the most recent action, and when it does -- it needs to call everything in ChatList/all instances visible to the player.
Side note - is it possible to interrupt animate()? So that it stops what its doing?