# Conducttr Engine Smartwords

{% hint style="info" %}
You can achieve a lot with Conducttr engine smartwords and functions but it's usually for pro-users and often those using Colibri where you can add calculations.
{% endhint %}

While the {} *smartwords* make life easier for commonly-used data, there's a lot more you can do by directly accessing the *Conducttr Engine*.\
\
These smartwords use the || delimiters instead of {}.  Please note that you can't use the two together.\
\
The rest of this article might get a bit complicated for some but even if you don't understand it completely, you might still be able to use the recipes.&#x20;

## Audience Responses

To capture the player's response to the last question, you can use:\
\
`|audience.response|`\
\
Note that this only survives the immediate use after the question. If you want to store the response, you'll need to save it in a variable using a *calculation*.&#x20;

## Arrays

Arrays are like tables with two columns: the left column is the index and the right column is the data. You use the index to access to data.

{% hint style="info" %}
**Symbols**

\[ ]  denotes an **array**

( ) denotes a **function**

\| | denotes a **smartword**

{ } a short form for some smartwords

**Indexes**

Most indexes are in quotes " " because we want Conducttr to use that actually text. Without the quotes Conducttr will try to find a variable of that name.
{% endhint %}

The exercise smartwords table is actually an array that internally is called the "custom\_data" array.\
\
If you're writing content to use the *custom\_data* array, writing something like `{data.stadium}` is the easiest approach but you could also write `|partition.custom_data["stadium"]|` - they both mean the same.\
\
Conducttr maintains the following arrays:

<table><thead><tr><th width="238">Array</th><th>Description</th></tr></thead><tbody><tr><td> custom_data<br></td><td>Holds the data you've added to personalise this scenario.<br></td></tr><tr><td> audience.responses<br></td><td>Holds all the question answers for a the current player.<br>The index is in the format <em>campaign code</em>.<em>card number</em> <br><br>The campaign code can be configured by going to Setup>Essential configuration>Campaign code<br><br>Assuming a campaign code of "panda", then to get the player's response to the question asked on card 56, the smartword would be  <code>|audience.responses["panda.56"]|</code><br></td></tr><tr><td> partition.decisions<br></td><td><p>Holds a count of players clicking on a <em>data point</em> (see the article on <em>data points</em> to understand what these are).<br><br>This is also indexed using the campaign code but it has two types of index:</p><ul><li><em>campaign_code.card_number</em></li><li><em>campaign_code.card_number.choice</em><br></li></ul><p>As an example, if the <em>campaign code</em> is "mr" and the <em>card number</em> is 3 and you want to know how many players have click the first <em>choice,</em> the <em>smartword</em> would be <br><br><code>|partition.decisions["mr.3.1"]|</code><br><br>If you wanted to print this as a percentage you could write <br><code>|partition.decisions["mr.3.1"]|</code> other person(s) took this decision which is <code>|INT((partition.decisions["mr.3.1"]/partition.decisions["mr.3"])*100)|%</code> of the total<br></p></td></tr><tr><td> partition.variables<br></td><td><p>Holds the values of all the <em>variables</em> you've created in <em>calculations</em>.<br><br>To access a partition variable you're usually better off to use the {} notation but if you have to use || then this is how it looks...<br><br>the array holds three types of variable: audience, team and session. And these are identified in the index by a suffix - a. for audience, t. for team and s. for session.<br><br>To access the value of the variable, use<br><code>|partition.variables[CONCAT("{entity suffix}.",{entity it},".{variable name}")]|</code><br><br>The entity id for each entity is:</p><ul><li>audience.hash</li><li>audience.participant_team_id</li><li>audience.session_id<br></li></ul><p>So, putting this altogether, to access the audience attribute "my_score" the formula is <code>|partition.variables[CONCAT("a.",audience.hash,".my_score")]|</code> <br><br>To access the team attribute "team_decision" the formula is <br><code>|partition.variables[CONCAT("a.", audience.participant_team_id,".team_decision")]|</code><br></p></td></tr><tr><td>partition.the_chart_index<br></td><td>Holds the button text for any <em>data point</em> you create. The array is indexed by <em>campaign_code.card_number.button_number</em> <br>In the image below, of he campaign code is "defsc" then<br><code>|partition.the_chart_index["defsc.3.1"]|</code> = "stay INSIDE"</td></tr></tbody></table>

## Nested Smartwords

{% hint style="info" %}
Note that this is an advanced feature and not for the fainthearted ;)
{% endhint %}

Nested smartwords allows authors to create more dynamic experiences by using variables to access the data in other variables.\
\
**Example**\
Let's say you ask the player to choose a song and store the answer in a player variable called "music".\
Normally to access this variable we would use {music}.\
\
To nest the smartword you need to use the || notation. Hence the player variable "music" will become `|partition.variables[CONCAT("a.",audience.hash,".music")]|`\
\
But lets say we want to use the the value in "music" to access some data in the custom data table. To do this we will use this expression:

`|partition.custom_data[partition.variables[CONCAT("a.",audience.hash,".music")]]|`
