Code value (nextloop)

  • Hello
    The code snippet from the official sample "flyout-hotspots"

    Code
    <action name="flyback_others">
      if(%1 != nextloop, set(i,0));
      
      if(hotspot[%i].style == flyoutimage,
       if(hotspot[%i].flystate != 0, flyback_by_name(get(hotspot[%i].name)); );
        );
        
      inc(i);
      if(i LT hotspot.count, flyback_others(nextloop); );
     </action>


    I can not understand what it means in this action:
    1-"% 1" from the line № 2
    2- "nextloop" from the lines № 2 and 9

    Thank you

    Einmal editiert, zuletzt von ser4ep (31. Oktober 2011 um 09:31)

  • this action basicly calls it self, leading in a loop.

    the if(%1 != nextloop, set(i,0));

    ensures i is 0, when its not defined/called for the first time.

    the last line checks if the there is still hotspots left that are not checked (it loops through all the hotspots). If there are still hotspots, then call this action again, but send a nextloop parameter else i is set to 0 and it starts again from the beginning.

    But this method is old now. With krpano 1.14 there is a more handy command called for and async for. which is probally more recognizable for some programmers

    Code
    <action name="flyback_others">
       for(set(i,0), i LT hotspot.count, inc(i),
          if(hotspot[get(i)].style == flyoutimage,
              if(hotspot[get(i)].flystate != 0, flyback_by_name(get(hotspot[get(i)].name)); );
        );
    
    
       );
    </action

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!