animation "dropouts" [solved]

Pixilang programming language
Post Reply
rototom
Posts: 24
Joined: Mon Mar 14, 2022 4:12 pm

animation "dropouts" [solved]

Post by rototom »

it's a bit hard to explain, but i try to.
i have something like a main loop going. like while(...){...}
within that loop, there are things like
print( ts,2+abs(rn1[1]),0,WHITE), where the x position of the printed text changes randomly. (rn1 is a random generator)

the problem is, after a while, the random x position change "drops out".
the loop is still going, but no more random x position.

is this a known issue?

pixilang 3.8.2/android7
Last edited by rototom on Fri Apr 22, 2022 5:15 pm, edited 1 time in total.
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: animation "dropouts"

Post by NightRadio »

... rn1[1] ...
rn1 is a random generator
rn1 is an array from which you take element number 1
The question is who, where and how generates random numbers? :)
rototom
Posts: 24
Joined: Mon Mar 14, 2022 4:12 pm

Re: animation "dropouts"

Post by rototom »

I somehow felt this question would come up:)

it's one of those guys:
rn1 = new( 2, 1, INT )
generator( OP_RAND, rn1, 0, 2 )

and it lives inside the main while loop
but how? i can't tell you... magic perhaps?;)
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: animation "dropouts"

Post by NightRadio »

You can try to somehow localize this bug by consistently removing all unnecessary code from the program, leaving in the end only a few commands in the while loop.
Also make sure you don't create rn1 = new( 2, 1, INT ) in every loop iteration :)
Otherwise, you will create 8192 containers and there will be no room for new ones.
rototom
Posts: 24
Joined: Mon Mar 14, 2022 4:12 pm

Re: animation "dropouts"

Post by rototom »

i think this caused the "droputs": getting too many containers.
after replacing the rn = new() thing with my own between(min,max) function, there were no more dropouts.
thanks for the hint @nightradio
Post Reply