You need to have the content to randomize indented right under the *randomize
keyword, so all you have to do to get your code to work is to change the first two lines:
*component
*randomize: 2
*group
*component
*classes: bg-info
*image: https://i.stack.imgur.com/WFy1e.jpg
*caption: cats
*click
>> preferred_image = "Cat"
*program: second_program
*group
*component
*classes: bg-info
*image: https://i.stack.imgur.com/WFy1e.jpg
*caption: Family or dog?
*click
>> preferred_image = "Dog"
*program: second_program
*wait
The code that you add below the components gets displayed because a component, even if it is clickable, does not act like a page break. In order to create the page break, note that I added a *wait
forever.
If you want to have some code after the components that gets executed after second_program is run, you can use a *goto
and *label
:
*group
*component
*classes: bg-info
*image: https://i.stack.imgur.com/WFy1e.jpg
*caption: Family or dog?
*click
>> preferred_image = "Dog"
*program: second_program
*goto: after_second_program
*wait
*label: after_second_program