Register

Scene Specific Messages

An Add-on Module for Foundry Virtual Tabletop

Author: alakshana Project Source: Project URL Versions 11 - 11 (Verified 11) Last Updated 3 weeks, 1 day ago

Scene Specific Messages

A module for foundryvtt that loads chat messages on a per-scene basis.

API

game.modules.get("scenemessage").api.load() will bring up a dialog allowing you to load a number of chat messages of your choice (or the next 100 if you hit the 💯 button). This can be useful if your scene does not have enough messages sorted into it to allow scrolling, thus allowing you to access chat logs from older than the most recent 100 messages. Clientside, available to users. I considered adding sockets to allow the GM to do this for all users on the currently viewed scene, but because normal chat scroll is left to the user, I thought this should be as well.

game.modules.get("scenemessage").api.global() will set a flag that marks the currently viewed scene to show all chat messages. Useful if no scenes with ids that match messages exist, or whatever. Use it again to restore original module behavior. GM Only.

game.modules.get("scenemessage").api.inherit() will bring up a dialog allowing you to mark the currently viewed scene with an id. Messages that were created on a scene with a matching id will then appear in the scene that has inherited the id as if they were created in them (they will no longer appear in the original scene without a reload). This is not intended to allow messages to appear in two scenes at once: rather, this is intended to allow messages to carry over to a new scene should it need to be recreated or revisted after losing its original id. To facilitate this, please enabled "Allow Inherited Scene IDs" in the settings. GM Only. ※ Get your scene id by left clicking the compendium icon in the header when you open it with Configure. Keep track of your scene IDs if you plan to make use of this feature!

※ Execute these in the console (F12) or add them to 'script' type macros to execute.

Known Limitations

Because foundry only loads the last 100 chat messages, scenes which have fewer than a scrollbar's worth of chat messages flagged to appear in them in the last 100 cannot scroll up, and because of that they cannot load any older messages. Please use the first API method to overcome this if needed: for best results, do not load more than you need, though loading large numbers may not be able to be avoided if you have a world with many messages.

ALPHA TESTING PERIOD

Please let me know if you encounter any issues (report them in Issues).


Technical Details

Scope: Compares currently viewed scene (game.scenes.viewed.id) with message.speaker.scene on chat messages, and adds the latter to the chat message's dataset (on render) for culling via display: none on scene change. If OOC sort is on, accomplishes the same by adding message.speaker.scene to the normally empty message.speaker object of OOC chat messages.

License: MIT License.

Additional Info: Thanks to mxzf for help with the css.

Categories

Available Versions

  1. Version 0.2.0

    3 weeks, 1 day ago
    Foundry Version 11 - 11 (Verified 11) Manifest URL Read Notes
  2. Version 0.1.4

    3 weeks, 2 days ago
    Foundry Version 11 - 11 (Verified 11) Manifest URL Read Notes
  3. Version 0.1.2

    1 month, 3 weeks ago
    Foundry Version 11 - 11 (Verified 11) Manifest URL Read Notes