Continuous print

Monkey Forums/Monkey Programming/Continuous print

Ken(Posted 2013) [#1]
Hiya,

Just curious...in old BASIC languages, they automatically appended a '\n' at the end of what you were printing. That could usually be defeated with some puncuation at the end of the string:

print "Hello ",
print "World."

Would, of course, print "Hello World."

Now, the docs say print is platform specific, and sort of leave it at that.

Is there continuous printing supported by Print?

Why? I'm loading glyphs from a file, and I'd like to have something to do to while the time away...like watching dots crawl across the screen.

Hrm...if I'm in the middle of processing, loading these glyphs...would an Update method get called if I set my scan rate? If it did, I could animate something, draw the dots there, whatever.

Thanks,

-Ken


muddy_shoes(Posted 2013) [#2]
If you want to incrementally print then you just need to concatenate the string yourself.

Monkey is single threaded at the game app level and your processing will block updates/renders if you do it in one large chunk.


Ken(Posted 2013) [#3]
Ah, right, that's what I thought...so I should set it up to process a couple of letters on each OnUpdate or something, right?

I started out looking for a timer, or asynch codes...and then realised that if I have a fast update loop, it's almost the same thing, and the code get much easier to understand.

-Ken


muddy_shoes(Posted 2013) [#4]
I'd normally look to create a Function/Method that looks something like:

Function Int:LoadAssets( maxChunkTimeMS:Int )


Takes in a time allowance, returns a percentage completion. Internally just loops through loading tasks until the elapsed time is greater than the allowance and then returns the progress value for updating the progress indicator. Keep calling it in OnUpdate or OnRender until it returns 100 and then move the game to the start menu state or whatever.