Ability to update cache values

Fyro 1 year ago 0

I would like the ability to have a value updated in a cache variable during a chain delay. I have mini games I want to make that can be run through 1 executed command. However, the delay/chain combo brings limitations. 

When a cache variable is created it remains that way and will not update if any changes happen during a delay. I would like a dynamic type of cache variable where if something changes during a delay, it will reflect it. For example:

I have two commands: !raffle and !join

!raffle contains the following:

Begins Raffle! $[cache raffle 10 1]

$[chain] $[delay 10]

Winner is ... who...? $(cache raffleList)


!join contains the following:

$(js (function() {

if(`$(cache raffle)` == ``){
return `There is currently no raffle.`;

var l = [ ];
if(`$(cache raffleList)` != ``){
l = JSON.parse(`$(cache raffleList)`);


for(var i = 0; i < l.length; i++ ){
if(l[i] == `$(username)`){
return `$(username), you're already in the Current Raffle!`;

l = JSON.stringify(l);
return `$[cache raffleList 12 ${l}]$(username), you're added to the Current Raffle! ${l} `;



Because $(cache raffleList) is empty in the beginning in !raffle command, it will not update at the end of the chain/delay, doesn't matter how many type !join. I would like to have this ability.