I have one particular routine that is doing weird stuff and I have no idea why. It has a variable named vals that has some name/value combinations. I call setAttrs, and ONLY THE LAST VALUE gets set. I do the exact same thing in dozens of other routines, but this one has problems for some reason. The only two things I can think of that might be involved is : (1) It is a sheetworker that is being run on the roll20 servers. (2) Some of the names contain capital letters. Specifically There is an api that calls setWithWorders() to set a value which causes the Roll20 servers (instead of a users local machine) to run the sheetworker. The results of logs end up in the API console log instead of a users machines development tools console log. This is a very old sheet that was started years before Roll20 explicitly said to not use capitals in names. These two issues actually sometimes makes a difference. For example I know that if a variable name inside a repeating section has a capital, then the on change events will not trigger on the roll20 servers even though it will on a users machine. I don't know if ether or both of these issues are involved in this problem. It is just the only two things that might. Anyway, here is what happens. let vals={};
...
if(entry.movebased) vals[pre+"MoveBased"]=entry.movebased;
if(entry.visionbased) vals[pre+"VisionBased"]=entry.visionbased;
log(JSON.stringify( vals ));
setAttrs(vals);
If this code is triggered manually on a user machine, it works fine. But when triggered via a setWithWorkers call, then only the very last one (VisionBased) will be set. None of the others will be. The log files on the values about to be written seem normal. "{\"repeating_talents_-Mlze- jRxrnMDqIJS1Bu_T_Mod-Type\":\" Action\",\"repeating_talents_- Mlze-jRxrnMDqIJS1Bu_T_Target\" :\"MD1: @{target|Target|token_id}\", \"repeating_talents_-Mlze- jRxrnMDqIJS1Bu_T_Defensive\":\ "1\",\"repeating_talents_- Mlze-jRxrnMDqIJS1Bu_T_ Resistance\":\"0\", \"repeating_talents_-Mlze- jRxrnMDqIJS1Bu_T_MoveBased\":\ "1\",\"repeating_talents_- Mlze-jRxrnMDqIJS1Bu_T_ VisionBased\":\"1\"}" Note that both VisionBased and MoveBased look identical and both should have values of 1. If I run an Inspect special function I wrote I get... (From Inspect to player ): name: repeating_talents_-Mlze- jRxrnMDqIJS1Bu_T_MoveBased current: _id: -Mlze0kthkh7mLFOuwrw (From Inspect to player ): name: repeating_talents_-Mlze- jRxrnMDqIJS1Bu_T_VisionBased current: 1 _id: -Mlze0kuKCL4h_vnHrzW note that VisionBased has a current value of 1, but MoveBased has a current value of blank or undefined. To the best of my knowledge all other routines and setAttrs are working fine. As a workaround, I rewrote the routine to instead of collecting 6 values in vals and then calling setAttrs once, I instead put one value at a time into vals and call setAttrs 6 times, and that works. But it still seems like something is very wrong here.