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] NoteLog v0.1.2 -- Updated with inline roll expansion and multiline message adding!

October 16 (8 years ago)

Edited October 16 (8 years ago)
The Aaron
Pro
API Scripter

NoteLog v0.1.2

This is an update on a previous small script I created.  The update includes adding multiline text to the Log handout and expanding inline rolls.

Commands:

  • !note-log <text>
    • Creates the Log handout in the journal if it doesn't exist already
    • Adds the <text> to the end of the journal, prefaced with .
  • !note-text [{{] Some longer text [}}]
    • Creates the Log handout in the journal if it doesn't exist already
    • Adds the <text> to the end of the journal, preserving line breaks if you surrounded it in {{ }}.
If you rename the Log handout, a new one will be created the next time you run !note-log. That makes it easy to archive prior notes. Additionally, you can freely edit the Log document if you want to add in notes between log events.

Examples:
  • Write a line of text to the log, prefaced by a bullet character (•):
!note-log Went to save the queen from the castle, but found out she was really in another castle.
Write the same line without the bullet:
!note-text Went to save the queen from the castle, but found out she was really in another castle.
Write a line of text to the log with a calculation, prefaced by a bullet character (•):

!note-log Recovered [[1d6]] red gems worth 50gp each.
  • Write multiple lines to the file:
!note-text {{Today was a fine day for hunting.  All told, we found:
[[1d6]] rabbits
[[2d6]] squirrels
[[1d2]] deer

Tomorrow promises to be even better!
}}
(Note: that the above will have a trailing line break, leaving a blank line between it and the next note.  If it ended in "even better!}}", it would not have the trailing line break and the next note would begin immediately on the next line.)

GIT: https://github.com/shdwjk/Roll20API/blob/master/No...
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.
October 16 (8 years ago)
OOooooo very nice... do other people have access to this or just the GM?
October 16 (8 years ago)
The Aaron
Pro
API Scripter
Only the GM in the current version, but I'm down for expanding it. What do you have in mind?
October 16 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Very nice, if there was a way to keep the sandbox running between sessions, or have it start when players entered, this would be a great way for my group to write their own session logs (which we're doing now by having them email them to me, and then I post them on the table).

This may be beyond the scope of what you want (in which case I'll probably steal your code to repurpose ;) ), but would you feel like adding the functionality to create the log as a text object on the vtt?
October 16 (8 years ago)
Great script, I'm sure to use this!
October 16 (8 years ago)
The Aaron
Pro
API Scripter
Scott, how would you see that working?
October 17 (8 years ago)

Edited October 17 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I started thinking about it and I think it might be better as a separate script. The way I can see doing it is you'd have a command to set the selected text object as the script's target which would then be saved in the state (since the whole point is to change the text of the text object, and there isn't a "name" property for text objects). When you set a text object as the target, you also can pass width/height parameters to lock it into a certain size. I need to play around with the text objects some, but I'm hoping that they support text wrapping if you set a size for them (it's not possible to do this through the default Roll20 interface).

Possible features to add to the above (potentially also for journal entries):
  • Font Specification
    • Size
    • Style
      • bold/italics/strike
      • headers/code/quote | Arial, patrick hand etc
    • Color
    • Highlighting(for journals)
  • Create text object of given size centered on selected token/other object
I think that's it.

Like I said, might be better as a separate script just from the extra filtering for ID's and different text styles available in the two instances (actual fonts in text objects vs. header/normal/quote/code in journals)

P.S. Possible syntax:
!maptext[font:Arial size:12 color:#000000 width:140 height:140 generate]

Most of the above should be pretty self-explanatory, font size is in standard X-pt font, color is hex, width and height are in pixels, adding the generate keyword to the details would cause it to create a new text object centered on the selected object on the VTT (may or may not set the new text object as the script's stored text-target).
October 17 (8 years ago)
The Aaron
Pro
API Scripter
I think I might add markdown support if there is interest.  Also specifying the name of a handout to append to, and giving players the ability to log to granted handouts.
October 17 (8 years ago)

Edited October 17 (8 years ago)
So this just stores information in a "note" logged into the API? Something you can call up again later? 

Interesting...

Edit:

Ah wait no, it automatically updates a Handout ? Mmm okay.
October 17 (8 years ago)

The Aaron said:

Only the GM in the current version, but I'm down for expanding it. What do you have in mind?

Some of my players like to keep a log of their experiences... so perhaps have @CharacterLog where each character has their own log. When they want to add something they can put it here.

Would also be good if you use it with Call of Cthulu or something to keep track of everything for each character as like an Investigator log book.

Pord said:

The Aaron said:

Only the GM in the current version, but I'm down for expanding it. What do you have in mind?

Some of my players like to keep a log of their experiences... so perhaps have @CharacterLog where each character has their own log. When they want to add something they can put it here.

Would also be good if you use it with Call of Cthulu or something to keep track of everything for each character as like an Investigator log book.


+1 for this!  Did your previous version allow players to access it?  Seems I remember using it and having a macro that all players could use and collaboratively add to the party Log.  But it would be nice to be able to use this to add to individual logs as well.

October 17 (8 years ago)
The Aaron
Pro
API Scripter
The previous version was also GM only. It's easily changed though, so perhaps you'd removed that restriction. I'll see what I can do about expanding this. 
October 17 (8 years ago)
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Slightly near topic.... Quotables.

Sometimes I see a chat message that is too funny or important to let go... EVER.

"!quote [target Aaron's token]"

Gives me a clickable list of your last 3 chats... so I can save things like:

The Aaron said: "Stephen, I was really wrong about that. I am truly sorry."
The Aaron said: "Stephen, thank you for helping me with my script."
The Aaron said: "Stephen, we would have died in the dungeon if not for you!"

I click the one I want to save in my notes.
October 17 (8 years ago)
The Aaron
Pro
API Scripter
Should it also generate quotations that would NEVER HAPPEN. =D

That's a pretty good idea.  

Stephen S. said:

Slightly near topic.... Quotables.

Sometimes I see a chat message that is too funny or important to let go... EVER.

"!quote [target Aaron's token]"

Gives me a clickable list of your last 3 chats... so I can save things like:

The Aaron said: "Stephen, I was really wrong about that. I am truly sorry."
The Aaron said: "Stephen, thank you for helping me with my script."
The Aaron said: "Stephen, we would have died in the dungeon if not for you!"

I click the one I want to save in my notes.

Oh my god... This was the best...
October 17 (8 years ago)

Stephen S. said:

Slightly near topic.... Quotables.

Sometimes I see a chat message that is too funny or important to let go... EVER.

"!quote [target Aaron's token]"

Gives me a clickable list of your last 3 chats... so I can save things like:

The Aaron said: "Stephen, I was really wrong about that. I am truly sorry."
The Aaron said: "Stephen, thank you for helping me with my script."
The Aaron said: "Stephen, we would have died in the dungeon if not for you!"

I click the one I want to save in my notes.

Hmmm, so I could compile all those whispers to the GM in one handy note?

The Aaron said:

The previous version was also GM only. It's easily changed though, so perhaps you'd removed that restriction. I'll see what I can do about expanding this. 


I could see myself doing this.  I've learned just enough in the past couple years to really mess things up.  :)
October 17 (8 years ago)
The Aaron
Pro
API Scripter
Ha!
October 17 (8 years ago)
Arthur B
API Scripter

Stephen S. said:

Slightly near topic.... Quotables.

Sometimes I see a chat message that is too funny or important to let go... EVER.

"!quote [target Aaron's token]"

Gives me a clickable list of your last 3 chats... so I can save things like:

The Aaron said: "Stephen, I was really wrong about that. I am truly sorry."
The Aaron said: "Stephen, thank you for helping me with my script."
The Aaron said: "Stephen, we would have died in the dungeon if not for you!"

I click the one I want to save in my notes.

I would LOVE this! Honestly.

By the way, The Aaron, the script throws a `SyntaxError: Unexpected token )` when I try to save it. Trying to find out which other script it's interfering with.
October 17 (8 years ago)
The Aaron
Pro
API Scripter
Hmmm... good luck. =/     You can try adding ; to the beginning and end of each of your scripts.  Concatenation order seems to be unpredictable so adding and removing a script can completely change where a problem happens.
October 17 (8 years ago)
Arthur B
API Scripter
Yeah, I know... unfortunately. I'm trying to disable other scripts to find the culprit. Doesn't seem to do the trick, though. 
October 17 (8 years ago)
The Aaron
Pro
API Scripter
But disabling this one does?
October 17 (8 years ago)
Arthur B
API Scripter
Yes, as soon as I disable this one, the sandbox starts up just fine.
October 17 (8 years ago)
Arthur B
API Scripter
Ok, fixed it. It seems that it was some whitespace issue. When I c&p the raw code from github directly, then it throws an error. If I c&p it into a texteditor window and then c&p it into roll20, then it works just fine. 

Odd.
October 17 (8 years ago)

Edited October 17 (8 years ago)
The Aaron
Pro
API Scripter
Ah.  I bet it was expanding the '&bullet;' to something like '•' and that was for some reason causing an issue.  I've had that problem in the past with copying the raw file.  usually I write it as '&'+'bullet;' for exactly that reason.
October 17 (8 years ago)
Arthur B
API Scripter
Ah, could be. Next time I should just go for cloned repo directly, but I was too lazy to dig through my folders... 
October 17 (8 years ago)

Edited October 17 (8 years ago)
Gold
Forum Champion
I might try adding this to my monster-death macro (clicked to put the red-X status, and a bleeding FX, when the players kill a monster), so that it would automatically keep a long-running list in a Handout of every monster/enemy that is defeated. This should work with the macro code that shows the selected| monster's name, right?
October 17 (8 years ago)
The Aaron
Pro
API Scripter
yup.  That gets expanded on the client side.
Hey, if I add a way to specify the currently targeted handout by name and it's not crappily written will you accept the pull request or should I just fork it?
October 19 (8 years ago)
The Aaron
Pro
API Scripter
I'm happy to accept pull requests, though I'm fairly likely to rewrite rather than merge.