Windows Single stream

Z

zzzzza1

Guest
Hi all!

I make long calculations and at this time I can not draw.

Can I somehow display information about the state of calculations?

Thank you in advance!
 

RollyBug

Member
Please be more specific. What do you mean by "I cannot draw?" Are you maybe not much of an artist or is something going on preventing you from drawing in-game? And what is "the state of calculations?"
 
Z

zzzzza1

Guest
Let's say I use "while (1)", which calculate for one minute. While it's working, I can not use "Draw", since this is still one step.
And I have a need to show how many percent of the calculations are performed from 100%
 
Something that I do to see things being plotted during a for loop, is to put that data into a ds_list and then draw the list. However, this quickly leads to the screen filling up with information as steps are repeated.

So that I could see everything that was happening I eventually decided to use the file write function, and save it to a text file instead. You won't be able to see it during the process, but you can open the file afterwards and have a permanent record of what has happened.

It would be fairly slow to run in a game, but for the purposes of checking data and processes may help you.
 
Z

zzzzza1

Guest
Thanks for the advice, but I need to show the information along with the calculations.

Is it possible to do this?
 
You can see the calculations. Every element would need to be set to a variable, and then the outcome would need to be set to a variable. Then you put all of them into a ds_list add call, or whatever. Like this (I'm using a for loop for the example here, but it wouldn't really be different in practice with a while loop):

for (a = 0; a < 1000; a++)
{var length_left = 50 * a;
var dir = 10 * a;
var left_x = x + lengthdir_x(length_left, dir);
var left_y = y + lengthdir_y(length_left, dir);
ds_list_add(list, a, length_left, dir, left_x, left_y} // etc etc

Whatever you want to know - set a variable to it, so it can be accessed. And if it can be accessed it can be put into whatever you want to store it, and then be drawn onscreen by looping through the storage.
 
Nothing will be able to be drawn while the loop is running. So if you want some kind of progress report on the current status of your calculations, you'll need to break up your calculations into multiple parts. In each step event, pick up from where you left off in the previous step.
 

Hyomoto

Member
@flyingsaucerinvasion is right, you can do this but you have to solve your problem by solving it: the issue is you want to view the changes over time, that requires the process to take place over time in the program. In old versions of GM you could force a draw event, but you can not do that any more. That means instead of using a while loop, you need to use the step event as your loop. That way you can also perform draw events, thus visualize your data however you want.

It's not hard, but it does require you to look at the problem from a practical angle, not an idealized one. Sometimes you have to write the code you need, not the code you want.
 
Top