QID Expression to keep score in a quiz

You have completed your first interactive designs with QuarkXPress 7, 8 & 9 and now have need for more advanced functionality. Discuss Expressions here, ask questions and learn more about them.
Please note that Flash (SWF) authoring is not supported in QuarkXPress 10 anymore.
Locked
JPrit
Posts: 2
Joined: 28 May 2009, 02:26

QID Expression to keep score in a quiz

Post by JPrit » 27 May 2009, 21:39

Hi there,

I've writen a very simple multiple choice quiz in QID. Each questions is set on its own page with three answer choices, two incorrect and one correct. Very simply an incorrect answer generates a try again script. A correct answer plays a 'correct' script and advances the user to the next page.
I would like to do two things (for different quizzes)

A) keep a score - so that a correct answer would be "score" + 1, advance user to new page. An incorrect answer would be score unchanged, advance user to next page.
B) Have the user start with 3 lives, score =3 and lose one, score = -1 for each incorrect answer. When score = 0, goto end page or start again.
I believe this would be relatively simple to do in QID using expressions but after alot of trial & error I can't figure out how to structure them at all.
Does somebody know the expression(s) required to define a numeric value and adjust it. Any help would b e greatly appreciated!

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

QID Expression to keep score in a quiz

Post by Matthias Guenther (Quark) » 27 May 2009, 21:58

Hi, JPrit,
JPrit wrote:Does somebody know the BLOCKED EXPRESSION required to define a numeric value and adjust it.

I am not sure what you are asking? What is a blocked expression please?
If I understand you correctly, you need variables. Define one (under Edit menu), as it is a non-fractional number it needs to be "Integer".
You set it with "mylives = 3" and you reduce it (by one) with "mylives = mylives -1". You test with "If mylives == 0". Is that what you are asking?
Best
Matthias

JPrit
Posts: 2
Joined: 28 May 2009, 02:26

QID Expression to keep score in a quiz

Post by JPrit » 27 May 2009, 23:30

Matthias,
Thanks for your ultra-prompt response.
Re: BLOCKED EXPRESSION - I typed, expression bracket 's' close brackets, meaning I thought I might need more than one expression. It came out in the post as BLOCKED EXPRESSION for some reason.
Re: Your response
Thank you! Now understand that I need to set a variable. i.e "mylives"

In order to display the variable I assigned it to a text box called "box1" using Box1.Append(mylives)
I think from here I can work out what I need to do. I will try to post a link to the completed quiz with scripts if successful, otherwise I'll be back for more help!!

One comment, I found the command for Append in the QID help files as Append does not appear anywhere in the expressions dialogue box.
Is there a comprehensive list of expressions and their values somewhere?? Without some sort of guide it makes learning expressions for users unfamiliar with them very frustrating.
Many thanks again

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

QID Expression to keep score in a quiz

Post by Matthias Guenther (Quark) » 28 May 2009, 01:22

Hi, JPrit,
glad it is working for you.
JPrit wrote:Is there a comprehensive list of expressions and their values somewhere?? Without some sort of guide it makes learning expressions for users unfamiliar with them very frustrating.

Sure. A list of ALL expressions with a short explanation is in the Expressions Editor:
Image Best
Matthias

JPrit
Posts: 2
Joined: 28 May 2009, 02:26

QID Expression to keep score in a quiz

Post by JPrit » 28 May 2009, 22:37

Thanks for the above graphic. I'm starting to get to grips with expressions now!
Looking at your predefined elements at the top of this forum (which are very useful and highly recommended for anyone looking to learn how to structure scripts and expression in QID). I was able to complete the scoring element of my quiz. In the end it just needed the "If" action, no expressions.
I made each life a picture object labelled life 1, life 2 etc. and just ran the script - if answer wrong hide life 1, if life 1 hidden hide life 2, if life 2 hidden Game Over - very simple really, but very helpful to see the actions you'd used in previous projects - so thank you.
You can see the final quiz in situ at http://www.3-6-6.com/?page_id=56
How's your knowledge of World Capitals - Bet you can't finish it! [;)]

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

QID Expression to keep score in a quiz

Post by Matthias Guenther (Quark) » 29 May 2009, 09:31

Hi, JPrit,
JPrit wrote:You can see the final quiz in situ at http://www.3-6-6.com/?page_id=56

Very nice, though for a travelling European too easy maybe. [;)]
I have to admit I quit in the middle of level 3 (hey, it's Friday evening).
Thanks
Matthias

Locked

Return to “Expressions”