Name
Smartwords
Benefit
Allows more dynamic content and exercises by accessing data variables that may change with player decisions
Key Features
Basic use using {} delimiters
Advanced use using full range of Conducttr functions using the || delimiters.


Use curly brackets

All variables can be used within curly brackets {}. 
Player variables don't need a prefix;  so for example  {name} means the player's name (usually available if you've captured it with the GetName question type). Or {score} means the player's score if you have a variable called "score".

If you need to use team or session variables, use the prefix "team." or "session." respectively. Hence {team.score}  refers to the team score.
You can also access information in the custom data table by using the prefix data.


NOTE: the use of curly brackets is limited to published content. You can't use them in formulas (for this you'll need the pipes ||)


Advanced users only

If you're familiar with Conducttr or want to go beyond the basics, use pipes (that's these | | )  to identify variables.

Audience Responses

The last response to any question can be obtained using |this_response|

You can grab the answer to any specific response using the array  audience.responses[] 

The index to the array is campaign code.content id   
e.g demo.56 where demo = campaign code and 56 is number of the content (ie stage56)

Hence, if the player clicked the second answer to content 56 and the campaign code is "demo" then 
audience.responses[demo.56] = 2


Aggregate Responses

For content items where you've added a data point, the choices players make are aggregated in an array called partition.decisions[]
This array is indexed by the answer_id and the question_id - this means you can see how many people took a certain decision (answer_id) and how many people answered this question (question_id).

Remember that the question id is {campaign code}.{content number} and the answer id is {campaign code}.{content number}.{choice}

For example, if the campaign code is "mr" and the content number is 3 and a player clicks the first choice then the answer_id is "mr.3.1" and the question_id is "mr.3"
Hence if you want to know how many people took this decision you can use 

|partition.decisions["mr.3.1"]| other person(s) took this decision which is |INT((partition.decisions["mr.3.1"]/partition.decisions["mr.3"])*100)|% of the total



Variables

Variables are stored in the array partition.variables[]

The three entities, audience, team and session are identified in the index by a suffix - a. for audience t. for team and s. for session.


To access the value of the variable, use |partition.variables[CONCAT("{entity suffix}.",{entity it},".{variable name}")]| 
The entity id for each entity is:
  • audience.hash
  • audience.participant_team_id
  • audience.session_id
For example, to access the audience attribute "my_score" the formula is |partition.variables[CONCAT("a.",audience.hash,".my_score")]| 
To access the team attribute team_decision the formula is |partition.variables[CONCAT("a.",audience.participant_team_id,".team_decision")]|
 
Always use the entity suffix and variable name in quotes as shown above.

Constants

The array partition.the_chart_index[]  holds the answer text for any data point you create. The array is indexed by answer_id.
See the example in the image below