Play an ACTION only once

  • at default startup, create variable:

    Code
    set(var1, 1);

    then in <action> add if sentence where 'do smth' is your animation

    Code
    if (get(var1) == 1, 'do smth'; set(var1, 0); );

    everything in if sentence will happen only once.

  • Yeah, I'm kinda getting what do you want me to do ,yet it is not entirely clear.

    at default startup, create variable:

    So should I create an additional action containing that string and call it using "onstart" and then add

    if (get(var1) == 1, 'do smth'; set(var1, 0); );

    at the end of my opening sequence? Because I tried that and it didn' work :/ Sorry to post stuff like this, It seems really basic, but some more elaboration would really help :)

  • So should I create an additional action containing that string and call it using "onstart" and then add

    Yes, in first xml file that is loaded. The default is tour.xml. Startup action is already made by krpano tools wich loads first scene to stage.

    Code
    <krpano version="1.0.8.15" title="Title" onstart="startup();" >
        	
        	<action name="startup">
    		
        	if(startscene === null, copy(startscene,scene[0].name));
    		loadscene(get(startscene), null, MERGE);
    		set(var1, 1);
    		
        	</action>
    </krpano>

    at the end of my opening sequence? Because I tried that and it didn' work :/ Sorry to post stuff like this, It seems really basic, but some more elaboration would really help :)

    No, not at the end. You must put you code/sequence inside the 'if' statement. Your sequence must replace 'do smth'.

    e.g.:

    Code
    if (get(var1) == 1,
      	tween(view.fov, 39, 2.0);
          	tween(view.vlookat, -7, 5.5, easeOutQuad);
            tween(view.vlookat, 0, 2.0);
          	tween(view.fov, 56 1.5,);
      	set(var1, 0);
         );

    in this case all tweens will happen only once

  • And here is the real problem. I'm using Panotour Pro for the initial setup of my tour - i connect diferent scenes, place hotspots etc. PTP produces xml files that have a different structure than the ones made with krpano droplets. Every single scene gets it's own xml. Plus there is one xml with stuff used in all scenes like maps, radars, some staic plugins etc. Therefore I can't just insert that "startup" action, krpano viewer just gives me an error

    Code
    ERROR: loadscene() - scene "null" not found

    That's how the file looks like

    That's the relevant part, the rest is just bunch of actions that control the radar plugin. So how should I handle it?

Jetzt mitmachen!

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