Replies: 1 comment
-
|
Dear @adlergfx ... you can simply attach a script to a quiz, that checks the input ... In LiaScript <!--
@onload
window.quizCounter = {}
@end
@quizCounter: @quizCounterHelper(@uid,`@0`)
@quizCounterHelper
<script>
// storing the counts in a global variable
if (!window.quizCounter['@0']) {
window.quizCounter['@0'] = 0
}
window.quizCounter['@0']++
window.console.log("the input was '@input'", "trial: ", window.quizCounter['@0'])
window.console.log(window.quizCounter)
'@input' == '@1'
</script>
@end
-->
# QuizCounts
You can attach a script-tag to your quiz, which basically control the behaviour or can send some information to a remote server. In the example below, the click is simply stored within a global variable.
what is $ 22 \cdot 22 $
[[484]]
<script>
// storing the counts in a global variable
if (window.counter == undefined) {
window.counter = 0
}
window.counter ++
window.console.log("the input was '@input'", "trial: ", window.counter)
@input == 484
</script>
## Using the macro
With the `@quizCounter` you can make the upper script reusable. This macro will call another helper-macro, and pass in a `uid`, which is a special macro, that generates a unique id, whenever it is called. This way the result is stored within a global dictionary.
[[484]]
@quizCounter(484)
[[484]]
@quizCounter(111)
As an alternative you could also call the helper directly, but then you will have to pass a unique id by yourself...
[[111]]
@quizCounterHelper(MyID,123)
Macros are simple substitutions, so spaces are injected too ...You can try this out at the LiveEditor: here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
i am very happy with lia and try currently some Sandbox applications. Am I able to detect how many times a user has clicked "check"? I can disable it, but it would be great to understand if a user has used a bruteforce approach (check to win). AND can i figure out if hints would be used?
If not using with classrooms i think to submit success to a local db, but for improvement of courses, it would be great to know if hints and checks would be used. It can be a hint if the lecture should be improved in that topic.
Beta Was this translation helpful? Give feedback.
All reactions