Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-caching and setting autotype in the same frame causes timers to never be incremented #45

Closed
DragoniteSpam opened this issue Mar 20, 2020 · 1 comment
Labels
bug 😅 Juju did a bad thing

Comments

@DragoniteSpam
Copy link

Here's a fun problem that I've tracked down the cause of, but don't know what a solution would be.

I like to pre-cache my scribbles when possible, to ensure that everything I pass to scribble_draw is a scribble array because that makes things easier when dealing with autotype.

var _stext = scribble_pre_cache_ui("the quick brown fox jumped over the lazy game dev");

All that script really does is set and unset the cache group, it's not that interesting.

scribble_draw_set_cache_group(ScribbleCacheGroups.UI, false, true);
scribble_draw_set_wrap(-1, width);
var scribble = scribble_draw(0, 0, text);
scribble_draw_set_cache_group(ScribbleCacheGroups.UI, true, true);
return scribble;

Anyway, I like to do this often, especially in menus and stuff.

var _stext = scribble_pre_cache_ui("the quick brown fox jumped over the lazy game dev");
if (scribble_text == undefined) {
    scribble_text = _stext;
    scribble_autotype_fade_in(scribble_text, ...);
}
scribble_draw(a, b, scribble_text);

This used to be fine, but at some point it stopped working. I'm not sure when exactly that happened, since I only noticed last night after revisiting some old code. Every time scribble_draw is called - regardless of whether the scribble is actually drawn, or anything - the scribble's "time" value is updated.

_scribble_array[@ __SCRIBBLE.TIME] = current_time;

I guess that's all right, but when it comes to autotype, it checks the scribble's delta time before actually updating it. I suppose this makes sense, because if you would try to draw the scribble multiple times in one step, it would update more times than it's supposed to. Unfortunately, when I try to draw the scribble for real immediately afterward pre-caching it (or fetching the cached version), the Scribble's delta time is always going to be zero

var _increment_timers = ((current_time - _scribble_array[__SCRIBBLE.TIME]) > __SCRIBBLE_EXPECTED_FRAME_TIME);

and the scribble autotype position remains in the purgatorial state of 0 for the [FGothic][shake][rainbow]rest of eternity.[]


My guess at what the solution to this should be would be to only set _scribble_array[@ __SCRIBBLE.TIME] (a) when the scribble is created or (b) when it's actually vertex_submitted so that it doesn't interfere with madmen like me who like to use it as a way to invisibly fetch stuff from the cache, but I don't know if there are any other reasons the time value would need to be set or not.

@JujuAdams JujuAdams added the bug 😅 Juju did a bad thing label Mar 22, 2020
@JujuAdams
Copy link
Owner

Fixed 5.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 😅 Juju did a bad thing
Projects
None yet
Development

No branches or pull requests

2 participants