Reply to Re: Storing a random sequence
If you don't have an account, just leave the password field blank.
If I understand you right, you can use editor_frame/seq. Editor number #1 is the first sprite in order, #2 is the second, etc. Like this:
int &temp;
int &count = 1;
loop:
&temp = random(3, 1);
if (&temp == 1)
{
&temp = &a;
goto skip;
}
if (&temp == 2)
{
&temp = &b;
goto skip;
}
if (&temp == 3)
{
&temp = &c;
}
editor_frame(&count,&temp);
skip:
//do something
//also some counter to only loop x number of times
&count += 1;
goto loop;
-----
retrieve them like this:
&count = 1;
int &spr;
rloop:
if (&spr != 0)
{
&spr = editor_frame(&count,-1);
//do what you want with the sprite
&count += 1;
goto rloop;
}
-----
This will allow you to have 100 repetitions of the original loop. If you need more, I suggest you succumb to supervars.
editor_frame/seq with any number between 0 and 99 will work regardless of whether there is a sprite that corresponds to that number.
I don't know what would happen if you tried to access editor_frame/seq without first setting it. Here I am assuming it will be zero. But it may crash. If it does just run through a loop to set all you need to zero initially.
-
The other one, e.g. this:
if (&sprite_a == 1or5or9or10)
can be done by checking if editor_frame 1 or 5 or 9 or 10 is &sprite_a.
int &temp;
int &count = 1;
loop:
&temp = random(3, 1);
if (&temp == 1)
{
&temp = &a;
goto skip;
}
if (&temp == 2)
{
&temp = &b;
goto skip;
}
if (&temp == 3)
{
&temp = &c;
}
editor_frame(&count,&temp);
skip:
//do something
//also some counter to only loop x number of times
&count += 1;
goto loop;
-----
retrieve them like this:
&count = 1;
int &spr;
rloop:
if (&spr != 0)
{
&spr = editor_frame(&count,-1);
//do what you want with the sprite
&count += 1;
goto rloop;
}
-----
This will allow you to have 100 repetitions of the original loop. If you need more, I suggest you succumb to supervars.
editor_frame/seq with any number between 0 and 99 will work regardless of whether there is a sprite that corresponds to that number.
I don't know what would happen if you tried to access editor_frame/seq without first setting it. Here I am assuming it will be zero. But it may crash. If it does just run through a loop to set all you need to zero initially.
-
The other one, e.g. this:
if (&sprite_a == 1or5or9or10)
can be done by checking if editor_frame 1 or 5 or 9 or 10 is &sprite_a.