Author Topic: Need help with snap delay function  (Read 3244 times)

calle81

  • Sr. Member
  • ****
  • Posts: 184
    • View Profile
Need help with snap delay function
« on: September 11, 2017, 06:01:59 AM »
Hi, I need help finishing this snap delay function. Thanks for offering to help Kent79 :) I attached the nut file. It wont make much sense loaded in AM without Hurstys tiles and a bunch of other stuff. The code is at the bottom of the file. End goal is to have 1 or sec delay before the snap starts playing.

/////////////////////
//Snap playback with delay
////////////////////   
local snap_active = false;
local delay = 0;
local max_delay = 0;
snap.playing = snap_active;

max_delay=abs(("0"+my_config["dtime"]).tointeger())
max_delay=(max_delay>999 ? 100 : max_delay);

::fe.add_ticks_callback( this, "tick_fn" );

function tick_fn( ttime )
   {
      delay++;
      if ( delay > max_delay )
      {     
         if (snap_active == false){
         local snap = fe.add_artwork ( "snap", flx*0.183, fly*0.0376, flw*0.635, flh*0.56 );
//         snap.trigger = Transition.EndNavigation;
         snap.preserve_aspect_ratio = true;      
         snap_active = true;
         snap.playing = snap_active;
         }

      }
   }