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] [WIP] Virtual Bard

1482278690

Edited 1484104707
We play a pretty loose D&D game. Our DM doesn't do too much setting up (because that takes ages) and when we encounter new people, it is up to us to write it all down. This is mainly because we switch between online sessions and in person ones. Even on paper, keeping track of who we have met is hard work, and with the tedious hit edit -&gt; make change -&gt; save change pattern of handouts and character bios, it is even slower. For the basic details, this should be simple, so that's what my script / framework is trying to achieve. The virtual bard tries to take this on by accepting simple commands and doing a lot of the tedious and messy work to keep track of your adventure. For example, in chat you give the command: !c -met Hairy ToeWinkles -r Halfling -c Thief -s male it then does the following: - Creates a new character sheet for Hairy ToeWinkles - Sets Race to Halfling - Sets Class to Rogue (uses its own lookup so classes can be abbreviated) - Sets Sex to Male - Writes in the "Adventure Log" handout (creates if not exists): "The party met [Hairy ToeWinkles], a Male Halfling Thief" This is only a starting point and proof-of-concept. As i work on it, it will handle the following: - Location tracking. Commands that will keep track of where the party is / what stage of the campaign you are at. This will then decorate other commands automatically, so if you have told the Virtual Bard you are on your fifth day in Baldurs gate, it will change it to "While on the 5th day in Baldurs Gate, the party met [Hairy ToeWinkles], a Male Halfling Thief". - Character commands. It maintains context on who you are talking about. You can then add more information such as "!c -i Is the Harper contact -i Masquerading as a Barkeep" and it will add two records into that characters bio. - Per user contexts. It remembers contextual information while running. If you started talking about a character you just met, you can keep talking about them and adding information with subsequent commands until you change it with a "!c -who" or "!c -met" command. Other players can also run their own commands and the context will not overlap. Two people can log information about different or same characters at the same time. My script thus far can be accessed at&nbsp; <a href="https://github.com/finite8/roll20-api-scripts/tree" rel="nofollow">https://github.com/finite8/roll20-api-scripts/tree</a>... (edit: new separate repo from Roll20 API fork so i can write independently. Will merge it in properly as its own seperate versions when ready:&nbsp; <a href="https://github.com/finite8/VirtualBard" rel="nofollow">https://github.com/finite8/VirtualBard</a> ) I have forked the main repo and will keep it there until i am satisfied that a v1 is stable and ready to go. &nbsp; Opinions and input is welcome.
This is brilliant!! Can't wait to give it a try. -Phnord, the hates-to-take-notes GM
1482331002
Goat Games
Marketplace Creator
Can we use it with no character sheet selected? It would be a valuable tool for my Sci-Fi horror game, we keep meeting new people all the time.
1482333171

Edited 1482333219
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Programming wise, I might suggest changing your split character to "--" instead of "-" because at least some entity IDs start with a "-". Don't know if you're going to use IDs for any commands, but something to keep in mind. Also, nice addition to the repository once it goes live.
1482355702

Edited 1482356006
Snek Lord said: Can we use it with no character sheet selected? It would be a valuable tool for my Sci-Fi horror game, we keep meeting new people all the time. The selection is only in its own context, not actually clicking a character sheet. What you should be able to do with it in its current form is this: - Player 1 enters the command !c -met Billy Bob. A new character sheet is created and Player 1's context is set to Billy Bob. - Player 2 enters the command !c -met Hillbilly Dilly.&nbsp;A new character sheet is created and Player 2's context is set to Hillbilly Dilly. - Player 1 enters the command !c -r Human. The character sheet for "Billy Bob" is updated with race "Human". - Player 2 enters the command !c -c wiz. The character sheet for "Hillbilly Dilly" is updated with class "Wizard". - Player 1 enters the command !c -met Hillbilly Dilly. They are informed the party has already met "Hillbilly Dilly" and their context is set to "Hillbilly Dilly" This should make it pretty fluid. I also need to take into account that some DMs will be more diligent and create NPC sheets ahead of time. I am going to add some custom attributes so that the -met command will work in that case too and doesn't report that the party has already met them when they havent.
1482355857

Edited 1482356081
Scott C. said: Programming wise, I might suggest changing your split character to "--" instead of "-" because at least some entity IDs start with a "-". Don't know if you're going to use IDs for any commands, but something to keep in mind. Also, nice addition to the repository once it goes live. Thanks! Hopefully over the Christmas break i can get a v1 stable and released. I'll think about it. I worry that double things like that make it a little bit tedious. I'm hoping i can avoid those kind of issues as players referring to complex ids should be avoidable. I'm aiming to keep it as close to simple English as possible. Alternatively, i could use slashes?
1482507146

Edited 1482507293
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
That could work as well. I'm not a great javascripter, but why not use something like: parts = msg.content.split(' --'); switch(parts[1]){ case r: ... default: } in your parseMessage function?
Finite8 said: Snek Lord said: Can we use it with no character sheet selected? It would be a valuable tool for my Sci-Fi horror game, we keep meeting new people all the time. The selection is only in its own context, not actually clicking a character sheet. What you should be able to do with it in its current form is this: - Player 1 enters the command !c -met Billy Bob. A new character sheet is created and Player 1's context is set to Billy Bob. - Player 2 enters the command !c -met Hillbilly Dilly.&nbsp;A new character sheet is created and Player 2's context is set to Hillbilly Dilly. - Player 1 enters the command !c -r Human. The character sheet for "Billy Bob" is updated with race "Human". - Player 2 enters the command !c -c wiz. The character sheet for "Hillbilly Dilly" is updated with class "Wizard". - Player 1 enters the command !c -met Hillbilly Dilly. They are informed the party has already met "Hillbilly Dilly" and their context is set to "Hillbilly Dilly" This should make it pretty fluid. I also need to take into account that some DMs will be more diligent and create NPC sheets ahead of time. I am going to add some custom attributes so that the -met command will work in that case too and doesn't report that the party has already met them when they havent. How would you handle players spelling a name differently? Like, player 1 spells "Hillbilly Dilly", player 2 spells "Hillbilly Dily", player 3 "HillBilly Dilly", etc. This looks really cool but I would not want for the script to create a character sheet automatically. Could that be an option? I either create sheets or handouts of NPCs ahead of time. But an option to create one on the fly for a random encounter. That sort of thing. But I really like the create or append to an Adventure Log , especially with day tracking. Currently, I use a spreadsheet which is outside the VTT. What about hour tracking? Example, at 11PM took long rest. This might be edge case, though. I do long for a day/hour tracking script - especially if it can build an adventure log. I suppose it could also handle information regarding treasure handed out, or experience?
1482551472
Garrett K.
Marketplace Creator
It seems like this could easily be turned into an NPC generator through using the random tables... Can every attribute be defined this way ala ChatSetAttribute? IE: Level, Class, Base Attack, etc? Calculations for BAB and saves can be defined with math for each class, with the resulting calculations placed in the corresponding attributes.. My imagination sees one click level 7 fighters being really easily spawned..
Scott C. said: That could work as well. I'm not a great javascripter, but why not use something like: parts = msg.content.split(' --'); switch(parts[1]){ case r: ... default: } in your parseMessage function? yeah, not to stressed about that. Will make the command prefix configurable when im done.
Doug E. said: Finite8 said: Snek Lord said: Can we use it with no character sheet selected? It would be a valuable tool for my Sci-Fi horror game, we keep meeting new people all the time. The selection is only in its own context, not actually clicking a character sheet. What you should be able to do with it in its current form is this: - Player 1 enters the command !c -met Billy Bob. A new character sheet is created and Player 1's context is set to Billy Bob. - Player 2 enters the command !c -met Hillbilly Dilly.&nbsp;A new character sheet is created and Player 2's context is set to Hillbilly Dilly. - Player 1 enters the command !c -r Human. The character sheet for "Billy Bob" is updated with race "Human". - Player 2 enters the command !c -c wiz. The character sheet for "Hillbilly Dilly" is updated with class "Wizard". - Player 1 enters the command !c -met Hillbilly Dilly. They are informed the party has already met "Hillbilly Dilly" and their context is set to "Hillbilly Dilly" This should make it pretty fluid. I also need to take into account that some DMs will be more diligent and create NPC sheets ahead of time. I am going to add some custom attributes so that the -met command will work in that case too and doesn't report that the party has already met them when they havent. How would you handle players spelling a name differently? Like, player 1 spells "Hillbilly Dilly", player 2 spells "Hillbilly Dily", player 3 "HillBilly Dilly", etc. This looks really cool but I would not want for the script to create a character sheet automatically. Could that be an option? I either create sheets or handouts of NPCs ahead of time. But an option to create one on the fly for a random encounter. That sort of thing. But I really like the create or append to an Adventure Log , especially with day tracking. Currently, I use a spreadsheet which is outside the VTT. What about hour tracking? Example, at 11PM took long rest. This might be edge case, though. I do long for a day/hour tracking script - especially if it can build an adventure log. I suppose it could also handle information regarding treasure handed out, or experience? yeah, spelling could be an issue and i don't see a great way to work around that. The only saviour is a difference between the "met" and "who" command. The "met" command adds a new entry for the character and switches context, whereas the "who" command just switches context and if the character doesn't exist, it returns an error. Could add a bit more context to that to allow a partial match or lookup. I also intent to do a bit of command button magic. I had a quick play around with the API and discovered that you can put links into handouts that invoke API commands. I can easily blend this into the character sheet bios or whatever it generates for the characters to add some buttons like "Set Context" that you can just click on to switch to that character to make things a bit easier. I was also thinking of some kind of inventory management component, but i think that is a separate behemoth to deal with later.
Garrett K. said: It seems like this could easily be turned into an NPC generator through using the random tables... Can every attribute be defined this way ala ChatSetAttribute? IE: Level, Class, Base Attack, etc? Calculations for BAB and saves can be defined with math for each class, with the resulting calculations placed in the corresponding attributes.. My imagination sees one click level 7 fighters being really easily spawned.. Absolutely could, and that was part of my plan. I really like the auto generator more though, with either working from a table, or simulate proper character creation rolls with weightings based on class.&nbsp;
Progress Update: Been doing a ton of work on it (more than i should really). I've re-written most of it in typescript which required minor refactoring but has now allowed for WAY more complex design without being hampered by javascript. Things that i have working so far: - Configuration support. The config needs are too complex for me to figure out how to take advantage of the Roll20 API config bit (mainly because i also cant see how i can test it without having a script in the API repo), so instead config is stored in a handout. Requires a bit of JSON manipulation, but there is pretty impressive capability there. - Calendar support. Have implemented a basic calendar that has been defaulted to D&D parameters. It can't do the complex things that real calendars do (variable days in months), but it does work great with a simple format of 10 days to a week, 3 weeks to a month and 12 months to a year. Those values are all configurable too! As your adventure progresses, you can progress in hours, days or time periods (i.e: From Noon it can progress to afternoon). It also can write it out in a really nice way. i.e:&nbsp;Evening 23rd of Flamerule 1000PR - Location Support. Can handle locations and sub locations. i.e: You can go to "Baldurs Gate" and then within there, you can go to a sub location "The Sewers". It keeps track of how long you have been at the locations too so it will be able to add to the adventure log the Current Adventure time, as well as the duration at the current location. As an internal housekeeping feature, i have used Typescripts declarations to allow me to place the commands on the classes and functions themselves. This means it no longer going to need some kind of huge switch statement or a painful setup style binding process. Typescript is doing the dirty work for me.
Out of curiosity what editor and transpiler are you using for your Typescript? I detest JavaScript and Typescript is a nice work-around for such an ugly language. I can't remember what I tried some time ago, but the R20 sandbox choked on the transpiled scripts so I gave up.
Ryan J. said: Out of curiosity what editor and transpiler are you using for your Typescript? I detest JavaScript and Typescript is a nice work-around for such an ugly language. I can't remember what I tried some time ago, but the R20 sandbox choked on the transpiled scripts so I gave up. Yeah. It only took me a few hours of working in Javascript to want to throw a hissy fit thus, i discovered and switched to typescript. Javascript is so ugly to work with, I treat it more like MSIL / byte-code than i do a programming language. I've been using VSCode as the IDE and am using the Typescript compiler in Node to do it. I think Roll20 is complying to ES5 as my tests so far with that have been successful. I also set up some test cases along with a really crappy test framework and a basic mock of some of the roll20 commands so i can have repeatable tests local (so at the very least, i can test and debug logic with Ctrl+Shift+T without having to copy and paste into roll20 everytime). Has allowed me to bash out a ton of workable code in not a lot of time. Go grab my project on Github, I've put some setup instructions as well as a setup.bat that SHOULD do all the config and installs for you.&nbsp; <a href="https://github.com/finite8/VirtualBard" rel="nofollow">https://github.com/finite8/VirtualBard</a> Note: I was a bit bored at one stage and set up the readme on Github with support info, but i haven't released it yet so ignore that bit :)