You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

ser4ep

Beginner

  • "ser4ep" started this thread

Posts: 5

Location: Viborg; Russia

  • Send private message

1

Monday, October 31st 2011, 9:08am

Code value (nextloop)

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

Source code

1
2
3
4
5
6
7
8
9
10
<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

This post has been edited 1 times, last edit by "ser4ep" (Oct 31st 2011, 9:31am)


Zephyr

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Monday, October 31st 2011, 10:18am

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

Source code

1
2
3
4
5
6
7
8
<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

ser4ep

Beginner

  • "ser4ep" started this thread

Posts: 5

Location: Viborg; Russia

  • Send private message

3

Monday, October 31st 2011, 10:38am

Thank you very much, Zephyr!
Now it will be easier to understand *smile*