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

Saving a Variable in an API Script

1467906456
Kirsty
Pro
Sheet Author
I'm very new to javascript, so please forgive me if this is obvious but my Google-fu has failed me. I'm not looking for someone to code this for me (I need the practice), I just need pointing in the right direction. I've been working on a script to display a calendar in the chat window and so far it's working quite well. I have the current date set as a variable so I can progress the date forward. What I can't seem to be able to do, is save the date once it has been changed. Is the best way to do that to have a handout or token within the game that would be overwritten with the new variable each time the date is moved? Any advice/suggestion is welcome!
1467906911
The Aaron
Pro
API Scripter
In the general sense, it depends on what you want to do with the data, particularly what it is associated with. &nbsp;However, I think the best answer is usually the state object, see:&nbsp; <a href="https://wiki.roll20.net/API:Objects#state" rel="nofollow">https://wiki.roll20.net/API:Objects#state</a>
1467907097
Kirsty
Pro
Sheet Author
Aha! That's exactly what I was looking for. Thank you so much!