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

[Script] ImperialCalendar -- Fully Featured Calendar for Traveller, Stars Without Number and other SciFi games. Public, Player and Private Notes, Calendar and Journal Formats.

1485020752
The Aaron
Pro
API Scripter
ImperialCalendar provides a fully featured calendar as used in Traveller, Stars without Number, and other scifi games. It supports notes (public, private, and player specific) and various display formats. Commands !cal [&lt;--help|--details|--sparse|--whisper|--set|--note|--remove-note|--show|--show-week|--show-4week|--show-5week|--show-year&gt;|&lt;parameter&gt; ...] !wcal -- An alias for !cal --whisper Date Format ImperialCalendar uses dates of the format &lt;day&gt;-&lt;year&gt; , such as 023-1116 . The leading 0 s are optional, so 001-0001 is the same as 1-1 . Anywhere you can use a date, you can also use a relative date by using a number prefixed by either + or - . These numbers will be used as a day offset from the current day. You can further suffice these numbers with one of d , w , y to specify days (default), weeks, or years. ( D , W , Y also work.) In most cases, the + is also optional. In fact, you can leave off the number and only specify a suffix. +7d is the same as 7d , +7 , d , D , +d , +D , +1w , etc. &nbsp;One other way to specify the date is as the number of days since the Epoch date of 000-0000 . &nbsp;A bare single number is considered to be the number of days since that date, with the exception of --show-year, which will treat it as the year to show. Display There are two display modes: Calendar and Journal . Calendar Shows you days on a grid. Hover on a day to see it's notes (days with notes have a green background). Click a day to see the journal for that day. Journal Shows you the notes for the day or days. Notes have a button allowing the owner to delete them. There are buttons by each day for adding notes of each permission type. Setting the Date --set|&lt;date&gt; (GM Only) -- Use --set to adjust the current day. The current day is what all relative days are calculated from and is highlighted yellow in the display. Anywhere you can omit the day in a command, the current day is used instead. If you specify an invalid day, the current day is used. Examples !cal --set|023-1116 -- set the date explicitly to the 23rd day of the year 1116. !cal --set|+1w -- set the date relatively by advancing the current date by a week. Show Commands --show[|&lt;date&gt;[|&lt;date&gt; ..]] -- use --show to show a day. --show-week[|&lt;date&gt;] -- Show the week (Monday-Sunday or the Holiday week) surrounding the provided date or the current date. --show-4week[|&lt;date&gt;] -- As above, but shows also 1 week prior and 2 weeks hence from the date. --show-5week[|&lt;date&gt;] -- As above, but shows 2 weeks prior and 2 weeks hence. --show-year[|&lt;date&gt;] -- Shows the full year including the date. Note: This is the only command that will treat a bare number as a year. !cal --show-year|1116 is equivalent to !cal --show-year|001-1116 . --between|&lt;date&gt;|&lt;date&gt; -- Shows all the days between the two dates. Relative dates are still relative to the current day. Modifiers --details -- Causes a list of days and notes to be shown, rather than a grid calendar. (This is the default for --show ) --sparse -- Causes a detail view to omit any days without notes. Examples !cal --show -- show's the current date. !cal --show|+1d -- show's tomorrow. !cal --show|-1w -- show's a week ago. !cal --show|1-1116|10-1116|16-1116 -- show's the 1st, 10th, and 16th days of the year 1116. !cal --show-week -- show's the current week. !cal --show-week|+w -- show's next week. !cal --show-year -- show's the current year. !cal --between|023-1116|043-1116 -- shows all the days from the 23rd to the 43rd of the year 1116. !cal --between|023-1116|043-1116 --details --sparse -- Shows the days with notes from the 23rd to the 43rd of the year 1116. Whisper Examples !wcal --show -- Whisper the current day. Whispering is the only time that notes other than public notes are displayed. !cal --show --whisper -- Identical to the above. Note commands --note[|day][[|who] ...]|&lt;note text&gt; -- adds a note. If you omit the day, it is added for the current day. You can specify who can see a note. Use gm or private for a gm only note (also the default, you can just leave it off), all for a public note, or some part of a player's name to restrict it to just the matching players. You can specify multiple | separated players. --remove-note[|day]|&lt;all|index&gt; -- removes a note. If you omit the date, it removes from the current day. If you specify all , it will remove all the notes you created on that day (or all notes if you are the gm). If you specify a number, it will remove that index from the specified day (counting from the beginning, starting at 0). Examples !cal --note|all|Hi everyone -- adds a note on the current day for all players. !cal --note|Secret note. -- adds a note for just the GM. !cal --note|tom|Tom's note. -- adds a note for all players with tom in there name (ignoring spaces and capitalization). !cal --note|sally|tom|bob|Small group note. -- adds a note for 3 or more players. !cal --note|10-1116|Bomb goes off. -- adds a GM note on the 10th of the year 1116. !cal --note|10-1116|all|A good day to be off planet. -- adds a note for all players on the 10th of the year 1116. !cal --remove-note|0 -- removes the first note on the current day. !cal --remove-note|all -- removes all the notes on the current day. Settings The settings are accessible via the help screen using !cal --help . Tool Tips You can toggle the tool tips on the buttons in the --details display. Once you know what the buttons do, the tool tips are a bit annoying. Click the toggle button to adjust them. Day Names Click the name button to change the name. On to the examples with screenshots! Journal View Show the current day. &nbsp;This will be seen by everyone and will only have the public notes visible. &nbsp;The current day is always shown with Yellow. !cal Show the current day with a whisper. &nbsp;This will be seen only by the person executing the command and will show all the notes they can see (both of the following commands are the same): !cal --whisper !wcal Player View -- Shows public notes, notes for the player (Tester Aaron), and notes created by the player (the GM note at the bottom): GM View -- Shows all notes on the day: Buttons -- There are 4 buttons currently that show up: All buttons are accessible to everyone, but you can only delete a note if you created it, or you are the GM. All buttons have tooltips that tell you what they do: When you get tired of seeing that, you can turn it off in the settings: !cal --help Showing other days can be done by appending a date (specific or relative). &nbsp;These commands all show tomorrow (Current day is 001-1116): !cal --show|002-1116 !cal --show|2-1116 !cal --show|+1d !cal --show|+1D !cal --show|+d !cal --show|d You can show multiple days with one of the --show or the --between commands. &nbsp; --show will let you specify multiple non-contiguous days. &nbsp;This command shows you the current day (001-1116, the Holiday of the year) and this day in the next 3 years: !cal --show|0d|+y|+2y|+3y You can further pair this down with the --sparse option, which will only show the days that have notes: !cal --show|0d|+y|+2y|+3y --sparse Which is great especially if you're showing hidden notes with --whisper or !wcal : !cal --show|0d|+y|+2y|+3y --sparse --whisper Calendar View Show the current year: !cal --show-year The Calendar View shows they days in their weeks. Each year gets a year header, regardless of where in the year the display starts. &nbsp;The current day is bordered in Yellow and any day that has notes shows with a green background. &nbsp;When not whispering, only days with public notes have a background. &nbsp;When whispered, the days with notes you can see are colored. Since Imperial Calendar has no months, there are a few short forms that might be useful: --show-week, --show-4week, --show-5week &nbsp;Here is showing a week 3 weeks in the future: !wcal --show-week|+3w Using --show-4week gives you a view of the current week, the week before, and two weeks forward. &nbsp;It's kind of a "month" view: Note that the Holiday is considered its own week. The Calendar View is reactive by weeks, so you can stretch it to the presentation that makes sense to you just by adjusting the chat panel width. Here is --show-5week pulled to have two weeks side by side: !wcal --show-5week You can use --between to give you a very precise set of days: !wcal --between|349-1115|38-1116 Adding --details to any of the Calendar Views will cause them to show Journal View Instead !wcal --between|0d|+20d --details If you just want the notes, --sparse is nice: !wcal --between|0d|+20d --details --sparse You can click any day in the Calendar View to be whispered the Journal View of it: !wcal --between|0d|+w Finally, in the Calendar View, you can hover over any date to see the notes that are on it: !wcal --between|0d|+w As with the Journal View, the list is restricted to only what can be publicly seen when not whispered, and what can be seen by the player that issued the command when whispered. Some words of caution Currently the script will happily display whatever you ask it to. &nbsp;I may need to add some checks for the size of a range displayed as you could accidentally display a thousand years of dates with the --between command, which would certainly cause some slowdown, and might cause the API to need a restart. Additionally, ImperialCalendar makes some pretty big messages. &nbsp;I've experimented with using the {noarchive:true} to keep them from going in the Chat Archive, but the current production version has some issues. (The dev version seems to be fixed, so an early update will be to add that as a toggle, and possible add an option to --save-to-chat a particular message if you want it in the archive!) Please let me know if you have any questions or feature requests! Github : <a href="https://github.com/shdwjk/Roll20API/blob/master/I" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/I</a>... Support my work on If you use my scripts, want to contribute, and have the spare bucks to do so , go right ahead. However, please don't feel like you must contribute just to use them! I'd much rather have happy Roll20 users armed with my scripts than people not using them out of some sense of shame. Use them and be happy, completely guilt-free! Disclaimer: This Patreon campaign is not affiliated with Roll20; as such, contributions are voluntary and Roll20 cannot provide support or refunds for contributions.
This is Freakin' awesome! I hereby advance you to Scriptomancer Deus! This is exactly what I need for my SWN game. Did you make or do you know of a script that allows import/export of rollable tables? I think I &nbsp;saw something about this some time ago.
1485040745
The Aaron
Pro
API Scripter
Thanks!! &nbsp;It was a fun script (learned some good tech!), but I'm glad I'm done with the first version! Yup! &nbsp;TableExport does import and export. I'll grab a link when I'm off my phone. :)
1485043096
The Aaron
Pro
API Scripter
TableExport:&nbsp; <a href="https://app.roll20.net/forum/post/1144568/script-t" rel="nofollow">https://app.roll20.net/forum/post/1144568/script-t</a>...
1485104867
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Amazing script! Wish I needed it just so that I could play with it. :)
1485105764
The Aaron
Pro
API Scripter
HAHAHAH, well, play with it. &nbsp;I'll probably be taking a good deal of the code in this and rewriting my Mystara Calendar to be a general purpose configurable calendar system. &nbsp;=D
1485114566
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ooh. That sounds good!
I must be missing something. How do you make the data persist? It resets when i close the page The date goes to the default &nbsp;and all notes are lost.
1485125902
The Aaron
Pro
API Scripter
Hmm. When you start up the API, do you get a message about updating the state right after the version header from ImperialCalender?
1485126130

Edited 1485126230
"ImperialCalendar: Message size: 2.79kb" Restarting sandbox due to script changes... Previous shutdown complete, starting up... Spinning up new sandbox... "Script loaded: Music Control for Tokens" "-=&gt; NoteLog v0.1.2 &lt;=- [Sun Oct 16 2016 18:21:23 GMT+0000 (UTC)]" " &gt; Updating Schema to v0.1 &lt;" "-=&gt; ImperialCalendar v0.1.0 &lt;=- [Sat Jan 21 2017 16:48:12 GMT+0000 (UTC)]" " &gt; Updating Schema to v0.2 &lt;" Resetting the API also erased all of the notes and reset the date
1485128521
The Aaron
Pro
API Scripter
This smells like your state is not being stored. &nbsp;If you want to PM me an invite to your game, I can take a look, or I can give you a script to try and calculate this. log(`State approximate size (startup): ${(JSON.stringify(state).length/1024).toFixed(3)}kb`); on('ready',function(){ _.delay(()=&gt;{ log(`State approximate size (ready): ${(JSON.stringify(state).length/1024).toFixed(3)}kb`); },100); });
Holy shit you've gone and blown my mind Aaron
1485129964
The Aaron
Pro
API Scripter
heheeh. Thanks! &nbsp;Now if I can just get it working for the one person I know of using it... =D
1485141679
The Aaron
Pro
API Scripter
Fixed! &nbsp;Weird state bug. &nbsp;The state wouldn't update at all. &nbsp;Clearing the state fixed it.
I will get home in a couple of hours, entering notes then. Thanks again The Aaron, our new Overlord of scripts.
Great script! &nbsp;I have a question though, I can change the Holiday name but not any of the other names of the week. Can you not change the names of the week?
1485195669
The Aaron
Pro
API Scripter
You should be able to change them all from the config? &nbsp;Are you clicking the buttons in the help and it isn't persisting the change? !cal --help
The Aaron said: HAHAHAH, well, play with it. &nbsp;I'll probably be taking a good deal of the code in this and rewriting my Mystara Calendar to be a general purpose configurable calendar system. &nbsp;=D Huzzah!
Man I want to format this to my 5E game. The lack of months is grrr arghhh though.
1485263845
The Aaron
Pro
API Scripter
Yeah. What calendar are you using? Faerun?
I think we're going to have to petition the Devs to increase the size of the State. &nbsp;Aaron seems to have committed himself to insuring that he writes enough awesome scripts all by himself to fill it. Very nice script, btw.
1485276167
The Aaron
Pro
API Scripter
Hahahah! &nbsp;" 2megs ought to be enough for anybody... " al e.'s state problem had nothing to do with size, it had very little in it. &nbsp;The state was corrupted somehow, and I ended up needing to destroy the state object and recreate it. For context, my API Testing! campaign where I have all of my scripts only has a state of approximately 11.188kb. &nbsp;=D
How do you check the size of the state?
1485360578
The Aaron
Pro
API Scripter
We don't really know the precise encoding used, but this is a reasonable approximation: log(`State approximate size (startup): ${(JSON.stringify(state).length/1024).toFixed(3)}kb`); on('ready',function(){ &nbsp; _.delay(()=&gt;{ &nbsp; &nbsp; log(`State approximate size (ready): ${(JSON.stringify(state).length/1024).toFixed(3)}kb`); &nbsp; },100); }); This will print the size of the state encoded as a JSON object at startup and right after ready. JSON encoded is likely the worst case size of state, so should be an upper bound.
1485374281
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Heh, I filled up the state with a single script when Aaron and I were testing some new Recursive Table features. Soooo many tables :).
1485374335
The Aaron
Pro
API Scripter
( gentle reminder from Scott that I need to do something... =D&nbsp;
Thanks for the snippet on checking the size of the state! I'm currently at 58.599kb. &nbsp;So yeah, I guess you have a lot more work to do than I thought! &nbsp;:)
1485380042
The Aaron
Pro
API Scripter
Hahahaha, yeah, I try to be conservative in my use of shared resources.. =D
I would love to see this adapted to the Greyhawk calendar for my own use, but I've passed this on to my SWN GM in case he wants to use it. :D
1485382193
The Aaron
Pro
API Scripter
Ah, see my latest post on patreon where I discuss the upcoming project to adapt this to more general settings: &nbsp; <a href="https://www.patreon.com/posts/incantations-of-7868" rel="nofollow">https://www.patreon.com/posts/incantations-of-7868</a>...
Looking at that post made me excited for the future. And I just realized that you're the author of a number of other scripts that I use so thank you for all the work!
1485389106
The Aaron
Pro
API Scripter
I do have a few released scripts... (so many, I had to write a release management system, which is moving into it's 3rd version...) And you're welcome! &nbsp;I enjoy doing it. =D