My users in App Script read their queue number from a Spreadsheet:
var array = sessionsSheets.getRange(row, 2, 1, 3).getValues()[0];
var questionNumber = array[2]; //This is the variable of interest, it is an integer signifying the queue
sessionsSheets.getRange(`D${row}`).setFormula(questionNumber+1); //This is the updated queue
They then update this queue number as seen above. This method works fine most of the time, but if you take two devices and run the script simultaneously, they both receive the same queue, and the script will halt for one of them because you need a unique queue number later on to use Slides API:
Slides.Presentations.batchUpdate({'requests': requests}, presentationId);
If promises worked, I would have simply put the Slides API line in a try block, and if an error of duplicity pops up, I would then call the same function recursively, up until overlap doesn't occur. However, promises are not supported in App Script, so what should I try instead?