Connexion rapide:  

Forum: General Discussion

Sujet Script School - Page: 26.0
locodogPRO InfinityModeratorMember since 2013

BRACKETS IN SCRIPT


So huge it gets a title box...
BUILD 6920

Oh boy, this doesn't quite tear up the rule book, [because the old rules still work] but it comes close, maybe takes the old rule book and puts it on a high shelf out of the way, because we have another newer rule book and it's way better , it changes a lot of ways of doing things.

Play along at home, do these simple examples and after a few you won't need to really think how to do them you'll just know [and be ready for something else]

We'll start with the old way with a simple example of nested queries

So we have a button, if deck 1 is playing do nothing, if not playing play deck 3,
deck 1 play ? nothing : deck 3 play

but aside from that, we also want if deck 2 is playing do nothing, if not playing play deck 4,
deck 2 play ? nothing : deck 4 play


so combining those we have to write it like this
deck 1 play ? nothing & deck 2 play ? nothing : deck 4 play : deck 3 play & deck 2 play ? nothing : deck 4 play

hard enough for some to understand but I hope you can read what is happening there.

So the new method with brackets
( deck 1 play ? nothing : deck 3 play ) & (deck 2 play ? nothing : deck 4 play )

now I guess that got a whole lot easier to understand what's happening.

This alone is huge, I have a script right now and it needs to check 6 things, so the old way to do it right [cover every possibility] took 63 queries, that was 11,000 chars of script.
[and very close to my limit of too annoying to work with]
the new method, just needs 6 queries, it cut the script down to like 1600 chars [it sounds a lot but it really isn't]

but wait, there's more. && query
a different example, let's say; if deck 1 is playing & deck 2 is playing ? yes both decks are playing then play deck 3 : it is not true both decks are playing, do nothing.

old method
deck 1 play ? deck 2 play ? deck 3 play : nothing : nothing

easy enough but

brackets method
( deck 1 play && deck 2 play ) ? deck 3 play : nothing

the && is important, it's like if both of these are true, return true/1 to the query, if one or both are false return false/0 to the query.

this above is query side brackets, it could be called a && query or a AND query, [&& or AND are name for common logic gate in digital electronics ]
it was sort of possible before with this
param_equal `deck 1 play && deck 2 play` 1 ? deck 3 play : nothing

same kind of thing, if both evaluate as true it returns true/1 to param_equal, if so, does 1 = 1 ? yes, deck 3 play , if it doesn't return true/1 to param_equal then does 0 = 1 ? nope, do nothing.
there is also another similar old way but it's even move typing and even more confusing so I won't mention it further as it was never a good way.

3rd awesome thing brackets do, relates to script deck focus, something I should have prattled on about before but forgot. It's a bigger script thing. [and it used to be really problematic]

consider a custom_button on deck 1, if we gave it this script
play

we press it and deck 1 plays, it knows it's a deck 1 button
now what if we had this as a deck 1 custom button

play & deck 2 play & effect_active 'echo'

both decks play, but it's deck 2 that gets the echo, because the script deck focus was moved to deck 2 with "deck 2 play", until another deck is specified it will act all commands on the last called deck.[last called in the script]

now look at these [still deck 1 custom button]
play & ( deck 2 play ) & effect_active 'echo'


now look at this [still deck 1 custom button]
( deck 2 play ) & play & effect_active 'echo'

these cases it's deck 1 that gets the echo, the script deck focus to deck 2 is contained in the brackets.

now try this,
( deck 2 play & effect_active 'distortion' ) & play & effect_active 'echo'

deck 2 gets distortion, deck 1 gets echo
now you might be thinking, "that's not that good, you could just rearrange the script to get the same result, And you're right. But this is only a simple explanation, bigger scripts that act on several decks this is a big pain saver.


This one next is 50:50, it probably more 90:10, It's not a feature or ability, it's just how it works, I think the devs made the right decision, but it still could be "ummm not sure" how it will work just by reading it the first time.
Read this what do you think should happen?
( wait 8bt & effect_active 1) & ( effect_active 2 )

before I knew, during testing I was 90% sure we would get
effect_active on slot 2 instantly & effect_active on slot 1 after a 8 beat wait and that's what we get. [the "wait" is contained in brackets]

Final thing, the more curious of you might be asking "can brackets in brackets?" and the answer is YES they can!,
this isn't a sensible example just the first one I thought up to prove the concept
deck 1 level 1.0 & deck 2 level 1.0 & deck 3 level 1.0 & wait 2000ms & ( deck 1 play ? ( deck 2 play ) & level 0.5 : (deck 3 play ) & level 0.0 ) & level 0.75


Quiz time, deck 1 is currently playing, you press this button above, what level is deck 1, level is deck 2, level is deck 3, what other deck starts playing because of this button press?

Answers
If you get this, you get all of it.

I need to go back and see what topics need updating now.
 

Posté Fri 29 Apr 22 @ 8:16 am
locodogPRO InfinityModeratorMember since 2013
the above was huge but that's not everything for this month, a good few script changes & a new verb [ooooh shiny]

-var_equal, var_greater and var_smaller support script as second parameter
not quite worthy of a title box but now these var_* scripts can compare vars against things and not just other vars. And why not, it'll be nice to use them more.

-search_playlists can accept script parameter, search script parameter passes deck correctly

so
search_playlists deck

deck here is literal not a stand in, 4 letters, d e c k,
the script will search for the playlists that hold the track on deck

plus it can also accept a script as a param to say maybe search playlists of what you're looking at in the browser. [example coming] [code][/code]

-goto_cue +1 also cycles through cues with other types than cue
not a new script thing but it deserves mention, previously goto_cue +1 would miss hotcues that are beat anchors, but stop would cycle them.
So yes little poi you can be a beat anchor and a hotcue and we'll just accept you as you are. Now be happy.

-browser_gotofolder can accept script parameter.
Cool cool cool makes navigation that bit easier.

-add get_browsed_folder_path
Shiny new verb, 3 people all asked the same sort of question in a few days needing the full path of what is being looked at in the folder list, the devs thought it would be handy to have too.

-Support "quick_filter 1 on" and "quick_filter 1 off" script
explicitly switch quick filters on / off - marvellous

That's all the script stuff added in the last month.
Added in, in a just month, no huge song and dance, get places, search for stuff, filter stuff, compare stuff, continual improvement.
 

Posté Fri 29 Apr 22 @ 9:29 am
locodogPRO InfinityModeratorMember since 2013
 
repeat_start 'strobe' ? on & cycle strobe 4 : off & cycle strobe 4 & repeat_start 'strobe' 25ms -1 &
( var strobe 1 ? param_smaller 'get_beat_bar 4' 0.5 ? set strT 0 : set strT 1 :
var strobe 2 ? param_smaller 'get_beat_bar 2' 0.5 ? set strT 0 : set strT 1 :
var strobe 3 ? param_smaller 'get_beat_bar 1' 0.5 ? set strT 0 : set strT 1 :
var strobe 0 ? repeat_stop 'strobe' & set strT 0 : ) &
var strT 0 ? effect_active negative off : effect_active negative on :



Practical example of brackets in scripts, previously where we
set strT 1
we'd have to write
effect_active negative on

likewise with set strT 0 & effect_active negative off,
not a massive saving in this example but goes a long way for readability.
 

Posté Fri 29 Apr 22 @ 10:58 am
Hi all,

I made a few buttons that seem to be performing well (at least in the situation I'm using them for) and I'd like to post this one first:

This is a standalone custom button for those who don't use their mixing console hardware very much. What it generally does is it mixes the left source or right source after dropping loop timing then uses a lower volume explosion. This most likely is not made for mixing experts and users who mainly use their hardware. I designed it for myself who mostly do outdoor mobile parties where my mixing board is slid inside my roadcase to protect it from the outdoor elements. With that being said I use automix most of the time and this button will probably make it easier for me to do an alternative automix during dance segments.

For best effect the first cue point is best set for the next song ahead of time. It's more geared to dance music with a decent beat.

Instructions:
1) Set cue point 1 to a point in the upcoming song where a beat is happening (Let's say that is song B)
2) On the opposite deck with song A playing, click the button with the below code which will end the current song A and start song B.

CrossFade MixExplode
crossfader 0% ? 
deck left select &
deck right hot_cue 1 & deck right play & sync & auto_crossfade 50% &
deck left select &
effect_active "flanger" on &
loop 2 &
wait 3bt &
loop 1 &
wait 3bt &
loop 0.5 &
wait 2bt &
loop 0.25 &
wait 1bt &
loop 0.125 &
wait 1bt &
sampler_volume_master 50% &
sampler_bank 1 &
sampler_play_stop 3 &
sampler_volume_master 50% &
deck left select &
effect_active "flanger" off &
deck left play_pause &
deck left loop 8 &
auto_crossfade 100% &
deck right select :
deck right select &
deck left hot_cue 1 & deck left play & sync & auto_crossfade 50% &
deck right select &
effect_active "flanger" on &
loop 2 &
wait 3bt &
loop 1 &
wait 3bt &
loop 0.5 &
wait 2bt &
loop 0.25 &
wait 1bt &
loop 0.125 &
wait 1bt &
sampler_volume_master 50% &
sampler_bank 1 &
sampler_play_stop 3 &
sampler_volume_master 50% &
deck right select &
effect_active "flanger" off &
play_pause &
deck right loop 8 &
auto_crossfade 0% &
deck left select


Note that it does set the previous song to a loop 8 which can be removed in the code. I might change that on my live gig in the future but right now my thought is that I might want to return to the same loop again after playing the new song.
 

Posté Tue 07 Jun 22 @ 12:52 am
Warnings about the previous script:
It's my thought that anyone using virtual for longer than a few weeks will understand that mixing songs too far apart in bpm are not recommended for this type of button unless it's modified.

Adding pitch_reset to the end of each if condition will reset each songs pitch back to 0%
 

Posté Tue 07 Jun 22 @ 12:57 am
SveninoPRO InfinityMember since 2009
 

Posté Mon 27 Jun 22 @ 6:29 pm
locodogPRO InfinityModeratorMember since 2013
@Svenino it's just

browser_scroll +/- 1
 

Posté Mon 27 Jun 22 @ 7:36 pm
SveninoPRO InfinityMember since 2009
Hello Locodoc, but it isn´t.
This would be TOO EASY.
Its not about to move the cursor position, but the visible position.

I made a script to jump to a specific folder (have many of them).
(browser_gotofolder 'karaoke' ...)
Now it may be that this folder is very downstairs and the subfolders are not visible.
So I have to move the slider up above to see the (sub)folder(s).
But I want this to automate like:

browser_gotofolder 'karaoke' AND move it to the top of the screen...
Maybe the screenshots (link upstairs) do make clear, what I need...
 

Posté Mon 27 Jun 22 @ 8:44 pm
locodogPRO InfinityModeratorMember since 2013
visual pos is based on scroll pos, try scroll down 20 & scroll up 10
 

Posté Mon 27 Jun 22 @ 10:02 pm

Sooo Loco Im trying to use the info/sideview area to have a list of compatible songs to the songs on deck.
Ive created a filter titled Immediate compatible with this script.
"Bpm Difference < 5 and Key Difference < 1 and Grouping contains Hot"
this is ok but I wanna have more criteria. Like I use the grouping field as a way to create my DJ library. it is something like.... "year/genre/Hot" So I want a criteria that says the grouping area entries must match. Now grouping area can have multiple entries, each entry is separated with a comma.
Is this doable?


 

Posté Tue 28 Jun 22 @ 12:51 am
SveninoPRO InfinityMember since 2009
locodog wrote :
visual pos is based on scroll pos, try scroll down 20 & scroll up 10


Thanks Locodoc, You brought me to this little trick, wich does the job:

browser_gotofolder "SCHLAGER" & browser_scroll +16 & browser_scroll -16


This brings nearly every selected folder in a toppy position.
Just Folders in "last row" means with less than 16 folders underneath fail this procedure.
So needed folders have to be placed in the beginning of the list.
 

Posté Tue 28 Jun 22 @ 9:53 am
Djratedxxx919 wrote :

Sooo Loco Im trying to use the info/sideview area to have a list of compatible songs to the songs on deck.
Ive created a filter titled Immediate compatible with this script.
"Bpm Difference < 5 and Key Difference < 1 and Grouping contains Hot"
this is ok but I wanna have more criteria. Like I use the grouping field as a way to create my DJ library. it is something like.... "year/genre/Hot" So I want a criteria that says the grouping area entries must match. Now grouping area can have multiple entries, each entry is separated with a comma.
Is this doable?






Hopefully, this picture helps you to understand.
The track on Deck 1 is Grouped as "ClassicRock" but in the immediate compatible list, nothing matches that grouping entry. But if you look at the list of classic rock songs there are matches. So now that I know I can set this filter folder I want to add a criteria that looks for matches in the Grouping field.
 

Posté Tue 28 Jun 22 @ 9:29 pm
locodogPRO InfinityModeratorMember since 2013
user made sidelists filters don't update live, they're only true when created.
 

Posté Wed 29 Jun 22 @ 1:25 am
locodog wrote :
user made sidelists filters don't update live, they're only true when created.

I can understand that. But what I noticed is at bottom of sideview is a place to add shortcut to folders. So I decided to have my "Immediate Compatible" Filter Folder as a shortcut. So this script will actually be for a filter folder.

 

Posté Wed 29 Jun 22 @ 1:41 am
Djratedxxx919 wrote :
locodog wrote :
user made sidelists filters don't update live, they're only true when created.

I can understand that. But what I noticed is at bottom of sideview is a place to add shortcut to folders. So I decided to have my "Immediate Compatible" Filter Folder as a shortcut. So this script will actually be for a filter folder.


+1

 

Posté Wed 29 Jun 22 @ 8:04 pm
locodogPRO InfinityModeratorMember since 2013
the only fields that update from track on deck are; bpm difference & key difference.
any other field would need a filter writing via plugin, or an unreasonable amount of bruteforce to cover every possibility.
Since you didn't get on with 'sticky', I'd say it's not viable currently.
 

Posté Wed 29 Jun 22 @ 9:13 pm
locodog wrote :
the only fields that update from track on deck are; bpm difference & key difference.
any other field would need a filter writing via plugin, or an unreasonable amount of bruteforce to cover every possibility.
Since you didn't get on with 'sticky', I'd say it's not viable currently.


As it is I have to click on it to update it...and I'm ok with that. I just need the proper script to search the grouping field and collect matches. I have come to understand it doesn't auto update but I'm ok with that.

 

Posté Wed 29 Jun 22 @ 10:12 pm
Djratedxxx919 wrote :
locodog wrote :
the only fields that update from track on deck are; bpm difference & key difference.
any other field would need a filter writing via plugin, or an unreasonable amount of bruteforce to cover every possibility.
Since you didn't get on with 'sticky', I'd say it's not viable currently.


As it is I have to click on it to update it...and I'm ok with that. I just need the proper script to search the grouping field and collect matches. I have come to understand it doesn't auto update but I'm ok with that.



+1
 

Posté Sun 03 Jul 22 @ 2:25 am
SveninoPRO InfinityMember since 2009
Hey, I want to change the fontsize of the cuenames in the wave-window of the skin.
They are so small that I can´t read them when I´m performing on stage.
So I have to go to the skinfile and change maybe just a number, but WHERE?



I´m using the haunting pro touch-skin by Alex RDZ96.
Thanks in advance for any help

(I posted the question in the skin-area, but didn´t get any answer. Next Gig on Saturday...)
 

Posté Wed 17 Aug 22 @ 2:21 pm
SveninoPRO InfinityMember since 2009
Solved!
In Skinfile there is the panel [panel name="defaultwave4deck"]
there under "Cue" the font can be changed or resized.
 

Posté Thu 18 Aug 22 @ 11:37 am
58%