THEMA: Limiting question count in group

we set up a question group with potentially 10 questions. Each question depends on a different relevance equation and may or may not be shown. We're looking for a possibility to limit the number of asked questions in this group. In other words, if two of the questions have been shown, we want to step forward to the next group.
The questions are non mandatory text inputs, so we can't use the answers as a counter.
I tried different ways but none worked.
Is it possible to implement a javascript counter and access it from the Expression Manager?
Do you have any ideas?

Der Administrator hat öffentliche Schreibrechte deaktiviert.

JavaScript is currently disabled.Please enable it for a better experience of Jumi.

1) Set the questions in the 10-question group to display in a random order.

2) Add the following to the source of one of the questions in that group. The script hides all but the first two questions that are shown by relevance. Adjust "maxShown" to change the number of questions shown.

With the script you provided above, is there any code that I could add to it to make it so that one of the questions in the group always showed and the rest of them were random? I have 5 questions in a group and need for 1 of them to always show along with 1 other than is random between the 4.

I forgot to mention one criteria, sorry! Here are the criteria
1. 5 locations
2. 1 location is always to be shown
3. the other 4 locations are randomly shown
4. the 1 location that is always to be shown, has to randomly appear 1st or 2nd of the 2 total questions that show.
I tried putting 2 of the random questions before the one that shows all the time and 2 after but can't get that to work. Any ideas?