The Dink Network

Sequence Changes

April 8th 2010, 11:44 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
I have a sprite, on a brain 6 (repeat) doing nothing but just that, repeating. I want (randomly) for this sprite to change to another sequence for 1 whole sequence run and then revert to it's old sequence. If that makes sense, here's some code I tried to use:

void main( void )
{
  int &how_long;
  int &myrand;
  int &fake_aviarn;
  
mainloop:
  &how_long = random(5000, 1000);
  &myrand = random(3, 1);
  
  if (&myrand == 1)
  {
    sp_nodraw(&current_sprite, 1);
    &fake_aviarn = create_sprite(180, 139, 7, 37, 1);
    sp_seq(&fake_aviarn, 37);
    sp_nodraw(&current_sprite, 0);
  }
  wait(&how_long);
  goto mainloop;

}


My problem is knowing when to redraw the original sprite, as I can't figure out an exact length of the new sequence, and the wait command is always a little off on different machines.
Suggestions?
April 9th 2010, 12:56 AM
anon.gif
Sparrowhawk
Ghost They/Them
 
I don't think there's a way to tell when a sequence has finished (unfortunately), you can either try timing a wait which is dodgy as you said or I usually work around problems like this by 'faking' the sequence.

Instead of sp_seq use this:
sp_pframe(&sprite, 1);
wait(50);
sp_pframe(&sprite, 2);
wait(50);
sp_pframe(&sprite, 3);
wait(50);
sp_pframe(&sprite, 4);
wait(50);
sp_pframe(&sprite, 5);
April 9th 2010, 05:20 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Yeah, not a bad idea. Just a little tedious and messy.
I was hoping there was someway of timing the sequence end and performing a task, but I guess not.

That should work, though, Sparrow.
April 9th 2010, 11:40 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
You could check for the current frame in a loop to determine this, but I'd use Sparrow's solution myself.