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.

1

Tuesday, January 17th 2012, 12:22pm

autotour step increment

Hallo,
I put together a simple autotour, going through the scenes showing one full circle each. If user input, it should start with the scene where the user started klicking.
Problem: after falling back to the autotour, it doesn't start the scene where the user left, but at the next one (step + 1)!
How could I solve this?
May be I need something checking if the 360° are finished. I tried "nonblocking, donecall" - no difference...

this is my autotour: panotour Buchara
this is the relevant code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<action name="startup">
	  set(step,1);
	  autotour();
	  set(idletime,4);
	  set(events.onidle, autotour() );
	</action>
	
	<action name="autotour">
	  oninterrupt(break);
	  if(step == 1, loadscene(scene_baghahouddin, null, MERGE, ZOOMBLEND(1,2) ); lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	  if(step == 2, loadscene(scene_chor-bakr-2569, null, MERGE, ZOOMBLEND(1,2) ); lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	 ...  
	autotour();
	</action>

2

Tuesday, January 17th 2012, 8:37pm

I tried, as a workaround, to decrease step, like so:

Source code

1
2
3
	  set(idletime,8);
	  set(events.onidle, dec(step) );
	  set(events.onidle, autotour() );

Nothing changes.
I'm clueless, no answer on this problem since months and I don't know how I could learn this krpano actions coding. I can work through the examples and build tours accordingly - but there is nothing on autotours for instance - a very important feature.
Usually, as a non-coder, I'm able to work my way through things with the help of the community <3 I learnt flash actionscript that way even.
But here, I'm desperate.
No step forward.

On other questions, Klaus, you gave me advice...

Iit's often mentioned in the forum: the lack of docu or tuts to dive into the language...

sorry for rude tone, but I'm really hacked off ^^

gkaefer

Trainee

Posts: 46

Location: Salzburg

  • Send private message

3

Wednesday, January 18th 2012, 2:14am

I would try to set the set(step,1) inside the action autotour.
if interrupted, than the actual action is on break...
... if events.onidle takes place, the step value is no longer 1, so if action autotour is starting again, its not beginning with step == 1 ...
... so I asume the tour starts at first pano again (so not that what you want either...

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<action name="startup">
	  autotour();
	  set(idletime,4);
	  set(events.onidle, autotour() );
	</action>
	
	<action name="autotour">
	  set(step,1);
	  oninterrupt(break);
	  if(step == 1, loadscene(scene_baghahouddin, null, MERGE, ZOOMBLEND(1,2) ); lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	  if(step == 2, loadscene(scene_chor-bakr-2569, null, MERGE, ZOOMBLEND(1,2) ); lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	 ...  
	autotour();
	</action>


an what if you try:

Source code

1
	  set(events.onidle, dec(step); autotour(); );

instead of using 2 lines...

Liebe Gruesse,
Georg

4

Wednesday, January 18th 2012, 10:12am

danke, danke Georg!!! an answer!!! I couldn't sleep last night because of fear of not being able to learn this code...
last of your ideas works... though I don't understand the syntax.
If I try to translate the row: set(events.onidle, dec(step); autotour();)
first part: according to documentation set the variable "events.onidle" to "dec(step)" - this doesn't make sense...
why the senicolon, what does "autotour()" refer to??
but it is also being executed, when no user input after idletime, as desired...
Why dosn't it work when split into two lines, as was??

and still, I don't understand, why it needs this workaround and doesn't just do what we want, start at the current step after idletime...

Just to learn the structure...

gkaefer

Trainee

Posts: 46

Location: Salzburg

  • Send private message

5

Wednesday, January 18th 2012, 12:18pm

its easy - as everything in live - if you know it ;-)))

Quoted

<action name="startup">
autotour();
set(idletime,4);
set(events.onidle, autotour() );
</action>

<action name="autotour">
set(step,1);
oninterrupt(break);
if(step == 1, loadscene(scene_baghahouddin, null, MERGE, ZOOMBLEND(1,2) ); lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
if(step == 2, loadscene(scene_chor-bakr-2569, null, MERGE, ZOOMBLEND(1,2) ); lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
...
autotour();
</action>


in above example, in action startup events.onidle get the command to execute: autotour().
this means that the action autotour will be executed. But what do you have to do if the events.onidle should execute more than one action or command?
For this the ; is used:

set(events.onidle, dec(step); autotour(); );
this now says that the events.onidle should execute: 1. reduce the value of variable step with 1 and than 2. execute the code in action autotour. The () says that no additional values are assigned to the action autotour.

it does not work if using two lines ... I assume that the last assignement is valid so when the autotour() is executed the dec(step) is no longer valid.
(but this I dont know... if events.onidle would be an ordinary variable your approach would have success, but because events.onidle is no variable this is handled other way...)

Quoted

and still, I don't understand, why it needs this workaround and doesn't just do what we want, start at the current step after idletime

in line 10 and 11 of your code at the end you have places the inc(step). The value of variable step get a new value assigned +1. and this value does remain valid during execution of all of your xml code. The value of the variable does not expire or does not get reset it remains valid until you give the variable a new value.

so step==1 ... first pano gets loaded .... step get the value 2
so step==2 ... second pano gets loaded ... step get the value 3
lets say you now interrupt with a mousclick.... the action autotour is left...
what happens now... the onidle counter is starting and if event is true (the idletimeout has reached) than the autotour() action will be executed again.
but now the step==3 so normally it should now proceed with step3 pano... why in your original case the pano4 is shown I cant explain.
if you place the line "set(step,1);" at the beginning of the action autotour() the behaviour should change so that after every idletimeout the tour should automatically start with pano 1

Liebe Gruesse,
Georg

6

Wednesday, January 18th 2012, 12:50pm

gorgious, I will sleep tonight!! new hope to learn this... thx

Quoted from "gkaefer"

its easy - as everything in live - if you know it ;-)))
jaaaa... later I will call myself stupid to having taken such a long time to get that.

Quoted from "gkaefer"

set(events.onidle, dec(step); autotour(); );
this now says that the events.onidle should execute: 1. reduce the value of variable step with 1 and than 2. execute the code in action autotour. The () says that no additional values are assigned to the action autotour.
Great explanation for dummies!!!!! Are these conventions from Javascript? (which, obviously, I don't know either...)
But why do I have to put the "set"? (I just copied it...) How can I know (for other cases in the future), how could I learn?

Quoted from "gkaefer"

so step==1 ... first pano gets loaded .... step get the value 2
when does the step increase? after loading? then that would be the reason. We then would need a command to increase the step after finishing the lookto process.

Quoted from "gkaefer"

if you place the line "set(step,1);" at the beginning of the action autotour() the behaviour should change so that after every idletimeout the tour should automatically start with pano 1
works!! but I suppose we don't know why...
Allerbeste Grüße
Gertrud

7

Sunday, January 22nd 2012, 9:07pm

Hi,

try breaking-up the loadscene() calls and the lookto() calls into separate steps,
then you can continue with the lookto() in the current scene before switching to the next scene,
and important don't set the step to 1 in the autotour action,

e.g. here the whole code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<action name="startup">		
	buildthumbs();
	set(step,1);
	set(idletime,53);
	set(events.onidle, autotour() );
</action>
	
<action name="autotour">
	oninterrupt(break);
	if(step == 1, loadscene(scene_baghahouddin, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 2, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 3, loadscene(scene_chor-bakr-2569, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 4, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 5, loadscene(scene_chor-minor, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 6, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 7, loadscene(scene_labi-havus, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 8, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 9, loadscene(scene_hotel-m, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 10, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 11, loadscene(scene_cafe-nigora, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 12, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 13, loadscene(scene_hinter-ark, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 14, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 15, loadscene(scene_kiosk, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 16, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 17, loadscene(scene_wohnen-rohre, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );
	if(step == 18, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 19, loadscene(scene_atelier-asad, null, MERGE, ZOOMBLEND(1,2) ); inc(step); );	  
	if(step == 20, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,5), false); inc(step); );
	if(step == 21, set(step,1);	autotour(); );
</action>


best regards,
Klaus

8

Tuesday, January 24th 2012, 9:50am

Thank you!!!!! Another soulution... which even makes the thing more understandable...
but gkaefer's tipp to move the set(step,1); worked...

9

Friday, February 3rd 2012, 7:33pm

came back to this one
as mentioned by gkäfer, putting the set(step,1) into the <autotour> makes the tour fall back to the first pano...

Tried your solution, Klaus, of breaking up the actions into two steps - gives me the same problem - next scene will be loaded after interrupt and not the current!
also, no initial scene is being loaded without the call in the startup()

mikeekid

Beginner

Posts: 11

Location: Durban, South Africa

Occupation: Virtual Tour Photographer, Swimming Instructor

  • Send private message

10

Tuesday, October 22nd 2013, 10:54am

loadscene

I've used the suggestion by Klaus and it works for the 1st 2 scenes. Once it finishes the 360 rotation on my 2nd scene it doesn't move to the 3rd, it just stays in a loop on the 2nd. Any reason why that would happen?

<action name="startup">
buildthumbs();
loadscene(scene_SHQ1, null, MERGE, ZOOMBLEND(1,2) ); inc(step);); wait(load);
set(idletime,4);
set(events.onidle, autotour() );
</action>

<action name="autotour">
set(step,1);
oninterrupt(break);
if(step == 1, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,15), false); inc(step); );
if(step == 2, loadscene(scene_SHQ2, null, MERGE, ZOOMBLEND(1,2) ); inc(step);); wait(load)
if(step == 3, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,15), false); inc(step,4); );
if(step == 4, loadscene(scene_SHQ3, null, MERGE, ZOOMBLEND(1,2) ); inc(step);); wait(load)
if(step == 5, lookto(360, get(view.vlookat),get(view.fov), smooth(2,2,15), false); inc(step); );
if(step == 6, set(step,1); autotour(); );

</action>

11

Tuesday, October 22nd 2013, 5:40pm

Hi,

Any reason why that would happen?
because of these red-marked line here:
<action name="autotour">
set(step,1);
oninterrupt(break);
...
with that you are always setting the step back to 1 when the autotour actions starts.

Best regards,
Klaus