Lataa Bot Libre Desktop, oma henkilökohtainen botti TIETOKONEELLEsi tai Macillesi

How can I save list of values in conversation object.

tekijä BM Lähetetty Jul 19 2018, 4:32

As of my understanding conversation is globally available in self script. Is there any other way of saving a variable and accessing it. How can we save a list of variables like an array in conversation object. I am doing the following but its not working;

function init() {

      var myArray = new Array();
     conversation.itemList = myArray;


function add_item() {
  var item = new Array();
  item[0] = 'first item';

 item[1] = 'second item' ;

conversation.itemList = item;


function show_items() {

  var items = conversation.itemList;

  return items.length(); // returns zero, There are no items in array?


by admin posted Jul 19 2018, 9:10
How are you calling these methods?

The "conversation" variable is an object specific to the current conversation. You can store any data on it and it will be persisted with the conversation and accessible for the duration of the conversation.

Make sure you are no calling init() after add_item() as that would reset the itemList attribute to an empty array.

You can also store data on the user object using the "speaker" variable, or globally on the bot symbol #self, or globally on any other symbol your choose using #symbolName.

Here is an example of a script that uses the conversation variable to store data.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1347, today: 0, week: 10, month: 22

Id: 22877023
Tunnisteet: self
Lähetetty: Jul 19 2018, 4:32
Vastaukset: 1
Näkymät: 1418, Tänään: 1, Viikolla: 8, Kuukausi: 21
0 0 0.0/5