Forum Discussion
Add/Subtract Checked/Unchecked Button Text Variables from Multiple Slides to Results Slide
Christine,
Here's a script that I have used. The slides are proprietary, but you may use the script. Instructions are in Bold.
var player = GetPlayer();
var correct =[];
var inCorrect =[];
var selections =[];
var j=1;
var k=1;
var NOP = ["","Jaw Thrust maneuver", "Oropharyngeal airway", "Nasopharyngeal airway", "King (multi-lumen) airway", "Laryngeal Mask Airway (LMA)", "Endotracheal tube", "Cricothyroidotomy"]
//NOP stands for "Name of Procedure". They are used here as the answers that print on the slide if selected.
selections[1] = player.GetVar("JawThrust");
selections[2] = player.GetVar("Oro");
selections[3] = player.GetVar("Naso");
selections[4] = player.GetVar("King");
selections[5] = player.GetVar("LMA");
selections[6] = player.GetVar("ET_Tube");
selections[7] = player.GetVar("Crico");
These variables that are gotten are in SL. They are T/F, set to false initially, and set to true by SL if they are selected. They correspond to the names of the procedures.
for(i = 1; i < 8; i++){
if (selections[i] == true) {
correct[j] = NOP [i];
j++;
} else {
inCorrect[k] = NOP[i];
k++;
}
}
The correct and inCorrect arrays are for the js, and are populated according to the selection of the variable values gotten from SL (true or false). Then they are returned to SL, and placed into the SL text variables (Correct1, Correct2 ... through 9, and InCorrect1, InCorrect2 ... through 9). The procedures that are selected (true) have their names placed in the Correct variables, and the others are placed in InCorrect variables.
for(i = 1; i < 8; i++){
if (correct[i] != null) {player.SetVar("Correct" + i, correct[i]);}
if (inCorrect[i] != null) {player.SetVar("InCorrect" + i, inCorrect[i]);}
}
player.SetVar("correctAnswers", j-1);
The Correct and InCorrect variables are returned to SL, along with correctAnswers (a numeric variable in SL) which represents how many answers were selected.
This is the page in SL that displays them. Correct and InCorrect variables that don't have values don't display,
This may get you started.
Related Content
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago