Home -> FPP plugins page -> panologic.swf
This plugin is completely free for use in any context or connection.
panologic.swf
FPP external plugin that makes it possible to apply IF-ELSE logic to your FPP commands. The logic can of course not be written directly in the FPP XML file, but is instead entered in its own file from where it can be executed just as easily with a simple command. Your logic is stored in "functions", and would normally consist of one or several IF-ELSE statements and one or several FPP commands.
The following parameters are supported:

Parameter names are not case sensitive ("XMLFile" is equal to xmlfile"). Parameter values, on the other hand, will be saved
exactly as written.

Only one parameter is supported at plugin initialization:
xmlFilexmlFile=myfunctions.xmlname of XML file containing your functions
default is "panologic.xml"

Parameters that can be set via "external.panologic.name=value" call:
xmlFilexmlFile=newfunctions.xmlload a new set of functions from XML file
xmlDataxmlData=<?xml...enter new set of functions as an XML string, see NOTES
function_namefunction_name=valueIF-ELSE function call



Overview

Your pano logic is written in "functions" that you can execute from FPP. Each function can contain as many IF-ELSE statements and FPP commands as you need - there is no limit.

The IF-ELSE statements can be nested in any number of levels, and the expressions to be tested can be grouped with parentheses in any number of levels.

When expressions are evaluated, a numeric compare will be made if at least one of the operands are numeric, else a string compare will be made.

No arithmetic is allowed in expressions.



Allowed operators are:

==equal to
!=not equal to
<less than
<=less than or equal to
>greater than
>=greater than or equal to
~operand1 contains operand2



Logical operators (for evaluating more than one expression):

&&and
||or



Operands can be:

numbersex: 123 85.4 -11
stringsex: "images/pano5"
meta operandsex: $pan $panoname $date



Meta operands are used for values that are not fixed, and that the plugin has to fetch at the moment when the evaluation takes place - like pan position, date, fullscreen state. They are written in the form "$meta_name" and can be one of the following:

$internetconnected to Internet (true=1, false=0)
$panonamename of loaded pano
$panowidthwidth of loaded pano
$panoheightheight of loaded pano
$panoratiowidth/height of loaded pano
$fullscreencurrent display state (true=1, false=0)
$pancurrent pan value
$tiltcurrent tilt value
$zoomcurrent zoom value
$timecurrent time ("hh:mm")
$datecurrent date ("yymmdd")
$parmparameter value (external.panologic.function_name=parameter_value)
$javascript:function_namestring value returned from a JavaScript function call
$name.attributehotspot attribute, ex: $image22.alpha



FPP commands to be executed has to be written as:

$command(FPP_commands)
Example: $command(pano.pan=125,4000)



Executing an IF-ELSE statement

When you want to execute your IF-ELSE statement, you do this by calling the function in which you have written it. An example:

Suppose you have two spots with visible="0", and when the viewer presses a button, you want to show SpotA if he is in fullscreen mode and SpotB if he is not. The button then has an onClick:
onClick="external.panologic.fulltest=nnn"
In your plugin XML file, you have this function:
   <function name="fulltest">
      <![CDATA[
      if ($fullscreen == 1) {
         $command(SpotA.visible=1)
      }
      else {
         $command(SpotB.visible=1)
      }
      ]]>
   </function>



NOTES:

When calling the plugin (example: external.panologic.func_name=nnn), the value "nnn" can be anything - it is just a requirement by FPP. But if you want to use the value in your functions, use the variable $parm:
if ($parm > 5) {...} else {...}


You have to write your "if" statements in the <function> tag inside a CDATA section:
<![CDATA[ ...your_if-else_statement... ]]>
Data inside a CDATA section is ignored by the XML parser, and can therefore contain special characters like "<" and "&".



The format of the "if" statement is quite free - you can write everything on one line, or split it up in several lines. All whitespace (blanks, tabs, newlines) - except in strings - is removed by the plugin when parsing the functions.



As FPP converts plugin parameter names to lower case, the function names are case insensitive. The plugin will convert them to lower case internally.



When the xmlData=... parameter is used, you have to escape code characters like < " , ; and newline.



Meta operands can also be used in your FPP command string. If you for example want to center your pano on a hotspot with id=xyz, you can use a function like this:

<function name="gospot">
   <![CDATA[
   $command(pano.pan=$xyz.pan,3000;pano.tilt=$xyz.tilt,3000)
   ]]>
</function>
						



To use the Internet connection test you have to include the <internet url="..."> tag in the XML file. The url should point to a very small file that the plugin can load at initialization. If the loading is successful, all tests for Internet connection will result in "true".



Example of a panologic XML file:

<?xml version = '1.0'?>
<panologic>
   <internet url="http://wirestam.com/panos/Flash/panologic/iptest.txt" />
   <functions>
      <function name="tohires">
         <![CDATA[
         if ($Pano1low.visible == "1") { $command(global.showPano1High) }
         if ($Pano2low.visible == "1") { $command(global.showPano2High) }
         if ($Pano3low.visible == "1") { $command(global.showPano3High) }
         ]]>
      </function>
      <function name="tolowres">
         <![CDATA[
         if ($Pano1hi.visible == "1") { $command(global.showPano1Low) }
         if ($Pano2hi.visible == "1") { $command(global.showPano2Low) }
         if ($Pano3hi.visible == "1") { $command(global.showPano3Low) }
         ]]>
      </function>

      <function name="showpano1">
         if ($gohires.visible == "0") { $command(global.showPano1High) }
         else { $command(global.showPano1Low) }
      </function>
      <function name="showpano2">
         if ($gohires.visible == "0") { $command(global.showPano2High) }
         else { $command(global.showPano2Low) }
      </function>
      <function name="showpano3">
         if ($gohires.visible == "0") { $command(global.showPano3High) }
         else { $command(global.showPano3Low) }
      </function>

      <function name="fulltest">
         if ($fullscreen == 1) { $command(global.fullYes) }
         else { $command(global.fullNo) }
      </function>

      <function name="iptest">
         if ($internet == 1) { $command(global.internetYes) }
         else { $command(global.internetNo) }
      </function>
   </functions>
</panologic>
						


Version history:

1.6:
Added "~" operator for testing if string1 contains (sub)string2.

1.5:
Added xmlData=... parameter for setting new functions.

1.4:
Meta operands can now be used in the FPP command string.

1.3.1:
xmlFile parameter is now unescaped to support more complex URLs.

1.3:
Support for $javascript:function_name meta operand added. Useful when checking login or other session states.

1.2.1:
Added random parameter to Internet connection checking url to avoid caching problem.

1.2:
Added test to check for Internet connection. Note that plugin XML format is slightly changed: A top tag is now needed.

1.1.2:
Bug fixed in "$fullscreen" test.

1.1.1:
Bug fixed: When a name begins with ”pan…” checking spot attributes doesn't work because the plugin thinks it is supposed to test "pan" position. Bug fixed: As FPP converts plugin parameter names to lower case, function names containing upper case couldn't be found. The plugin now makes a lower case compare.