test for parameter in action

  • Is there a way, to test if an action is called with or without a parameter?
    i.e. I want to do something like

    Code
    <action name="look2hotspot">
            looktohotspot(%1, smooth());
    </action>
    
    
    <action	name="loadmypano">
             if(%1=="true", action(look2hotspot, %1));
         	loadpano(XYZ.xml, null, MERGE, BLEND(1));
    		</action>

    So I want to be able to execute "action(loadmypano)" and "action(loadmypano, hotspot)" and determin in the action if to execute look2hotspot. Is there something like that "if(%1=="true", action()); ?

    Achim

  • Hi,

    yes, there is a way
    the %1,%2,.. placeholders were only replaced when the parameters were set,
    to disable the replacing use two %% characters,

    e.g.
    %1 will be %1 when no parameter was set, or the value when one was set
    %%1 will be always %1

    so this code can be used to check if a parameter was set:

    Code
    if(%1 != %%1, trace(with parameter), trace(without parameter));

    best regards,
    Klaus

Jetzt mitmachen!

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