I'm wondering if there is an event listener section to put variables in that I'm missing?
For example, if a song is playing.
The syntax could be something like, "If playing ? Do this : Else this"
or if a loop is runing. or a variety of other things.
I find myself wanting to do things when certain events are happening or have happened. I can't remember the exact case, but I ran into it when I was programming my controller the other day. I think it was something where I wanted to test the state of something and assign it to a variable. If it was true, then do this thing with my script, otherwise, do that. It didn't involve a button press event.
Any help would be appreciated.
For example, if a song is playing.
The syntax could be something like, "If playing ? Do this : Else this"
or if a loop is runing. or a variety of other things.
I find myself wanting to do things when certain events are happening or have happened. I can't remember the exact case, but I ran into it when I was programming my controller the other day. I think it was something where I wanted to test the state of something and assign it to a variable. If it was true, then do this thing with my script, otherwise, do that. It didn't involve a button press event.
Any help would be appreciated.
Posted Sat 25 Jun 16 @ 3:56 am
You can map any controller/keyboard/skin custom button to trigger an action if an "event' is happening, but keep in mind that those actions will be executed only when those buttons are pressed and not just when the query returns true.
So if youhave a button like ..
play ? doThis : doThat
the button when pressed , it will execute the doThis action if the track is playing (the query play returns true) or the doThat action if false (track is paused)
One way (probably the only one) to get some actions executed without you doing/pressing anything, is to add some POIs (type : Action) from the POI Editor in a track that will execute an action when these POIs are reached.
Lastly, in case you always want something to be executed when e.g. a track is looped or played, you need to add this action to your PLAY/LOOP buttons you are using.
so e.g. the PLAY button on your controller, can be :
play_pause & play ? doThis : doThat
So if youhave a button like ..
play ? doThis : doThat
the button when pressed , it will execute the doThis action if the track is playing (the query play returns true) or the doThat action if false (track is paused)
One way (probably the only one) to get some actions executed without you doing/pressing anything, is to add some POIs (type : Action) from the POI Editor in a track that will execute an action when these POIs are reached.
Lastly, in case you always want something to be executed when e.g. a track is looped or played, you need to add this action to your PLAY/LOOP buttons you are using.
so e.g. the PLAY button on your controller, can be :
play_pause & play ? doThis : doThat
Posted Sat 25 Jun 16 @ 1:12 pm
I can't seem to get the syntax down for the if statements.
I understand:
question ? this if true : this if false
question 1 ? question 2 ? this if 1&2 are true : this if 1 is true and 2 is false : this if both are false
But what do you do when you have several questions? Is it written like programming syntax with if statements?
For example, I want to use the Shift and browser knob pressed even to cycle through a skin variation. I have it working fine right now if I'm on 2 deck and want to switch to zoom. Press it again and I go back to 2 deck. Don't use Shift and it's just a regular browser knob.
The problem comes in if I'm on 4 deck mode. I can't get the chain right.
This is what I'm trying to do.
If I'm pressing $shift and on 2 deck mode, switch to zoom mode.
If I'm on pressing $shift and on zoom mode, switch back to 2 deck.
If I'm pressing $shift and on 4 deck mode, switch to zoom.
If I'm pressing $shift and on zoom, switch back to 4 deck.
If I just push the browser button, browser_window
Seems like I need to set a variable with the current skin when I press shift. Then, that could be used to get me back to the 2/4 deck skin layout I was using.
I understand:
question ? this if true : this if false
question 1 ? question 2 ? this if 1&2 are true : this if 1 is true and 2 is false : this if both are false
But what do you do when you have several questions? Is it written like programming syntax with if statements?
For example, I want to use the Shift and browser knob pressed even to cycle through a skin variation. I have it working fine right now if I'm on 2 deck and want to switch to zoom. Press it again and I go back to 2 deck. Don't use Shift and it's just a regular browser knob.
The problem comes in if I'm on 4 deck mode. I can't get the chain right.
This is what I'm trying to do.
If I'm pressing $shift and on 2 deck mode, switch to zoom mode.
If I'm on pressing $shift and on zoom mode, switch back to 2 deck.
If I'm pressing $shift and on 4 deck mode, switch to zoom.
If I'm pressing $shift and on zoom, switch back to 4 deck.
If I just push the browser button, browser_window
Seems like I need to set a variable with the current skin when I press shift. Then, that could be used to get me back to the 2/4 deck skin layout I was using.
Posted Tue 28 Jun 16 @ 8:59 am
first. a small correction...
In fact its ..
question 1 ? question 2 ? this if 1&2 are true : this if 1 is true and 2 is false : this if question 1 returns false (doesnt query Q 2 - the red part is only executed/queried if question 1 is true)
about your browser zoom question... are you talking about some skin that has 2 modes (2 decks & 4 decks) and those change using a panel action ?
Also is the "browser zoom" mode in that skin , some kind of a panel ?
Keep in mind that version 8.2 offers a browser_zoom action, but in order this to be used, the skin has to offer that in the <browser> element and probably offer the necessary browser panels, using some visibility with the action.
So, please provide more info in order to assist you further.
It all depends on how the panels are structured and declared.
Cannen wrote :
question 1 ? question 2 ? this if 1&2 are true : this if 1 is true and 2 is false : this if both are false
In fact its ..
question 1 ? question 2 ? this if 1&2 are true : this if 1 is true and 2 is false : this if question 1 returns false (doesnt query Q 2 - the red part is only executed/queried if question 1 is true)
about your browser zoom question... are you talking about some skin that has 2 modes (2 decks & 4 decks) and those change using a panel action ?
Also is the "browser zoom" mode in that skin , some kind of a panel ?
Keep in mind that version 8.2 offers a browser_zoom action, but in order this to be used, the skin has to offer that in the <browser> element and probably offer the necessary browser panels, using some visibility with the action.
So, please provide more info in order to assist you further.
It all depends on how the panels are structured and declared.
Posted Wed 29 Jun 16 @ 1:04 am
I'm using the V8Fruit skin. The skin layouts I use are - 2 deck, 4 deck swap, and Extended Browser (that skins version of browser zoom).
If I'm in the middle of a typical gig, I use the 2 deck layout and Extended for song searches. Otherwise, the display area is just too small on my laptop.
If I'm doing something like a wedding where I need certain songs at key times, I use the 4 deck swap skin. I then load up the special songs in the 4 decks so that I can start them playing when I need to. Sometimes I'm talking and need to trigger them. Again, the Extended Browser layout helps me to locate tracks while I'm doing the dancing portion. I never have a set list.
Those are the times when I use them. The way I switch between 2 deck and extended or 4 deck and extended is by holding shift on my controller and pushing down on the browser knob.
Currently, my code looks like this:
It works fine for switching between 2 deck and Extended (browser zoom), but if I switch to a 4 deck skin, then go into Extended, then back out, it goes to 2 deck layout.
'@$v8bf_layout' 0 --- 2 deck
'@$v8bf_layout' 2 --- 4 deck swap
'@$v8bf_layout' 9 --- Extended Browser (browser zoom variant)
So, I'm trying to figure out how to let it know what layout I'm working with, 2/4 deck, switch to Extended, and then back to the one I'm using. I thought that I could assign a variable when I press shift that checks which layout I'm currently using. Then use that to switch back and forth. But, I can't really figure out the if statement beyond about 2 questions.
Thanks for helping.
If I'm in the middle of a typical gig, I use the 2 deck layout and Extended for song searches. Otherwise, the display area is just too small on my laptop.
If I'm doing something like a wedding where I need certain songs at key times, I use the 4 deck swap skin. I then load up the special songs in the 4 decks so that I can start them playing when I need to. Sometimes I'm talking and need to trigger them. Again, the Extended Browser layout helps me to locate tracks while I'm doing the dancing portion. I never have a set list.
Those are the times when I use them. The way I switch between 2 deck and extended or 4 deck and extended is by holding shift on my controller and pushing down on the browser knob.
Currently, my code looks like this:
var '$shift' ? set '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 : set '@$v8bf_layout' 0 : browser_window 'folders,songs,automix'
It works fine for switching between 2 deck and Extended (browser zoom), but if I switch to a 4 deck skin, then go into Extended, then back out, it goes to 2 deck layout.
'@$v8bf_layout' 0 --- 2 deck
'@$v8bf_layout' 2 --- 4 deck swap
'@$v8bf_layout' 9 --- Extended Browser (browser zoom variant)
So, I'm trying to figure out how to let it know what layout I'm working with, 2/4 deck, switch to Extended, and then back to the one I'm using. I thought that I could assign a variable when I press shift that checks which layout I'm currently using. Then use that to switch back and forth. But, I can't really figure out the if statement beyond about 2 questions.
Thanks for helping.
Posted Wed 29 Jun 16 @ 1:57 am
hmm you ll have to speak with Fruit on this, because the way he has implemented the variables, there is an issue.
Example
- 2 Decks mode -> var has value 0
- Switch to Browser zoom ->value has 9
Now if you want to swtich back to Decks view, how will the software know to which deck mode it was before ? I mean what value should you give .. 0 or 2 ???
Best is to post your issue to the Fruit skin topic in Skins Forum.
The way i see it, there should be 2 values for Browser Zoom mode, e.g.
'@$v8bf_layout' 9 --- Extended Browser 2 decks (browser zoom variant)
'@$v8bf_layout' 10 --- Extended Browser 4 decks (browser zoom variant)
If that was the case, then you could have ..
var '$shift' ? var '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 : var '@$v8bf_layout' 2 ? set '@$v8bf_layout' 10 : var '@$v8bf_layout' 9 ? set '@$v8bf_layout' 0 : set '@$v8bf_layout' 10 ? set '@$v8bf_layout' 2 : nothing : browser_window 'folders,songs,automix'
There could be a workaround, with more "complex" script to bypass this issue.. try ..
var '$shift' ? var '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 & set '$fromdecks' 2 : var '@$v8bf_layout' 2 ? set '@$v8bf_layout' 9 & set '$fromdecks' 4 : var '@$v8bf_layout' 9 ? var_equal '$fromdecks' 2 ? set '$fromdecks' 0 & set '@$v8bf_layout' 0 : var_equal '$fromdecks' 4 ? set '$fromdecks' 0 & set '@$v8bf_layout' 2 : nothing : browser_window 'folders,songs,automix'
Example
- 2 Decks mode -> var has value 0
- Switch to Browser zoom ->value has 9
Now if you want to swtich back to Decks view, how will the software know to which deck mode it was before ? I mean what value should you give .. 0 or 2 ???
Best is to post your issue to the Fruit skin topic in Skins Forum.
The way i see it, there should be 2 values for Browser Zoom mode, e.g.
'@$v8bf_layout' 9 --- Extended Browser 2 decks (browser zoom variant)
'@$v8bf_layout' 10 --- Extended Browser 4 decks (browser zoom variant)
If that was the case, then you could have ..
var '$shift' ? var '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 : var '@$v8bf_layout' 2 ? set '@$v8bf_layout' 10 : var '@$v8bf_layout' 9 ? set '@$v8bf_layout' 0 : set '@$v8bf_layout' 10 ? set '@$v8bf_layout' 2 : nothing : browser_window 'folders,songs,automix'
There could be a workaround, with more "complex" script to bypass this issue.. try ..
var '$shift' ? var '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 & set '$fromdecks' 2 : var '@$v8bf_layout' 2 ? set '@$v8bf_layout' 9 & set '$fromdecks' 4 : var '@$v8bf_layout' 9 ? var_equal '$fromdecks' 2 ? set '$fromdecks' 0 & set '@$v8bf_layout' 0 : var_equal '$fromdecks' 4 ? set '$fromdecks' 0 & set '@$v8bf_layout' 2 : nothing : browser_window 'folders,songs,automix'
Posted Wed 29 Jun 16 @ 8:16 pm
djdad wrote :
There could be a workaround, with more "complex" script to bypass this issue.. try ..
var '$shift' ? var '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 & set '$fromdecks' 2 : var '@$v8bf_layout' 2 ? set '@$v8bf_layout' 9 & set '$fromdecks' 4 : var '@$v8bf_layout' 9 ? var_equal '$fromdecks' 2 ? set '$fromdecks' 0 & set '@$v8bf_layout' 0 : var_equal '$fromdecks' 4 ? set '$fromdecks' 0 & set '@$v8bf_layout' 2 : nothing : browser_window 'folders,songs,automix'
var '$shift' ? var '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 & set '$fromdecks' 2 : var '@$v8bf_layout' 2 ? set '@$v8bf_layout' 9 & set '$fromdecks' 4 : var '@$v8bf_layout' 9 ? var_equal '$fromdecks' 2 ? set '$fromdecks' 0 & set '@$v8bf_layout' 0 : var_equal '$fromdecks' 4 ? set '$fromdecks' 0 & set '@$v8bf_layout' 2 : nothing : browser_window 'folders,songs,automix'
This one works exactly as I need it to. Thank you very much. Only thing that I could think to improve is to have a variable come from Fruit on what the current deck is. That could then be saved to the $fromdecks variable to switch back and forth.
One last thing. Could you explain the order of operations in the code quoted above? I'd like to understand the structure for future scripts.
Thanks. :)
Posted Thu 30 Jun 16 @ 9:46 pm
Actually, this script does work for switching back and forth between the correct skins, but the non-shift function stopped working. When you push down on the knob, it doesn't navigate through the panels anymore.
Did we miss something?
Did we miss something?
Posted Wed 06 Jul 16 @ 6:32 pm
From what I've read so far, I believe the most easy way to handle this would be to have 2 separate custom mappings saved for each type of venue, one for the 2-decks, and another for the 4-decks, so in each of those custom mappers you would have something simple as :
Thus, I will try to add a kind of 'fromlayout' var in 0.8.
var '$shift' ? set '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 : set '@$v8bf_layout' 0 : browser_window 'folders,songs,automix'
var '$shift' ? set '@$v8bf_layout' 2 ? set '@$v8bf_layout' 9 : set '@$v8bf_layout' 2 : browser_window 'folders,songs,automix'
Thus, I will try to add a kind of 'fromlayout' var in 0.8.
Posted Thu 07 Jul 16 @ 11:20 am
And Djdad just forgot one 'nothing' at the end of the string, otherwise it seems to work (even the browser_window switch thing) :
var '$shift' ? var '@$v8bf_layout' 0 ? set '@$v8bf_layout' 9 & set '$fromdecks' 2 : var '@$v8bf_layout' 2 ? set '@$v8bf_layout' 9 & set '$fromdecks' 4 : var '@$v8bf_layout' 9 ? var_equal '$fromdecks' 2 ? set '$fromdecks' 0 & set '@$v8bf_layout' 0 : var_equal '$fromdecks' 4 ? set '$fromdecks' 0 & set '@$v8bf_layout' 2 : nothing : nothing : browser_window 'folders,songs,automix'
Posted Thu 07 Jul 16 @ 2:19 pm