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] MotD -- Message of the Day sent to players when they log in, based on the contents of a note.

1419921447
The Aaron
Pro
API Scripter
GenKitty is always giving me good ideas.... (Inspired by: <a href="https://app.roll20.net/forum/post/1443417/#post-14" rel="nofollow">https://app.roll20.net/forum/post/1443417/#post-14</a>... ) This is a very simple script. It creates a note named "MotD Note". When a player logs in, it whispers the contents of that note to the player. Any formatting that works in the Note is passed on to the player. You can use %%NAME%% as a placeholder for the name of the player. Let me know if there are other features desired! GIST: <a href="https://gist.github.com/shdwjk/28d4970fe59fa15d3d6" rel="nofollow">https://gist.github.com/shdwjk/28d4970fe59fa15d3d6</a>...
Neat, I can remind people who never read the game time and date the game time and date!
1419945471
The Aaron
Pro
API Scripter
Well, at the point they are logging in, hopefully they haven't missed it... :)
1419955255

Edited 1419956750
Lithl
Pro
Sheet Author
API Scripter
Neat!
1419955636
The Aaron
Pro
API Scripter
Thanks!!
1419956869
Lithl
Pro
Sheet Author
API Scripter
I think I like using this to keep people apprised of what's been going on in the campaign (screenshot from the last session of my Unknown Ponies game edited into my last post). Especially if there's a couple weeks between sessions.
1419957210
The Aaron
Pro
API Scripter
Yeah. That's exactly what I was thinking as I was writing it. =D (Thanks GenKitty for the idea!!) My original test note actually started out with "Last time, on..." =D
1419961496
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Good script, it surfaced issues with Brian I was never aware of (some of them troubling.)
Stephen S. said: Good script, it surfaced issues with Brian I was never aware of (some of them troubling.) What kind of issues?
1419961893
The Aaron
Pro
API Scripter
(Probably Brony issues! =D)
1419962139

Edited 1419962321
Lithl
Pro
Sheet Author
API Scripter
Hey, if the co-founder of the Machine Intelligence Research Institute is allowed to write a story in which Harry Potter murders Rarity*, I'm allowed to play Unknown Ponies. Mr. Yudkowsky has also revealed that he has read at least one MLP fanfiction story (and it was the only horror story he's ever read that actually scared him). =) * Okay, technically Harry turned Rarity into a pebble, gave the pebble to Professor Quirrel, and Quirrel murdered her later.
1419964733
Gen Kitty
Forum Champion
Aaron, you are such a sweetie! THANK YOU!!! I'll poke at this when I'm at my desktop later and let you know if I blow anything up. And don't go dissin' the ponies, or I'll have to demonstrate for you the difference between complaining and whining. ^_-
1419965312
The Aaron
Pro
API Scripter
Hehehehe! You're welcome. :-)
1419996513
Gen Kitty
Forum Champion
Ok. Feeling dumb here, but I need config instructions :&gt;
1419997054
The Aaron
Pro
API Scripter
No worries. It's deceptively simple. You just install the script and save it. It creates a handout named "MotD Note" that you edit with the message. That's it. :)
1419997632

Edited 1419997742
Gen Kitty
Forum Champion
"ERROR: You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info." It did, however, make the handout! And the handout works!
1419998284
vÍnce
Pro
Sheet Author
The Aaron said: No worries. It's deceptively simple. You just install the script and save it. It creates a handout named "MotD Note" that you edit with the message. That's it. :) Deviously simple...hmmm?
1420000198
The Aaron
Pro
API Scripter
GenKitty said: "ERROR: You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info." It did, however, make the handout! And the handout works! Cool! That error is nothing to worry about. It happens whenever you create a handout but don't set the imgsrc. :)
1420085100
Gen Kitty
Forum Champion
Query: Can you put a delay on this display such that it will show up below the Roll20 blurb?
1420085436
The Aaron
Pro
API Scripter
There is a 10 second delay on line 57. (10,000 milliseconds technically...) You could bump that up, if necessary. I bumped it to 10 for just that reason.
1420095662
vÍnce
Pro
Sheet Author
Neat idea GenKitty. Thanks Aaron. Some ideas I have for this are; links to other handouts, recaps of the last session, trivia, quotes, reminders, the latest roll20 enhancements w/links, date/time of the next game, ...
1420095828
The Aaron
Pro
API Scripter
All doable. Ideas I have for this: show the handout's image above it. Personalized by player Preloaded for schedule of days (show this one next time, then this one, etc)
1420096166
vÍnce
Pro
Sheet Author
You could have the in-game date and time as well. Anyone have a calander script that works? :-)
1420096595
The Aaron
Pro
API Scripter
Ouch Vince! Stop poking me!! :)
1420101432
vÍnce
Pro
Sheet Author
Happy New Year!
1420125263
The Aaron
Pro
API Scripter
Thanks! The same to all of you!
1420127213
Gen Kitty
Forum Champion
Vince said: You could have the in-game date and time as well. Anyone have a calander script that works? :-) *laugh* I'm watching for this too :&gt;
1420129518
Gen Kitty
Forum Champion
Huh. I think the script's been possessed. Before I posted asking about the delay, the MotD Note showed before the green Roll20 blurb. This morning I played around with increasing the delay. I ended up putting it back to 10 second delay. NOW it shows up after the blurb... twice. And it is random as to where the MotD shows! When I was testing with a simple page reload, I'd get the doubled result after the blurb. Exit game and relaunch campaign, one copy showed up between roll20 blurb and the gamelink, the other showed up after. x.x (Amusing sidenote: I have 9 scripts. 2 are HB's powercards, old and new, the rest are yours)
1420132639

Edited 1420132685
The Aaron
Pro
API Scripter
Yeah, it's probably highly dependent on network lag. Maybe we can get a player login complete event to trigger on... Market share dominance is my current strategy!
1420133286
Gen Kitty
Forum Champion
Update: When a player logs in, the player only sees one , in the proper place. Except if he reloads the tab, and then he gets two, but still in the proper place. Or he gets more than two. I relog as a player I get none, I relog as GM and I get FOUR, two above and two below. Aaron, dear, I'm punting this back to you for exorcism :&gt;
1420133505

Edited 1420133546
The Aaron
Pro
API Scripter
The chat log retains the last few messages on reload/login. Are you sure those aren't from previous MotD output? Try saying something unique between reloads to be sure.
1420134261
Gen Kitty
Forum Champion
Reloading the tab gives me two MotDs, one a split-second after the other. Rejoining as a player removes all the MotDs from my backscroll (makes some sense, and not a bug I care about) and shows no new MotD. Rejoining as a GM puts the two MotDs I should have gotten on my last login back into backscroll, and gives me two fresh MotDs below the roll20 blurb & joinlink. Exit game, nuke chatlog, and launch campaign again: I get one MotD in the proper place. Exit game, launch campaign: One MotD in the right place. Fill the chatlog with some stuff, reload tab: Two MotDs, in the right place. Exit the game and relaunch again: Two MotDs, with a longer pause before the second one shows up. The first time anyone logs in after a chat-nuke, things are fine. After that it gets weird. Tell me what new things you want me to try for troubleshooting this? :)
1420136685
The Aaron
Pro
API Scripter
Haha! Ok, I think that's pretty exhaustive!! When I get on my computer later, I'll see if I can introduce some logging and get to the bottom of this. Rejoining as player probably doesn't change your online status, so no surprise it doesn't show. I might have to add some hysteresis to the display.
1420138697
vÍnce
Pro
Sheet Author
I had the double message as a player well.
1420138706
vÍnce
Pro
Sheet Author
Another thought, would it be possible for a player to send a MoTD to the GM? I understand that this might be a different script. A given player and the GM would have edit/seen permissions of the handout. That player could log into the game between sessions, edit he the "MoTD_gm" so that the GM would receive the /w message from that player. Would it have to check each player's handouts?
1420139269
Gen Kitty
Forum Champion
Hm. For that you have private messages, I think.
1420142053
The Aaron
Pro
API Scripter
It would be possible to write it to do that. What's the use case? If it doesn't need to be private, you could just grant edit of MotD to all players. If if you need something more along the lines of a message system thst is delayed till the person logs in, that would be another script but completely doable.
1420142723
vÍnce
Pro
Sheet Author
It was just a "thought of concept", not really a request. :-) Sometimes I ask players to do a little "homework" between sessions. Usually, it ends up happening the first part of the game. Example; I asked a player to give me his Paladin's Code of Conduct before the next session. He could log in and post this in his handout. What do you want your character to do between sessions? They could post some info in the MoTD_gm handout. Or maybe they need to post a question to the GM. I'm thinking email would be a better solution unless a gm wanted a log of these types of out-of-session play.
do your players get 2 MotD's when they log in under the circumstances that give you 2, or is it just for you?
1420179479
Gen Kitty
Forum Champion
My player gets two or sometimes none. x.x
GenKitty said: My player gets two or sometimes none. x.x After long bouts of inactivity, the API will spin down the sandbox.
1420263923
Lithl
Pro
Sheet Author
API Scripter
Now that was weird. I'm in the middle of the game now, and just received the MotD message without reloading anything.
1420264178
The Aaron
Pro
API Scripter
Weird...
Neat script, I'm gona have to start playing around with it really helps with giving quick recaps, now my players can read somethign while i scramble to finish getting everythign ready XD
1420955884
The Aaron
Pro
API Scripter
Cool! Let me know if you see any of the issues Brian experienced. :)
1421286359

Edited 1421287149
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Nice script! I have a question about its code though: What is the purpose of the fixedCreateObj function, and why do you return the function in another function? I think I've seen a pattern like this used before, but couldn't find out what it is. Nevermind. I found another thread discussing a bug that that function fixes. I still wonder why you wrap it in a closure though. It's just a function that immediately returns an anonymous function. Isn't this equivalent to just setting fixedCreateObj to that inner function in the first place?
1421288368
The Aaron
Pro
API Scripter
I'd love to say it was because of some super advanced technique... But it's not. :). I believe at one point I had it keeping a private copy of createObj() as there were other scripts that would overwrite it. At some point I removed the private createObj() but not the closure that had contained it.