HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... dropdown
dropdown
  View type:
Hi - I am very new to this! Is it possible to give a value to a radio button or dropdown list item and get it to add to the total score??

I have tried adding the values but cannot see howto link it into the total objective. My problem is I want to have about 5 selections (sets of radio buttons) made at the same time on the same slide and the Question sections are too big.

What I am doing is playing some notes which students will then select. i.e they hear 5 notes and need to select the 5 differnt notes from dropdown list or the like.

Any one have any ideas?
 
For a radio button you would want to right click and go into the properties to assign the buttons to change a variable.
If you have a bank of 3 assign a discrete value to each, so each selection gives you a different value.
Now you want to go into actions and set up an onchangestate action. Probably you'd want to check if the answer is correct so you'd set up a statement to check IF the button_var was correct. If correct add one to the module score variable. If incorrect pop up a feedback message.
You would do pretty much the same if using a drop down list.
 
 
Thanks Nick for the quick reply. I'm with you to a point. I have created a drop down menu with A B and C in it. Value C (the correct answer) I have given a value of 1.
Using the 'On Select Item' I have added the If condition. It reads IF(Condition='1') ....now I'm stuck. How do I add this to the total? I cannot work out which action to use. Cheers for patience!!!
Chris
 
 
 
The general syntax will be along the lines of
IF #var_name = 1
THEN
SETSCORE
ELSE
do something else..

You need to wrap these in brackets ()if you look through the samples in the script part of the help guide you'll get the idea quite quickly
#var_name is the variable name you gave to the radio button set
in SETSCORE tell it to use total (module score)and source the objects name, additive is set to add and increment by the value you want. It might be a good idea to pop up some confirmation note too.
The do something else part could be a to replay the note and show hidden text object
 
 
 
 
Thanks again - I think I'm in too deep here, can't find a THEN action. Will seek help from a tech friend who is into this side of things. Cheers.
 
 
 
 
 
Hi Chris sorry to confuse you there, the THEN is more of an implied statement, it happens as if it's there. It is useful to remember it though as the flow of statements makes more sense. Classic programming flows usually use
IF <something>
THEN <something>
ELSE <something>.
I did have some hassles with this in Version 2.3 due to the way it parses statements, in the 2.4 beta it's very much improved and there are even some nice syntax help 'popups' which will aid lots of people, but this should still work in 2.3

So walking through it a little more slowly using a dropdown selector, just substitute radio buttons if you prefer...
Make your drop down and assign values to your options. Note they needn't be unique so a reasonable idea is to use 1=right and 0=wrong.
Say option B is correct, then A=0 B=1 C=0 D=0 and so on. If using a dropdown I'd also make a first item in the list of items 'Please select your answer'so it's clear what to do with the list.

When an option is selected it will change the variables value to your setting (look at the dropdown properties to check the name of the variable as you'll need it in a minute AND if using more than one dropdown on the page name the name_var uniquely to make it easier to keep tabs on whats going on).
Now go into the actions for the dropdown and set an ON SELECT ITEM event and set an IF action as follows

#dropdown_var>=1
(this means if the var equals one go on to the next statement, if wrong and not equal to one look for an ELSE and do what it says there or stop and do nothing)So currently this will check the value of the answer but do nothing.

Now you need to make something to happen depending on wether the answer is correct or not. A standard list item with a tick is good with some text as a way of giving feedback. Drop one on the page and apply a BEFOREDISPLAY event to this item and hide it using a DISPLAY action. It's now hidden before it displays on the page so exists but isn't seen.

Now go back to the dropdown actions adding the next line which is the 'what to do if the answer is correct'

IF CONDITION #dropdown_var>=1
DISPLAY ( show the list item )

What SHOULD happen now is the page opens, the drop down is seen and the feedback list element isn't. Select option B (value=1) and the IF CONDITION is evaluated as being correct so the hidden list item appears.
If the wrong answer is selected then the flow of actions stop so you should put in an indicator to the user for that.
For this you need an ELSE which will be used if the IF statement isn't fulfilled.
So now we can make an indicator of failure using another list item with a different image and text to say Wrong.
Again it would be hidden with a before display applied to it and revealed if the answer is wrong using a display action in the dropdowns list of actions giving you
IF CONDITION #dropdown_var>=1
DISPLAY (show the list item )
ELSE
DISPLAY (show the alternative list item)

Remember you can have multiple statements (actions) following the first evaluation and following the ELSE so you can add to the total score or another variable, play sounds etc.
Courselab doesn't really 'hold your hand' on these kinds of events and the documentation could probably give more examples but they are where an awful lot of power lies within the software. It is worth the effort of persevering through the frustration because even partially mastering them enables you to do so much more.
Imagine a note stave on the page, the user hears a tone then has to drag and drop a note onto the stave. If its right they're told if wrong the note slides to the right place. If you get the hang of actions then you can do this kind of thing and much more.
Sorry this is a bit long but hopefully it's more understandable.
 
 
 
 
 
 
Thanks again!
I'm enjoying this but still having problems.

Everything makes sense however when I run it both items to show appear at the same time and regardless of the condition!

Here is how my ON SELECT ITEM looks...
IF(Condition='#select_var>=1')
DISPLAY(Object='SHAPE1',Display='inline',Effect='1',Duration='0')
ELSE
DISPLAY(Object='SHAPE2',Display='inline',Effect='1',Duration='0')

Each shape had the BEFOREDISPLAY set to hide.



Can you see my mistake?

Thanks Again. The experience will make me more understanding with my students!!
Chris
PS - tried adding in the set score after the IF
This added onto my total regardless of the answer. Therefore It seems that my IF statement is at fault.
 
 
 
 
 
 
 
Hi Chris, No mistakes but as I noted 2.3 was a little iffy about parsing variables, well variables as a class and doing some odd things with them. This is one of those bugs you're having problems with. Version 2.4 is now available and it improves this area hugely.
I did check this out in 2.4 and it works fine so I'd suggest get it ASAP.
If you're then still finding problems with this let me know and I'll mail you a working sample. If I get time between web dev and plumbing I'll add a simple drag and drop page you could adapt.
 
 
 
 
 
 
 
 
Nick, Have just updated to 2.4 but the problem is still there. I'd be very grateful if you did have the time to mail a working version - Don't talk about plumbing, my kids flooded the bathroom last night!!
Subject:
Message options
No additional options