Starting with if(condition, then-actions, else-actions) problems ^^

  • Hi all ^^
    Here we are I'm getting started with the if condition to dry my code, and allready have a problem ^^
    Just a short code I tried is not working as I would like it to :

    Code
    <plugin name="spotinfo" 
    	keep="true" 
    	onclick="scene2load(); movemap(); showinfo();"
    	...
    	/>
    	
            <action name="scene2load">
    	if (scene == scene_pano2, null();, loadscene(scene_pano2););
    	</action>

    My aim is to tell my spotinfo button not to reload the scene_pano2 if we are already in it ...

    I tried : if (scene == scene_pano2, null(), loadscene(scene_pano2) );
    and the opposite : if(scene != scene_pano2, loadscene(scene_pano2));

    with or without ; at action end does'nt change anything.
    Either it loads the scene or not, but donesn't detect the scene state...

    Someone maybe has a idea ?
    Thanks in advance,
    Best regards.

  • Hi Yomas,

    I use the following to check for scene names:

    set(scenename,get(xml.scene));
    if(scenename == blabla, do_whatever());

    I´ve never got it to work your way using "scene == blabla".

    Best regards
    Nupsi

    P.S.: I love the style of your homepage *smile* Very clever!

  • Up again with variables things I'm not ease with those yet ^^
    I'm trying to make a photo gallery seamless to the simpleviewer only using xml cause the flash ones doesn't work like I want it to.
    I know how to get this "plugin" work but my code wouldn't be dry and it could be usefull for lots of people.
    Here were I am from now on :

    Here it would work, just have to continue coding with repeated action for showing the right photo according to the thumb hovered...
    But that makes a lot of coding for a simple action :'(
    I'm trying to do something like :

    <plugin name="photo" url="" align="righttop" edge="righttop" width="80%" height="prop" parent="photogallerystage" x="10%" y="10%" keep="true" visible="false" />
    <action name="showphoto">
    set(plugin[photo].url, ../photos/01.jpg);
    set(plugin[photo].visible, true);
    ...
    </action>

    But as you see it'll be moreover complicated this way and not much dryer ^^
    I'm a bit lost.
    I miss the part to make only one action that loads different photo from a different thumb, without having to create as many actions as there are thumbs...

    Would be great if someone could give me a clue here ^^
    Thanks in advance.
    At least when done it'll be a good xml plugin to share *wink*
    Best regards.

  • Hi again;-)
    Nobody?!
    Therefore I got it to work nicely but the XML code and images aren't not dry at all^^
    Getting further in this plugin developement would be great to have a auto onover effect on the thumbs,
    And auto caption under the photos...
    Actually I use the crop onovercrop method to change the thumbs and photos aspect, but itI'll ne nice to automate all that;-)
    This could be a cool plugin for showing non spherical images !!
    Hoping domaine would give a little help for me and the plugin comunity sharing^^
    Thanks in advance'
    Best regards.

Participate now!

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