How to get a list (containing also sublist) of commands executed ?

Morten Eyrich shared this question 2 years ago
Needs Answer

Is it possible to create a list (containing also sublist) of commands and get them executed in a click script, and if so how ?


I ask because I have created a quiz with a list of about 100 grouped questions in the spreadsheet, and for many of them one or more click-script is executed and different objects are visible depending on the individual question.

At this moment this is controlled by the question number that is attached to every question as it is written in IF-sentences in every click-script that is needed to be executed in relation to each question.

But the "problem" is that when I create a new question between the old ones (to get the questions grouped and organized), I have to change the question numbers in every related click script every time. And now there is so many question numbers that I need to change, which takes quite a long time to change.

Therefore I would like to do this in another way.

I then came up with the idea to add two more columns "Run click script" and "Show/hide" beside "Question" and "Correct answer". And create a list for those two columns also.


And when a question is asked, then somehow get GeoGebra to first run the click-script for the button written in the column "Run click script", and then execute all the SetValue commands in the cell written in the column "Show/hide" - which may be a sublist in the list that is created for that column.


1) Can this be done, and if so how ?

Meaning, is it possible to get GeoGebra to execute an element on a list that contains one or several commands and if so how ?


2) Would you recommend another solution, and if so which... ?

Comments (4)

photo
1

Here is a way to get GeoGebra to execute an element on a list that contains one or several commands.


See the attached ggb-file.

photo
1

You may want to accomplish the following.

photo
1

I can't see anything is happening in the file...


But I have also found a way to make this quite huge quiz with different kinds of generated task.


Although instead of adding two more columns "Run click script" and "Show/hide" beside "Question" and "Correct answer", I added only one where I wrote the kind of exercise in a string which is related to a certain click-script so that when the question is asked, the click-script is being executed. This makes it possible to add new questions, and reorganize the old ones by moving the already made questions and answers around without the need to edit the already made click-script.

photo
photo
1

instead of an abstract description of the problem, a concrete example would be more helpful.

© 2023 International GeoGebra Institute