Ingreso rápido:  

Forum: General Discussion

Tema: set local variable on init
Hi all!

I have set a global variable on init (controller -> mapping -> ...):
set '$var1' 0.5
and it works...

But how can I set a local variable on init for the left deck only?
 

Mensajes Sun 26 May 24 @ 3:42 pm
check the wiki, .... and the description/explanation of Variables,
(particularly, local variables).

https://www.virtualdj.com/wiki/VDJscript.html



hint:
remove the "$" from variable name.
and add the deck specifier
the INIT would now be:
deck 1 set 'var1' 0.5

 

Mensajes Sun 26 May 24 @ 8:55 pm
Thank you very much!!! Now it works!
But....
I tried something similar and it does not work:

deck left set %varx 0.5
deck left set '%varx' 0.5


This worked:

deck left set 'varx' 0.5
deck 1 set 'varx' 0.5
deck 1 set %varx 0.5
deck 1 set '%varx' 0.5


The manual states that both %varx and 'varx' can be used as local variables. But here it does not work in both cases with "oninit"

My Conclusion:
If you want to use a variable with "%" at the beginning (like %var), then you cannot use the expression "deck left", but must use "deck 1".

Can someone confirm this?
 

Mensajes Mon 27 May 24 @ 1:28 am
locoDogPRO InfinityModeratorMember since 2013
you wouldn't really use deck left for setting a variable, left isn't a real deck, it's just the deck that is the left deck at the time, the actual variable will be saved to the numbered deck that is left at the time.
 

Mensajes Mon 27 May 24 @ 2:21 am
Thank you, that makes sense.
 

Mensajes Mon 27 May 24 @ 2:27 am