Programming an automatic tour

  • Hi,

    I would like to program an automatic tour, so i can sit back and not use the mouse. I plan to have a button that fires off an action with a chain of events that move the viewer to points of interest then loads a new panorama.

    In thinking about it I had planned to write an automatic xml with the auto action in it, but have come across problems in the past, in that if the user hits the auto tour button on a panorama other than the first then the auto tour gets mucked up.

    So I am starting to think a better way would be to put an automatic action in each panorama xml, and have some kind of code that checks if the auto button is active, if it is play auto action in that panorama, if not assume manual controls.

    Is this the best way do you think and is it possible to check if a button is active/enabled ? I guess it would be a conditional statement - I will check forum if there is any similar code and come back with my efforts. The tour will consist of about 20 panoramas.

    As always many many thanks for any advice given,

    Best wishes,

    tom

  • I tried this...

    <krpano version="1.0.8" onstart="action(check-auto-tour);">

    <action name="check-auto-tour">
    if(autotour-button.enabled == true, action(play-tour); autotour-button.enabled == false, action(dont-play-tour); );"
    </action>

    <action name="play-tour">
    lookto(330,282,30,smooth(100,50,20));
    wait(3);
    lookto(1,209,300);
    wait(3);
    loadpano(test3.xml,null,MERGE,BLEND(1));
    </action>

    <action name="dont-play-tour">
    set(autorotate.enabled,false);
    </action>

    <plugin name="autotour-button" enabled="true" visible="true" handcursor="true" keep="true" url="buttons/rotated.png" zorder="2" align="bottom" edge="center" y="309" x="240" blendmode="screen" onover="set(blendmode,add);" onout="set(blendmode,screen);" onhover="showtext(Auto tour on / off)" onclick="action(play-tour);" />

    <plugin name="stop_autotour-button" enabled="true" visible="false" handcursor="true" keep="true" url="buttons/rotated.png" zorder="2" align="bottom" edge="center" y="309" x="240" blendmode="screen" onover="set(blendmode,add);" onout="set(blendmode,screen);" onhover="showtext(Auto tour on / off)" onclick="action(dont-play-tour);" />

    <action name="auto-tour_on">
    set(plugin[autotour-button].enable,false);
    set(plugin[autotour-button].visible,false);
    set(plugin[stop_autotour-button].enable,true);
    set(plugin[stop_autotour-button].visible,true);
    </action>

    <action name="auto-tour_off">
    set(plugin[stop_autotour-buttont].enable,false);
    set(plugin[stop_autotour-button].visible,false);
    set(plugin[autotour-button].enable,true);
    set(plugin[autotour-button].visible,true);
    </action>


    but I dont think 'enabled' is the same as declaring if a button is checked or not ?

  • or one solution I am pondering is it might be better to write a conditional on the pano name that plays the relavent events.

    So 1 big action that gets triggered by the auto tour button, with conditional statements that check the panorama names then plays those events. Although I can imagine the permutations !

    a failsafe option might be to do an automatic tour that returns to first panorama when auto tour button is clicked, then the events are played, with a conditional only on the first panorama to check its not going to load the 1st one even though the 1st one is being viewed.

    I remember when programming with immervision java player there was a function for checking if a button had been clicked or not. I've looked through the docs and can only find enabled as a possible example of this.

    I will dig deeper into the docs today so hope to have some better ideas later,

    cheers,

    tom

  • Hi,

    Is it possible to give each panorama a name variable ? Like a function called panoname where you can declare a name specific for that panorama, then it would be possible to right conditionals statements for it in the global.xml.

    e.g.

    if panoname[pano1],action(pano1actions);

    else if


    if panoname[pano2],action(pano2actions);

    Because then i could have a button in the global.xml that checks for the panorama name then activates a relevant action/event for it. This could help solve my problem for an automatic tour, that the user can activate on any panorama, and they will get the relevent events happening.

    Hope this makes sense, please let me know if this is already possible or if there is a better way.

    Many thanks

    tom

  • Hi Job.1,

    Thanks for your reply, I think I saw a post on event and autorotate here which is certainly very helpful and I am studying it to see if it can help. I'll let you know how I get on. The main problem I have is say I have 20 panoramas and I program all the movements and order I want the panoramas to load under one action. Then it will only play right if executed from the first panorama. However if I want to have this facility on offer whilst someone is using the tour they could be navigating on any of the 20 panoramas meaning the first movements will apply to whatever panorama is showing. So i am looking for a good solution to handle this. There are however lots of work arounds I could do, like only show the auto tour button at the start of the tour. I am just investigating at the moment, and feel there are 2 useful functions that I could perhaps do with, and that is panoramaName and a function to say if a plugin/button has been clicked or unclicked.

    like this perhaps

    if (panoramaName=="london")
    {
    if (get("auto-button","clicked")==true)
    set("london-action-name","enabled","true");
    }
    else if (panoramaName=="Manchester")
    {
    if (get("auto-button","clicked")==true)
    set("manchester-action-name","enabled","true");
    }

    Does your example, use something like if auto-rotate button clicked play in the next panorama, if not don't rotate, i'm not sure I understand zephyr's example, in particular what 'EQ 1' means.

    I'll just keep studying the docs and forum and practising. krpano is so addictive, Thanks Job.1 ! By the way great example of before and after shot - I did not realise it was the same place at first. The builders did a great job.

    Best wishes,

    tom

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!