You are not logged in.

1

Monday, August 28th 2017, 6:39pm

Call Action after 5 scenes viewed/loaded?

How can I count/track number of scenes visited? I wish to call an action every fifth scene viewed.
"trace(Numbers of viewed scenes: ,scene.count)" counts number of scenes loaded into ram, however I'm looking to count the number of scenes visited.

Sergey74

Trainee

Posts: 124

Location: Russia, Chelyabinsk

Occupation: professional noob

  • Send private message

2

Tuesday, August 29th 2017, 8:09am

Hi! Very simple code

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
	<events name="counter_event" keep="true" onnewpano="counter_action();"/>
	<action name="counter_action">
		if(scene_counter === null,
			set(scene_counter, 1);
			,
			inc(scene_counter);
		);

		showlog();
		trace('scene_counter=',get(scene_counter));

		if(scene_counter == 5, trace('scene 5 achieved!') );
	</action>
translation difficulties *huh*

3

Tuesday, August 29th 2017, 4:22pm

Works nicely, thank you. ;-) I had to change the onnewpano to "onnewscene" but it works perfectly now for my needs.

4

Wednesday, August 30th 2017, 6:42pm

----- Okay how do I get this to stop counting after five is reached?

Sergey74

Trainee

Posts: 124

Location: Russia, Chelyabinsk

Occupation: professional noob

  • Send private message

5

Wednesday, August 30th 2017, 7:43pm

Do you want to stop the action at all? Or do it every fifth scene?
translation difficulties *huh*

jordi

Intermediate

Posts: 427

Location: Barcelona

Occupation: creating ideas & coding them

  • Send private message

6

Sunday, September 3rd 2017, 12:49pm

Reset every 5 panos :

Source code

1
2
3
4
5
6
if(scene_counter === null,
			set(scene_counter, 1);
			,
			inc(scene_counter);
                        if(scene_counter GT 5, set(scene_counter, 1));
		);


stop after first 5 have been counted :

Source code

1
2
3
4
5
6
if(scene_counter === null,
			set(scene_counter, 1);
			,
			inc(scene_counter);
                        if(scene_counter GT 5, set(events.counter_event.onnewscene, ));
		);
everpano.com smart virtual tours

This post has been edited 2 times, last edit by "jordi" (Sep 3rd 2017, 1:38pm)