Entra:     


Forum: VirtualDJ Technical Support

Topic: scripting help.. unexpected behavior
So I'm working on a modified MIDI Fighter Twister mapping where if you press the encoder it either kills (0) or resets a STEM (0.5)

($enc_buffer is set to 0.03, the idea is that if you have the stem low you probably don't want it to go lower but reset to normal. enc_buffer determins how close to low you can be)

My issue is that when I run this action it works for going from no stem (0) to full, but not in reverse

Relevant code parts:
	
<map value="MD1_ENC_1_1" action="deck 3 stem Vocal " />
<map value="MD1_PUSH_1_1" action="var_smaller `deck 3 stem Vocal` $enc_buffer ? deck 3 stem Vocal 0.5 : deck 3 stem Vocal 0 "/>


Interestingly, what does work is this:

<map value="MD1_ENC_1_1" action="deck 3 stem Vocal & set_var $md1_1_1 `deck 3 stem Vocal ` " />
<map value="MD1_PUSH_1_1" action=" var_smaller $md1_1_1 $enc_buffer ? deck 3 stem Vocal 0.5 & set_var $md1_1_1 0.5 : deck 3 stem Vocal 0 & set_var $md1_1_1 0 "/>


The only difference I can tell is the addition of the variable in the second. I'm sure I'm doing something wrong I just don't see it


 

Inviato 4 hours ago
you have params wrong way round for the verb, valid version
var_smaller VARNAME `ACTION`
var_smaller `ACTION` `ACTION`
 

locoDog wrote :
you have params wrong way round for the verb, valid version
var_smaller VARNAME `ACTION`
var_smaller `ACTION` `ACTION`


So for my example, i would need to to this: (?)

<map value="MD1_PUSH_1_1" action="var_smaller $enc_buffer `deck 3 stem Vocal` ? deck 3 stem Vocal 0.5 : deck 3 stem Vocal 0 "/>


That did not work.

This also did not work:

<map value="MD1_PUSH_1_1" action="var_smaller `$enc_buffer` `deck 3 stem Vocal` ? deck 3 stem Vocal 0.5 : deck 3 stem Vocal 0 "/>