The go[] function is used to navigate to a different card.
There are three ways to specify the card you want:
- by index: if you provide a number n, go[n] will navigate to the nth card in the deck, counting from 0.
- by name: if you provide a string s, go[s] will navigate to the card with that name.
- by value: if you provide a card c, go[c] will navigate to the card you provided.
Navigating by index is usually not a great idea, because adding or removing cards can easily break such a script. We'll use navigation by value for these examples.
The numeric value of a slider widget can be viewed through its .value attribute.
To turn a numeric index into a card value, we'll make a list of cards and index into it using the slider's .value.
To slightly simplify your example, let's say you have a slider named "mySlider" with a range from 0 to 2, and cards named cardA, cardB, and cardC.
Forming a list:
(cardA,cardB,cardC)
Forming a list and then indexing it:
(cardA,cardB,cardC)[mySlider.value]
So the full button's script could be:
on click do go[(cardA,cardB,cardC)[mySlider.value]] end
And of course, if you want a smoother transition you can specify go[]'s optional arguments for a transition style and delay:
on click do go[(cardA,cardB,cardC)[mySlider.value] "BoxIn" 15] end
This kind of approach also works if you don't need/want all the destinations to be distinct. Consider:
on click do go[(cardA,cardA,cardB,cardC,cardB)[mySlider.value]] end
Is that clear?