Quick Sign In:  

Forum: General Discussion

Topic: Script School - Page: 4.35

This part of topic is old and might contain outdated or incorrect information

locodogPRO InfinityModeratorMember since 2013
Not just you, I think it vanished during the time they were sorting some text spacing bugs of the editor before 8.4 release.
It was a handy pointer for shorter scripts but anything longer than the textbox size you couldn't scroll down to see the conditioning.

For longer stuff I write in a text editor in a logic tree format, with np++ you can easily change from tree layout to wall of text with shift+tab to remove indents & ctrl+j to turn several lines into one line.
 

Posted Fri 20 Dec 19 @ 1:49 pm
RanikiPRO InfinityMember since 2018
Thanks as ever - I'll check out np++. Looks like a nifty little utility.....

While I'm here I would like to ask about chaining commands in queries and using "&&" ......

According to the VDJ Script page "If && is used instead of &, to chain commands in queries, the query returns true only if both chained commands return true."

However testing out the example that you gave earlier in the Script school (and other ones I've played around with myself):
effect_active "echo" && effect_active "flanger" ? effect_active "brakeStart" : effect_active "echo" on & effect_active "flanger" on
it doesn't seem to behave at all as I would expect....

Both Effects off -----> Press 1: Turns both effects on -----> Press 2: Brakestart Activated -----> Press 3: Echo starts toggling on and off & Brakestart with it.....

So it is looking to me like it is taking the first script effect_active "echo" as a command rather than as part of a single query as to whether both echo and flanger are active.

Could you say a bit more about how chained commands are used in queries using either "&" or "&&"

Cheers
 

Posted Fri 20 Dec 19 @ 5:35 pm
locodogPRO InfinityModeratorMember since 2013
I see what you mean, strange I see && used lots in skins for conditioning also a pad with something like this
effect_active 'echo' && effect_active 'cut'

will only light up with both conditions true,

but like you said in straight script [query to a command] it's only taking the last as a query and a first as a command.
perhaps something the devs could elucidate.
 

Posted Fri 20 Dec 19 @ 6:27 pm
NicotuxHome userMember since 2014
action1 && action2 ? action3 : action 4

if action1 is false, script stops and action2 is ignored maybe because global query will fail, but the test is ignored too
action2 only execute when action1 is true, making test appearing to only apply to action2

Test:
set a pad and name it " `get_var myvar`" - without quotes, keeping the leading space
as action:
set myvar ` var var1 1 && var var2 2 ? get_constant 55 : get_constant 42`

_ var1 _ var2 _ resulting name:
__ 0 ____ 0 ____ ?
__ 0 ____ 2 ____ ?
__ 1 ____ 0 ____ 42
__ 1 ____ 2 ____ 55

 

Posted Fri 20 Dec 19 @ 11:50 pm
RanikiPRO InfinityMember since 2018
Yes this does seem strange Locodog. Especially as the official script page definitely says:

Quote :
"When chained commands are used in queries, the result depends on the state of the 1st action. E.g. play & loop will return true if the deck is playing (regardless if the deck is looped or not).
If && is used instead of &, to chain commands in queries, the query returns true only if both chained commands return true.
E.g. play && loop query will return true only if both commands return true (deck is playing and is looped) and false in all other cases.


Which doesn't seem to be what is happening in practice.
 

Posted Sat 21 Dec 19 @ 2:07 am
AdionPRO InfinityCTOMember since 2006
The difference between & and && is only when used in queries, so for LED's etc, not when the action is executed when a button is pressed for example.
In that case & and && have the same effect, namely that both are executed.
So "a & b ? c : d" and "a && b ? c : d" both mean the same thing, namely, first do "a", then do "b ? c : d"
If you need "(a && b) ? c : d" you'll have to write it as "a ? b ? c : d : d"
 

Posted Sat 21 Dec 19 @ 3:12 am
RanikiPRO InfinityMember since 2018
Thanks Adion, that clears that one up then! And I don't need to spend any more time trying to get it to work!

It might be worth editing the script page on the website to make it clear that it only applies to "queries" rather than 'scripting questions' creating "conditional branching".
 

Posted Sat 21 Dec 19 @ 9:01 am
skyzo76PRO InfinityMember since 2016
hello vdj user,
I am working on a live show. One of my deck are several loop. Each on a cue (8 hotcues) and edit it "type" "saved loop". for some reasons, i can not be "precise" for triggering at the good time an another loop, then I need to command to vdj "when the 4 bars are completed, go to "loop 1" (or two or three depending on the button i trigger). It s a bit like the smart cue, but I do not like it because it trigger at the same moment of bar and not wait for the end of bars. I don't know if I am clear, my english is bad...for some Ableton users it is like launch a scene with the quantize on 1 bar.
thanks for futur help
bye
 

Posted Thu 26 Dec 19 @ 5:06 pm
locodogPRO InfinityModeratorMember since 2013
a rsi monitoring get_beat_bar X, looking for a high value <1.0 when true call whatever and stop the rsi.
 

Posted Thu 26 Dec 19 @ 7:56 pm
skyzo76PRO InfinityMember since 2016
thanks locodog for this respons. beginning of a new era for me :)
here is the code i put on custom pad

"repeat_start_instant 'bars' 10ms & get_beat_bar 4 & param_bigger 99% ? repeat_stop 'bars' & deck 1 hot_cue 1 : nothing "

working with my mouse (sometimes missed the first beat and do it at the second)
BUT I Copy Paste this code working good with my mouse on a button of my midi controller (traktor s4) button on cc gate
When i use this code on button encoder , it don't work...If I code my button with "pad1" it work but not ideal for me...does it have an explain for this ?
may be an holding condition?
 

Posted Fri 27 Dec 19 @ 11:00 am
skyzo76PRO InfinityMember since 2016
OK For the comment just below : when button is on cc..not working, when button is on note it is working :)
 

Posted Fri 27 Dec 19 @ 2:26 pm
locodogPRO InfinityModeratorMember since 2013
fastest a rsi can run is 30ms [any thing lower defaults to 30ms], to query beat_bar >99% leaves too little margin to catch it every time [as you've seen], try >97.625% that should be good upto about 190bpm.

If you want it tighter, the maths is
[1/bpm] * 60000 == ms/beat
30 / ms per beat == smallest fraction of a beat that can be caught with a 30ms poll rate
1 - [0.25*fraction] == value to query against
but rsi's have a bit of swing to the timing of the repeats so best to add 10-20 to the initial bpm to give a bit of wriggle room.
 

Posted Fri 27 Dec 19 @ 3:08 pm
skyzo76PRO InfinityMember since 2016
thanks for those precious math info. Sure I find a way to use it !
 

Posted Sat 28 Dec 19 @ 1:32 pm
locodog wrote :

What about shader folders, yep we got that covered, with effect_string 3
effect_string "shader" 3 "B&W"

(I have a folder called "B&W" for black & white shaders)


Ok.. might be a bit confusing for some readers.. but I'm using an Launchpad mini MK2 together with Lcodog's Zvideo shader automizer/fx-mixer add-on.
All 16 buttons can be mapped to one of the 8 layers of the Launchpad.. and also the leds respond when functions are selected.

I already succeed to route the command: 'effect_string 'shader 3 "foldername" to my computerkeyboard.. so I can group shaders for different music styles.. which is great..
But now I'm wondering if the script for the launchpad can be modified with this command and pads can have visual feedback when a folder (or pad) is selected.
I tried something myself without any luck..

The Launchpad is used for 3 layers now.. so every pad must be modified independently.. so all fuctions for 3 layers are presented in the script.. Locodog gave me the script below for the first pad.. which I modified for the other 15 pads of layer 3:

var '$padmode' 0 ? var '$recmode' 1 ? sampler_rec 1 : sampler_pad 1 & sampler 1 select : var '$padmode' 1 ? deck left hot_cue 1 : var '$padmode' 3 ? shift ? deck 1 padshift 1 : deck 1 pad 1 : nothing

While copying and pasting I didn't take into account that layer 1 and 2 are used for other functions (:o:).. I'll modify that later.. but I'm really wondering how to work this command out when selecting folders, and also if led feedback for the selected folder might be possible. :-)
Thanx in advance..
 

Posted Wed 08 Jan 20 @ 9:07 pm
locodogPRO InfinityModeratorMember since 2013
Seen, but I have an urgent appointment with a pizza right now.
I'm actually working on a full remapping of my LPmk2 as well, my video page rips apart a couple of pad pages to work direct. but that gives me 24[ish] buttons, to do the same sort of thing you have in mind.
I should be out of my calazone coma within 12 hours, I'll give a proper reply then.
 

Posted Wed 08 Jan 20 @ 10:09 pm
Hahaha.. bon appetit ;-)

But sounds great!! I'm sure it will be awesome :-) I should be able to import that same template on my LPmini mk2?? (with some tweaking)..

Been trying some stuff in script by adding a new padpage.. folders are selectable but no idea how to get that work on the LP.. looking forward to your work :-)

 

Posted Wed 08 Jan 20 @ 10:46 pm
After some experimenting I found out deck 2 can hold up a new padbank.. where folders can be called (triggered).
I nos succeed to map those deck 2 pads to some empty LP pads.. and same for the led responce. Calling them under deck 2. But it only changes the folder for deck 2 and not for deck 1.
Probably I'm doing something wrong.. but I'm very happy I hit some lights on the LP :-)
 

Posted Thu 09 Jan 20 @ 12:52 am
locodogPRO InfinityModeratorMember since 2013
Say this is LP key 3.1


var '$padmode' 0 ? [stuff for page 0] : var '$padmode' 1 ? [stuff for page 1] : var '$padmode' 3 ? deck 1 effect_string 'shader' 3 "foldername" : nothing

Your LED for 3.1 could look like this
var '$padmode' 0 ? [stuff for page 0] : var '$padmode' 1 ? [stuff for page 1] : var '$padmode' 3 ? deck 1 effect_string 'shader' 3 "foldername" ? blink 250ms ? color 'yellow' : color 'blue' : color 'red'

so if effect_string 'shader' 3 "foldername" is true, the color will blink yellow then blue
if it's false the color will be a solid red
 

Posted Thu 09 Jan 20 @ 1:43 pm
Thanx! This worked! :-) How well.. I had to add: deck 1 effect_string 'shader' 3 "foldername" & deck 2 effect_string 'shader' 3 "foldername" .. to the pads to get both decks to change from folder.

Been mapping for a while.. also some independent shiftkeys to turn off effects manually (lots of pads unused) not all shiftpads have visual responce but some do..
I was having a ball till VDJ crashed. Didn´t save my mapping :-(

Anyway.. I´m learning.. tommorow I´ll do another attempt and will save my edits sooner then..
 

Posted Fri 10 Jan 20 @ 1:10 am
skyzo76PRO InfinityMember since 2016
hello ,
I have one question : if I set a variable with one device. does it take effect with an other device or Var are exclusive with their device?
thanks
 

Posted Sat 18 Jan 20 @ 10:10 am
10%