indexoftext and tolower

  • I am trying to compare the linkedscene var against xml.scene using the indexoftext and tolower functions:

    Code
    indexoftxt(index, xml.scene, tolower(linkedscene) );

    I am using tolower because xml.scene appears to always be lowercase. However, the first trace outputs the linkedscene attribute as expected, whereas the second just outputs the text between the parentheses. Can someone help me with the syntax please?

    Code
    <style 	
    	name="skin_hotspotstyle_setupChange"
    	url="%SWFPATH%/skin/hotspot_Dinner.png"
    	onloaded="hotspot_setupChange()"
    />
    <action name="hotspot_setupChange">
    	showlog(true);		
    	trace( linkedscene );
    	trace( tolower(linkedscene) );
    </action>

    Hope you can help!

    EDIT: perhaps my understanding of the the tolower function is lacking: If I trace( tolower( 'TEST' ) ) the output is 'TEST'. Can anyone point me in the right direction to find out how to work with string variables in krpano?

    Einmal editiert, zuletzt von olly (1. September 2016 um 14:32)

  • Hi,

    krpano actions (e.g. like 'tolower') can't be used as parameters for other actions:
    https://krpano.com/docu/actions/#syntaxandusage

    Only the special get() and calc() actions could be used that way:
    https://krpano.com/docu/actions/#get

    That means instead of this code:

    Code
    indexoftxt(index, xml.scene, tolower(linkedscene) );


    use this code:

    Code
    copy(linkedscene_low,linkedscene);
    tolower(linkedscene_low);
    indexoftxt(i, get(xml.scene), get(linkedscene_low));


    Changes:

    • using a temporary variable for the lower string
    • using 'i' instead of 'index' (could be problematic because index is a variable of layer and hotspot elements)
    • using get() in the indexoftxt() action to use the content of these variables:
      https://krpano.com/docu/actions/#indexoftxt


    Best regards,
    Klaus

Jetzt mitmachen!

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