Documentation

Shooting Range

Description

The Shooting range addon allows users to select correct answers from the elements that fall down in a specific time.

Properties

The list starts with the common properties, learn more about them by visiting the Modules description section. The other available properties are described below.

Property name Description
Initial Time For Answer The time when the first answer falls down. If the "Time For Last Answer" property is empty, then the answer time is equal to all properties.
Time For Last Answer The time when the last answer falls down. The rest of answers will get the time proportionally to "Initial Time For Answer" and "Time For Last Answer".
Descriptions The list where you can define possible levels in a game.
Property name Description
Definition Current level definition. All or no definitions must be set.
Answer 1 Text which will be set in the answer div.
Answer 2 Text which will be set in the answer div.
Answer 3 Text which will be set in the answer div.
Correct Answers Select, which answers are correct.
Available formats:
Separated by comma: "1,2".
In range: "1-3".
Single number: "2".

Supported commands

Command name Params Description
show --- Shows the addon.
hide --- Hides the addon.
restartGame --- Restarts the game to the first level and resets the score.
getResultsList --- Returns the list of player results. Each element is an object with the following structure: { score: playerScore, errors: playerErrors }

Events

The Shooting Range addon sends ValueChanged event when the state has been updated.

Field name Description
Item [question number]-[answer number]
Value 1: if the value was clicked.
0: if an element was dropped.
Score 0: if the clicked element was wrong or the element was dropped.
1: if the clicked element was correct.

The Shooting Range addon sends ValueChanged event when the game has been finished.

Field name Description
Source addon ID
Item 'all'
Value 'EOG'
Score always: 1

Styles

class name Description
addon-Shooting_Range-wrapper-question Question wrapper. In this element, the addon will set an actual definition. If definitions are empty, this element won't be displayed.
addon-Shooting_Range-wrapper-answers-wrapper Wrapper for answers. In this element all answers will be added. The height of this element can't be changed by css.
addon-Shooting_Range-play-button-wrapper Wrapper for the play button.
addon-Shooting_Range-button-play Play button. On click addon will start a game.
addon-Shooting_Range-answer-wrapper Wrapper of each answer element.
addon-Shooting_Range-answer-[answer-number] To distinguish answers, each answer will receive a unique class name.
addon-Shooting_Range-answer-text Each element of text in an answer will receive addon-Shooting_Range-answer-text class.
addon-Shooting_Range-answer-layer A layer used by the addon. This class shouldn't be changed by a user.
addon-Shooting_Range-wrapper-level Wrapper for current level of the game
clicked If an element was clicked, it will get the "clicked" class.
correct On show errors, a correct selected element will get a "correct" class.Or if an correct element was clicked, it will get the "correct" class.
wrong On show errors, a wrong selected element will get a "wrong" class. Or if an wrong element was clicked, it will get the "wrong" class.
isHidden The style used by the addon which shouldn't be used by a user.

Examples

Example of using the getResultsList command

EVENTSTART
Source:Single_State_Button1
SCRIPTSTART
  var shooting = presenter.playerController.getModule('Shooting_Range1');
  shooting.restartGame();

  var text = presenter.playerController.getModule('Text1');
  var list = shooting.getResultsList();
  var textToSet = "Correct:";
  for (var i = 0; i < list.length; i++) {
     textToSet += list[i].score;
  }
  textToSet += "<br />Errors:";
  for (var i = 0; i < list.length; i++) {
     textToSet += list[i].errors;
  }
  text.setText(textToSet);

SCRIPTEND
EVENTEND

Demo presentation

Demo presentation contains examples of how to use this module.