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.
Call Action after 5 scenes viewed/loaded?
-
-
Hi! Very simple code
Code
Display More<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>
-
Works nicely, thank you. I had to change the onnewpano to "onnewscene" but it works perfectly now for my needs.
-
----- Okay how do I get this to stop counting after five is reached?
-
Do you want to stop the action at all? Or do it every fifth scene?
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!