Let’s suppose you have a question called myQuestion1 and you want to display feedback telling the user what they have scored in that particular question (rather than the on-going total for the whole quiz).
You might attach the following script to a script object on the question (by using this.UserScore the script will create a variable "on" the question object which other objects can see which would not be the case if we simply used var within the script itself. Alternatively you could create a page variable for UserScore and PossibleScore and then you would no longer need the this in any of the scripts segements below).
this.UserScore=myQuestion1.GetQuestionValue()
this.PossibleScore=myQuestion1.GetQuestionPossible()
this.CorrectlyAnswered=myQuestion1.GetQuestionCorrect()
You can then create a piece of text in which you display a page variable which you have created for the purpose of providing feedback which includes the variables careated above, for example:
You scored <this.UserScore>
out of <this.PossibleScore> Note that <this.UserScore> is inserted into the text as a Constant Expression when using the Insert Variable option from the Text menu. Alternatively you could adapt the feebdack text according to whether the user answered correctly. When the Submit button is pressed for the question then you check to see if it has been answered correctly using an If action and then display a different feedback object – one for the correct answer called correctFeedback and another called incorrectFeedback if (CorrectlyAnswered==true) { correctFeedback.Show() } else { incorrectFeedback.Show() } Finally you could have a single object called feedbackPanel with a piece of text displaying the variable feedbackText and change feedbackText depending on whether the user answered correctly.could run a piece of script which evaluated the answer and created the feedbackText accordingly. if (CorrectlyAnswered==true) { feedbackText= "Well done that is correct! You scored " + UserScore + "out of " + PossibleScore } else { feedbackText= "Good try but that is not correct! You scored " + UserScore + "out of " + PossibleScore } feedbackPanel.Show()Creating Feedback as required.