Categories > Logic > rex_function2

Introduction

Links


Categories > Logic > rex_function2IntroductionLinksDependenceUsageDebug

Dependence

None

Usage

Function body Parameter list Parameter tableCondition:On functionAction:Declare parameterExpression:Param(index)Expression:Param(key)Action:Set return valueAction:Call functionExpression:CallAction:Call expressionAction:Set parameterAction:Call functionExpression:CallwPT

Sample capx

  1. Call function

    • Parameter list (similar with official function object)

      • Action

        • Action:Call function under Parameter list category
        • Action:Call expression
      • Expression

        • Expression:Call(functionName, value0, value1, ...)
    • Parameter table

      • Action

        1. Action:Set parameter
        2. Action:Call function under Parameter table category
      • Expression

        • Expression:CallwPT(functionName, paramName0, value0. paramName1, value1, ...)
  2. Function body

    1. Condition:On function

      • Parameter Name is case insensitive
    2. Action:Declare parameter, at top of function body, before any Expression:Param

      • Each Action:Declare parameter assigns a parameter Name to Nth input parameter

      • Check value type of input parameter by parameter Type check

      • Set parameter value by parameter Value if this input parameter is not found in current function call

      • For example,

         
        xxxxxxxxxx
        Call "SetPos"(100, 200)

        to trigger condition

         
        x
        + On "SetPos"
        - Parameter "x", default to 0      // Param("x") = Param(0) = 100  (1st parameter)
        - Parameter "y", default to 0      // Param("y") = Param(1) = 200  (2nd parameter)
        - Parameter "layer", default to 0  // Param("layer") = 0  (default value)
    3. Get value of input parameters

      • Expression:Param( n ), index by number, like official function object

        • Expression:Param( 0 ), Expression:Param( 1 ), ...
      • Expression:Param( key ), index by string

        • Expression:Param( "x" ), Expression:Param( "y" ), ...
      • Condition:Type of parameter (Sample capx)

      • Expression:ParamCount

    4. Return value

      • Return single value

        • Action:Set return value under Return category
        • Expression:ReturnValue
      • Return JSON (Sample capx)

        • Action:Set return value under Return: dictionary category

          • Parameter Name is a string with dot notation, like Action:Set value in JSON plugin
        • Expression:ReturnValue, returns all keys in JSON string

          • Expression:ReturnValue( key ), returns value of the key

            • Parameter Key is a string with dot notation, like Expression:At( keys ) in JSON plugin
          • Expression:ReturnValue( key, defaultValue ), returns defaultValue if key is not existed


Debug