Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Help Using the New getSheetItem()

March 12 (2 weeks ago)

Edited March 20 (1 week ago)

a script I've written that I'm using to test the new getSheetItem() keeps returning stale data until I restart the API, I have updated the hp in the character sheet but the log does not show this change. I'm really no expert with this so forgive me if I've missed something simple. here is my script 


on("ready", () => {

    log("✅ HP (Polling) Loaded.");


    // The character ID in your game

    const charId = "-OKNny3T6BPI8gxuM6P7";


    // Poll every 5 seconds

    setInterval(async () => {

        try {

            const hpValue = await getSheetItem(charId, "hp");

            log(`HP: ${hpValue}`);

        } catch (err) {

            log(`Error fetching HP: ${err}`);

        }

    }, 5000);

});

here is the logging

"HP: 9"
"HP: 9"
Restarting sandbox by user request...
detected currently running sandbox... restarting
"HP: 9"
"✅ Minimal Beacon Example (Polling) Loaded."
"##########> Sandbox [EXPERIMENTAL 2025-03-11] : Ready fired after 5.54s, 24 objects."
"HP: 14"
"HP: 14"
March 18 (2 weeks ago)
Nicole B.
Roll20 Team

I'm seeing this too and I'm going to see if I can figure out why this is happening. The ones we've updated have relied on a trigger to pull the new value, not a timer, so it's possible something unexpected is happening here.