Sign In:     


Forum: VirtualDJ Technical Support

Topic: How to set variables to parameters on the VDJ script?

This topic is old and might contain outdated or incorrect information.

Eg:1
set '$inc' 1

level +'$inc' %
level + var '$inc'%

Eg2
set '$inc' '+1%'

level '$inc'
level var '$inc'

I have tried the above both.
However, not workable correct.
 

Posted Sat 29 Jun 19 @ 7:32 pm
What do you actually want to do ?
A variable is an integer. You can't treat it like percent. You need to cast it. But here are some examples:

set '$int' 1 <--Sets var value to 1

cycle '$int' 100 <-- Increases var value by one each time it's used until it reaches 100. Then resets to zero. If called once after the set '$int' 1 the '%int' var will have the value of 2

get_var '$int' & param_cast percent & level <-- This script will read the value of the variable, will try to convert it to percent and then it will assign it on level action (your deck's level)

You can add variables too, or do some other basic maths if you study the commands var_XXX and param_XXX

But if you just need something simple, it's better to tell us what you want to do in order to give you a better code example.
 

Hi Phantom Deejay

Thank you for explaining.

I want to control some knob/fader by the PAD button.

I tried the below.

set '$int' 1 & get_var '$int' & param_cast 'percentage' & deck 1 level

This script has 2 issues.

1) does not cast to percentage.
just cast to a numeric number.

2) execute just one time.
fader level was increased only one time even pushed PAD many times

also, I tried the below.
the result is the same.
did not repeat.

repeat 100ms & set '$int' 1 & get_var '$int' & param_cast 'percentage' & deck 1 level
 

1-
set var to 1 which is 100%
you set level to fixed value

deck 1 +1%

2- as this is a fixed value it ppears to work onece only

3 - you can repeat storing a constant, it won't change

repeat 100ms & deck 1 level +1%

finally there is no need of a variable

 

Hi,
Nicotex
I already had understood your explanation.

However, I have not found below rule in your comment, is it correct?

>>2- as this is a fixed value it ppears to work onece only

BTW,
I wand to control some parameter value with some variable value.

My purpose is Controlling the fader/knob change speed by the PAD device.

Currently, I did as below.
However, the code is so complex.
Because I am using a fix value parameter.

If I can assign variable value to parameter value, the code will be more simple.

------here is current working code ------------
repeat 50ms & var '$p' 0
? var '$m' 0
? var '$l'
? shift
? var '$v' 0
? deck 1 level +0.25%
: var '$v' 1
? deck 1 level +0.5%
: var '$v' 2
? deck 1 level +1%
: var '$v' 3
? deck 1 level +2%
: var '$v' 4
? deck 1 level +4%
: deck 1 level +8%
: var '$v' 0
? deck 1 level +1%
: var '$v' 1
? deck 1 level +2%
: var '$v' 2
? deck 1 level +4%
: var '$v' 3
? deck 1 level +8%
: var '$v' 4
? deck 1 level +16%
: deck 1 level +32%
: shift
? var '$v' 0
? deck 3 level +0.25%
: var '$v' 1
? deck 3 level +0.5%
: var '$v' 2
? deck 3 level +1%
: var '$v' 3
? deck 3 level +2%
: var '$v' 4
? deck 3 level +4%
: deck 3 level +8%
: var '$v' 0
? deck 3 level +1%
: var '$v' 1
? deck 3 level +2%
: var '$v' 2
? deck 3 level +4%
: var '$v' 3
? deck 3 level +8%
: var '$v' 4
? deck 3 level +16%
: deck 3 level +32%
: var '$m' 1
? nothing
: var '$m' 2
? nothing
: nothing
: var '$p' 1
? nothing
: var '$p' 2
? nothing
: var '$p' 3
? nothing
: var '$p' 4
? nothing
: var '$p' 5
? nothing
: nothing
 

Cycle a var then multiply it, then cast that.
 



(Old topics and forums are automatically closed)