I am trying to create a new question type which given a template calls external script, creates unique questions and answers which are stored in a database. Then when I insert this type of question in the quiz, I would like to get one of these questions and answers (randomly chosen). I would say that this is somewhat similar to the calculated question type.
When trying to display that type of question in a quiz, I am trying to edit the question->questiondata and question->result with one of the unique questions and answers.
I was trying to accomplish this by changing the question->questiondata and question->result when the function initialise_question_instance() is called. However, when I submit and review the question, the question is populated with different data (I suppose that the function initialise_question_instance() is called again and that's why the data has changed).
Do you know in which step I should edit the question->questiondata and question->result, so that the new created question stays the same and doesn't change.