Home Forums Macros Incorrect data types

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7184
    Patrick KiznyPacocreative
    Participant

    As I understand:
    currentCaseOptionValueInt(0) should return an Integer
    currentCaseOptionValueFloat(0) should return a Float

    but it seems each of them return a String and throw error?

    Code:

    	
    // Looper speed change, args: looper id, speed
    CaseBranch "LP Spd"
    
    	//Message {"LP Speed " + currentCaseOptionValueInt(0) + " " + currentCaseOptionValueFloat(1)}
            // !!! This returns correct values !!!
    
    	// vars for each channel
    	$k$ = currentCaseOptionValueInt(0)
    	$v$ = currentCaseOptionValueFloat(1)
    
    	$m$ = $Looper_fx8_rank1_PlayerMode_state$
    	$b$ = $Looper_fx8_rank1_current_length$
    	$r$ = $Looper_fx8_rank1_ReverseDirection_state$
    
        Message {"LP Speed " + $k$ + " " + $v$ + " m " + $m$ + " b " + $b$ + " s " + $s$ }
        // This returns zeros for variables k and v and throws errors in console
    
    Cannot get value for variable $k$. Expecting type class java.lang.Integer, but got value currentCaseOptionValueInt(0) of class class java.lang.String
    Bad variable type java.lang.String instead of class java.lang.Integer; Ignore value and use default of proper type
    Cannot get value for variable $v$. Expecting type class java.lang.Float, but got value currentCaseOptionValueFloat(1) of class class java.lang.String
    Bad variable type java.lang.String instead of class java.lang.Float; Ignore value and use default of proper type
    Error : Erreur macro: Macro _Nov_LC_XL_v003, slot data_2_insert_2, line 867: track name:No track named fx0 exists. The index value of variable <I>$k$</I> is incorrect for this kind of tracks; for InsertSendMessage
    Macro _Nov_LC_XL_v003 will be stopped now.
    
    #7185
    Patrick KiznyPacocreative
    Participant

    Generally something weird is going on.

    // In Matrix
    // in the head
    Declare Local float $v$ = 0
    
    // Later in case branches
    CaseBranch "Test"
    	$v$ = currentCaseOptionValueFloat(0)
    	Message {"test CCOVF " + currentCaseOptionValueFloat(0) + " $v$ " + $v$   }
    	BreakCaseBranch

    Fails to assign value to the variable, and output is:
    currentCaseOptionValueFloat(0) ⇀ correct value
    $v$ ⇀ 0

    I’m using these assignments to tidy up my code and avoid repetitions

    Any ideas?

    #7186
    Philippe OllivierPhilippe
    Keymaster

    Hi,
    You need to put those { } to evaluate the currentCaseOptionValueFloat(0) value as this :

    CaseBranch "Test"
    	$mavar$ = {currentCaseOptionValueFloat(0)}
    	Message {"test CCOVF " + currentCaseOptionValueFloat(0) + " $mavar$ " + $mavar$   }
    	BreakCaseBranch
    #7187
    Patrick KiznyPacocreative
    Participant

    Oh, now that works. Stupid me.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.