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 Request/Question] Tracking separate calendars for multiple players

Hi everyone,

Due to the bane of all gamers - scheduling - my players and I are doing more one-on-one sessions with occassional meetups.  Unfortunately, the calendar app I use - Quest Tracker - only lets me track one calendar for the gameroom.  I need to be able to track the day/weather/date/etc separately for each character.  I can install another mod (and have), but there aren't enough to do what I need.

Does anyone have a suggestion that can help?  My ideal would be if I could have a copy of Quest Tracker for each character, with a different command to pull each up.  Is there any chance of doing that?

April 28 (3 months ago)
timmaugh
Forum Champion
API Scripter

Ultimately, yes... you *could* install more copies of Quest Tracker... but you'd have to:

  1. copy the code
  2. change the script handle
  3. confirm whether the script outputs any messages that call itself (to change the handle, there, too)
  4. paste the new code into a new tab in your script deck with a different name

But before you go that far... what is the goal? It sounds like you need to know how-far-along any given character might have progressed along the game calendar (so that you can keep people roughly in sync)... so you'll be storing a day/date for each character, as well as when major occurrences take place (i.e., "the King was killed on this day...").

You mentioned weather... does that mean you need to store the weather on a given day so that you can repeat those weather conditions when you engage with the next player/character and they progress to that day, too?

If you're tracking weather, are you going to have to track regionality? Or will all of the players be in the same general vicinity so you'd expect them to face the same weather?

Well, I wasn't going to go as far as tracking the weather to replicate it - more that I wanted to be able to use Quest-Tracker's weather generator which bases weather on region and time of year.   It's a Fallout game, and at least to begin with each PC will be in a different region.  One in North Carloina, one in Wyoming, and one in Colorado.  The date is particularly important for the Colorado and Wyoming player characters.

Right now I have a different calendar API for one of them, and Quest Tracker for the other, but I need a third - and possibly a fourth if one of our other friends finds time to play.

April 29 (2 months ago)

Edited April 29 (2 months ago)
timmaugh
Forum Champion
API Scripter

I had a peek at the script. There's just too much there for a quick gloss to try to implement a different calendar for different people, but the author updated it only 2 months ago, so you might reach out to them directly to make your request.

For now, I could see a workaround.

First, in terms of setup, give each of your characters a new attribute to represent their date. Call it "QuestTracker" (no quotation marks, though). Also, create a similar field on a mule character. I'll call that mule character "QuestMule", but you can name it whatever you need to. These attributes don't necessarily need to start in synch... especially if you were going to start one character out in a "2 weeks ago" type of vignette, but in general I would think that the adventure begins with some inciting incident that the characters are reacting to in their own ways. The point is to make sure the values in these fields are intentional, and reflect the way QuestTracker outputs the date (matching whatever calendar you're using).

Next, install this scriptlet in your game:

/* */
var API_Meta = API_Meta || {};
API_Meta.DateReport = { offset: Number.MAX_SAFE_INTEGER, lineCount: -1 };
{ try { throw new Error(''); } catch (e) { API_Meta.DateReport.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (4)); } }
on("ready", function()
{
    const getDateReport = () => {
        let muleName = 'QuestMule';
        let attrName = 'QuestTracker';
        let chars = findObjs({type: 'character'})
            .map(c => {
                return {
                    name: c.get('name'),
                    qdate: (findObjs({type: 'attribute', characterid: c.id, name: attrName})[0] || {get: () => ''}).get('current')
                }
            })
            .filter(c => c.qdate && c.qdate.length)
            .sort((a,b) => a.name < b.name ? -1 : 1);
        let calendarMule = chars.filter(c => c.name === muleName)[0];
        chars = chars.filter(c => c.name !== muleName);
        if(!calendarMule || !chars.length) { return; }
        let msg = chars.reduce((m,v) => {
            m+=`{{${v.name}=${v.qdate}}}`;
            return m;
        }, `/w gm &{template:default} {{name=Date Report}} {{Game Date=${calendarMule.qdate}}}`);
        
        sendChat('DateReport', msg, null, {noarchive: true});
    };
    
    on("chat:message", function(msg) {
        if (msg.type=="api" && /^!questdates/i.test(msg.content)) { getDateReport(); }
    });
    getDateReport();
});
{ try { throw new Error(''); } catch (e) { API_Meta.DateReport.lineCount = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - API_Meta.DateReport.offset); } }
/* */

(If you use a different name for your mule other than "QuestMule", change it on line 8. If you use a different attribute name other than "QuestTracker", change it on line 9.)

When you reboot your sandbox (after installing that script, or when  you start a new game session), you should see a message in the chat output alerting you to the local dates for each of your characters who have such an attribute:


If you want to see this report at any time during your game, just enter the below command in chat (or save this to a macro and assign it to a button):

!questdates

Now you know where everyone is in your game.

Next, for any given game session, you'll want to use the Adjust Date menu of QuestTracker to adjust the game date to match the date of the person/party with whom you are playing. During the session, use QuestTracker however you normally would to advance the day or generate weather.

At the end of your game session, compare the date reflected in QuestTracker with what you have stored in your mule the player characters who were active in that session. Update your PCs with the new current date as currently reflected in the QuestTracker interface (see below for using ChatSetAttr for this), and update your QuestMule date to whatever current date system you're using (if it were me, I would only change it if the date for this session and for these players had advanced beyond the date that was being tracked in the mule; that is, if the mule shows a date of May 1 and the characters in this session started on April 10 and adventured until their date was April 18, I would not update the mule... I would update the mule only if the characters had adventured past May 1, so that the mule date -- ie, the overall campaign date -- reflected the latest date any player in the campaign had reached).

The next time you play (with different players), update your QuestTracker date to the character dates, and do it all over again.

Using ChatSetAttr

You can use ChatSetAttr (and a button) to update the attributes. Put the following command in a macro:

!setattr --sel ?{Update campaign date?|No, |Yes, --name QuestMule} --QuestTracker|?{Date}
That will prompt you to choose whether to update the campaign date (your QuestMule date), as well as what date to use.

Thank you so much!  I'll try this out on Thursday after work.

April 29 (2 months ago)
timmaugh
Forum Champion
API Scripter

I fixed an error, above, just in how I referred to the attribute you have to create for every character.

Also, I should have mentioned that for the ChatSetAttr command, you'll need to select the tokens for the characters you wish to update. Those selected tokens will be updated, as will the QuestMule, if you choose "Yes" from the query.