Automated Animations

This is a forum post to track discussion on Automated Animations. When TRL 0.2.0 is released I plan to update AA to the latest. In the meantime this post also is for discussing AA and an attempt to provide feedback for those that are trying to add new system support to it.
81 Replies
Vauxs
Vauxs•11mo ago
AutoAnimations? You mean the Automated Animations module? Or something else?
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Yep Automated Animations. It's stuck back on TRL 0.0.23, so quite a bit outdated, so I plan to update it to TRL 0.2.0 when it drops to try and keep it alive a bit longer.
Vauxs
Vauxs•11mo ago
I see. Following this thread then given I want to make a PF2e specific offshoot. Someday. Eventually. If happenstance allows.
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Yeah.. It's definitely a beast of a module. Only Otigon has some grasp of all the intricate parts and it looks like there are many that could drift into disrepair. I know just a bit on how TRL is used with it. I can only update the TRL / UI parts and not really help w/ the rest of the codebase.
Vauxs
Vauxs•11mo ago
I think it would definitely benefit from an UI update as it becomes incredibly slow at times Probably by having it render thousands of foldable elements across multiple pages.
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
There have been improvements to TJSSvgFolder to not render elements inside closed folders. I'm not sure which TRL version introduced that, but AA is on a much older version. AA also is a bit of a beast for data as it is storing everything in a single huge array of objects in a world game setting. This is not so bad if there are 10-20 animation definitions, but growing into the hundreds or thousands is potentially problematic.
Vauxs
Vauxs•11mo ago
And before that it was an object with property names being numbers! { "0": {...}, "1": {...}, ... }
AquaRex
AquaRex•11mo ago
I'm getting stuck at this lol, In attempting to add System Support to Auto Animations for Coriolis Game System, the output of this is ( as far as we can tell ) identical to for example alienRpg game system, which is already implemented as a game system supported for autoanimations. I've attempted to copy the code directly from the aa-alienrpg.js along with modifying the index.js inside autoanimations\src\system-support ( i assumed this file was the one telling which game system to use which file.. ) But it doesn't seem to even load that aa-yzecoriolis.js file at all when that gamesystem is loaded. I know it loads the aa-alienrpg.js file, but confusingly, it will do that even if the entry is removed from the index.js. So it appears the index.js is not being used to tell which gamesystem which file it should use, so what does? lol. I believe this would work with Coriolis, if I could just get aa-alienrpg.js ( or a duplicate ) to load in that game system. Any ideas? mysteryman
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
I can certainly help w/ the framework aspects, but not as much with specifics to implementing new system support. Have you run npm run build after you made the changes. TRL / Svelte framework is a compile time framework, so you must build it on changes.
Vauxs
Vauxs•11mo ago
You can alternatively use npm run dev to get a live experience, but yeah TJS beat me to the punch here lol
AquaRex
AquaRex•11mo ago
Yes, I've built on changes. It loads fine, just doesn't seem to load the file I need. I've tested and made sure the aa-alienrpg.js file loads if the AlienRPG game system is started. And if making modifications to this file and then building, i can see the changes when the file gets loaded in the game system. I just can't seem to get coriolis to load the file.
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
I'd stay away from using the dev server for now due to the complexity of AA. The dev server is a great feature of VIte and TRL that allows HMR / hot module reloading and changes to code in Svelte components dynamically without reloads to Foundry, but this is only really for Svelte components which is not the code that you are modifying, so running npm run build to do a full production build is recommended.
Vauxs
Vauxs•11mo ago
Having already delved in this, npm run dev will simply refresh the page if you are editing the system js files. So I wouldn't worry. Just makes it faster.
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Yes it will, but to be precisely sure changes are propagating it's best in general in that case for a production build. Less variables that can go wrong in this particular situation of getting the new code to take affect. The dev server is great when things are all situated correctly. Do you have a public repo for your changes? The next thing is to make sure the game system ID matches the system ID in whatever lookup code AA has implemented.
AquaRex
AquaRex•11mo ago
I have no idea what or where the lookup code is 🫣
Vauxs
Vauxs•11mo ago
in the index? probably, let me see
AquaRex
AquaRex•11mo ago
Only change Im really trying to make it get AA to load aa-alienrpg.js I assumed the index.js was what was loading which file. It looks like this
export * as dnd5e from "./aa-dnd5e.js"
export * as sw5e from "./aa-sw5e.js"
export * as demonlord from "./aa-demonlord.js"
export * as pf2e from "./aa-pf2e.js"
export * as sfrpg from "./aa-sfrpg.js"
export * as swade from "./aa-swade.js"
export * as wfrp4e from "./aa-wfrpg.js"
export * as dcc from "./aa-dcc.js"
export * as pf1 from "./aa-pf1.js"
export * as a5e from "./aa-a5e.js"
export * as forbiddenlands from "./aa-forbidden-lands.js"
export * as starwarsffg from "./aa-starwarsffg.js"
export * as ose from "./aa-ose.js"
export * as D35e from "./aa-D35E.js"
export * as cyphersystem from "./aa-cyphersystem.js"
export * as alienrpg from "./aa-alienrpg.js"
export * as cyberpunkredcore from "./aa-cyberpunkred.js"
export * as TheWitcherTRPG from "./aa-TheWitcherTRPG.js"
export * as twodsix from "./aa-twodsix.js"
export * as od6s from "./aa-od6s.js"
export * as standard from "./aa-chatmessage.js"
export * as darkheresy from "./aa-darkheresy.js"
export * as shadowrun5e from "./aa-shadowrun5e.js"
export * as ds4 from "./aa-ds4.js"
export * as dnd4e from "./aa-dnd4e.js"
export * as ars from "./aa-ars.js"
export * as earthdawn4e from "./aa-ed4e.js"
export * as ptu from "./aa-ptu.js";
export * as lancer from "./aa-lancer.js";
export * as anarchy from "./aa-shadowrun-anarchy.js";
export * as wrathandglory from "./aa-wrath-and-glory.js";
export * as dnd5e from "./aa-dnd5e.js"
export * as sw5e from "./aa-sw5e.js"
export * as demonlord from "./aa-demonlord.js"
export * as pf2e from "./aa-pf2e.js"
export * as sfrpg from "./aa-sfrpg.js"
export * as swade from "./aa-swade.js"
export * as wfrp4e from "./aa-wfrpg.js"
export * as dcc from "./aa-dcc.js"
export * as pf1 from "./aa-pf1.js"
export * as a5e from "./aa-a5e.js"
export * as forbiddenlands from "./aa-forbidden-lands.js"
export * as starwarsffg from "./aa-starwarsffg.js"
export * as ose from "./aa-ose.js"
export * as D35e from "./aa-D35E.js"
export * as cyphersystem from "./aa-cyphersystem.js"
export * as alienrpg from "./aa-alienrpg.js"
export * as cyberpunkredcore from "./aa-cyberpunkred.js"
export * as TheWitcherTRPG from "./aa-TheWitcherTRPG.js"
export * as twodsix from "./aa-twodsix.js"
export * as od6s from "./aa-od6s.js"
export * as standard from "./aa-chatmessage.js"
export * as darkheresy from "./aa-darkheresy.js"
export * as shadowrun5e from "./aa-shadowrun5e.js"
export * as ds4 from "./aa-ds4.js"
export * as dnd4e from "./aa-dnd4e.js"
export * as ars from "./aa-ars.js"
export * as earthdawn4e from "./aa-ed4e.js"
export * as ptu from "./aa-ptu.js";
export * as lancer from "./aa-lancer.js";
export * as anarchy from "./aa-shadowrun-anarchy.js";
export * as wrathandglory from "./aa-wrath-and-glory.js";
However, if I remove the line
export * as alienrpg from "./aa-alienrpg.js"
export * as alienrpg from "./aa-alienrpg.js"
From this, it still works fine after building and starting AlienRPG game system..
AquaRex
AquaRex•11mo ago
What am I looking at? 🫣
Vauxs
Vauxs•11mo ago
There is a default that in an event the system doesn't exist, is triggered. And AlienRPG could just happen to work with
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Heh heh... Discord tip is to always put links between <> to not show the large breadcrumb image. 😄
AquaRex
AquaRex•11mo ago
Hmm, maybe
Vauxs
Vauxs•11mo ago
At the function that actually registers the system hooks in AA
Vauxs
Vauxs•11mo ago
No description
Vauxs
Vauxs•11mo ago
so your ex. export * as wrathandglory from "./aa-wrath-and-glory.js"; has to be exported exactly as the id of the system Its a matrioshka of objects
AquaRex
AquaRex•11mo ago
I've tried creating an aa-yzecoriolis.js file and then add
export * as yzecoriolis from "./aa-yzecoriolis.js"
export * as yzecoriolis from "./aa-yzecoriolis.js"
to the index.js, to no avail lol
Vauxs
Vauxs•11mo ago
is the game.system.id yzecoriolis?
AquaRex
AquaRex•11mo ago
How can I check to make sure? It's what it shows up as in game, and the folder name in systems
Vauxs
Vauxs•11mo ago
by putting what I put in code into console game.system for all data about the system
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Check system.json for the id
AquaRex
AquaRex•11mo ago
No description
Vauxs
Vauxs•11mo ago
but either way I found the github page for it and that's the ID, so something else must be afoot
AquaRex
AquaRex•11mo ago
I assume it's the "name" part?
Vauxs
Vauxs•11mo ago
yes You can always put a console.log("Look me up", systemIdClean, systemSupport) right above that line in src/index.js and then build If you see no console log then you are building it wrong somehow
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Yeah.. name is old, but id is the new field, so the manifest is out of date, but that probably still works.
Vauxs
Vauxs•11mo ago
AA uses game.system.id which is a getter iirc so should be compatible
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Yeah.. just that the manifest might stop working; maybe on v12 as that was deprecated on v10 I believe; other problem for the future.
Vauxs
Vauxs•11mo ago
funny, given its updated last week https://github.com/winks-vtt/yze-coriolis
AquaRex
AquaRex•11mo ago
It printed yzecoriolis
No description
Vauxs
Vauxs•11mo ago
Look at the Module object then and see if yzecoriolis is there or some other id
AquaRex
AquaRex•11mo ago
No description
AquaRex
AquaRex•11mo ago
it's there on the bottom
Vauxs
Vauxs•11mo ago
alright, then it should work and register as such 🤔 then the issue is with the aa-yzecoriolis file itself not how you turn it on
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Might be helpful to post the repo to your current fork.
AquaRex
AquaRex•11mo ago
Thats good to know if thats the case
Vauxs
Vauxs•11mo ago
Then now just fix the hooks to actually match the system and not that of alienrpg 😄
AquaRex
AquaRex•11mo ago
Sorry, I feel so useless at this lol. Afaik, this code gets the chat message from the console whenever you use an item in order to trigger the correct animations for that item.. This is the code from the aa-yzecoriolis.js file ( identical to aa-AlienRPG.js )
import { trafficCop } from "../router/traffic-cop.js"
import AAHandler from "../system-handlers/workflow-data.js";
import { getRequiredData } from "./getRequiredData.js";
// WILL NEED REWORK AFTER THE V10 VERSION IS RELEASED
export function systemHooks() {
Hooks.on("createChatMessage", async (msg) => {
if (msg.user.id !== game.user.id) { return };

function extractItemId(content) {
try {
return $(content).attr("data-item-id");
} catch (exception) {
console.log("COULD NOT GET ITEM ID")
return null;
}
}

let compiledData = await getRequiredData({
itemId: extractItemId(msg.content),
actorId: msg.speaker?.actor,
tokenId: msg.speaker?.token,
workflow: msg,
})
if (!compiledData.item) { return; }
runAlienRPG(compiledData)
});
}

async function runAlienRPG(input) {
const handler = await AAHandler.make(input)
trafficCop(handler);
}
import { trafficCop } from "../router/traffic-cop.js"
import AAHandler from "../system-handlers/workflow-data.js";
import { getRequiredData } from "./getRequiredData.js";
// WILL NEED REWORK AFTER THE V10 VERSION IS RELEASED
export function systemHooks() {
Hooks.on("createChatMessage", async (msg) => {
if (msg.user.id !== game.user.id) { return };

function extractItemId(content) {
try {
return $(content).attr("data-item-id");
} catch (exception) {
console.log("COULD NOT GET ITEM ID")
return null;
}
}

let compiledData = await getRequiredData({
itemId: extractItemId(msg.content),
actorId: msg.speaker?.actor,
tokenId: msg.speaker?.token,
workflow: msg,
})
if (!compiledData.item) { return; }
runAlienRPG(compiledData)
});
}

async function runAlienRPG(input) {
const handler = await AAHandler.make(input)
trafficCop(handler);
}
And this is the console output log for both alienRPG and Coriolis. Maybe the issue is glaringly obvious to you lol, I kinda hope so in this case lol
Foundry VTT | Created ChatMessage with id [nLhWcvUdeg2mYC63]
Foundry VTT | Created ChatMessage with id [nLhWcvUdeg2mYC63]
Vauxs
Vauxs•11mo ago
// WILL NEED REWORK AFTER THE V10 VERSION IS RELEASED ?
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Posting your repo fork link will help in taking a look.. Heh heh... 3rd time mentioned... 😉 I suppose also commit everything that you have currently.
Vauxs
Vauxs•11mo ago
But yeah by this point just please commit and show us the work
AquaRex
AquaRex•11mo ago
Yea, I don't have a fork currently. Only locally edited files lol
Vauxs
Vauxs•11mo ago
Welp. I will tell you that the output log is not useful at all. You want to see the message data, which you can get using game.messages.contents.at(-1) (for the latest one) There you can see what the message is comprised of, and with that, run the proper functions.
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Yeah.. it should be ~20 minutes to make a fork and update it with what you have so far. It's the best way to get help as AA is not trivial. Also of course once you get it working that allows you to make a PR for adding support for the system.
AquaRex
AquaRex•11mo ago
Yea, I'll have a look at it https://github.com/AquaRex/aa-yzecoriolis
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Time to put some log statements here: https://github.com/AquaRex/aa-yzecoriolis/blob/main/src/index.js#L175 and in the aa-yzecoriolis.js file.
AquaRex
AquaRex•11mo ago
Doing this, I found that alienRPG is including the data-item-id into the _source - content of the chat message.contents. That coriolis doesn't seem to add. Here is Alienrpg:
"<div class=\"chatBG\" data-item-id=\"kUHFOLT0bs5ocmNw\" data-actor-id=\"fq93YdznHhe1GLeM\">
"<div class=\"chatBG\" data-item-id=\"kUHFOLT0bs5ocmNw\" data-actor-id=\"fq93YdznHhe1GLeM\">
And here is Coriolis:
"<div class=\"dice-roll yzecoriolis\">\n <div>
"<div class=\"dice-roll yzecoriolis\">\n <div>
Vauxs
Vauxs•11mo ago
That would explain nothing working lol. Well, you gotta look into how Coriolis provides the item to the message. If it does at all.
AquaRex
AquaRex•11mo ago
Yea..
Vauxs
Vauxs•11mo ago
If you cannot find anything under message.item, or message.flags pertaining to the item ID, then you are simply screwed. (Or any other property)
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Except it's a friends system right? I can't recall, so it might be system modding time too if not accessible.
AquaRex
AquaRex•11mo ago
Could it be any of these? ( sorry for this lol )
No description
Vauxs
Vauxs•11mo ago
no you are looking at the ID of the message
AquaRex
AquaRex•11mo ago
Right, makes sense I guess
Vauxs
Vauxs•11mo ago
and the token ID of the speaker you want the item that "spawned" the chat message if you cast a Fireball in D&D5e, the message contains the data that its this tokens fireball look at the flags
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
There is a yzecoriolis flag you can't see from that previous post.
Vauxs
Vauxs•11mo ago
there is an yzecoriolis flag in there
Otigon
Otigon•11mo ago
This is something I really wish Foundry would standardize (somehow, someway) in what data is made available as default in systems
AquaRex
AquaRex•11mo ago
I assume you mean this one
No description
AquaRex
AquaRex•11mo ago
It's correct to the item that triggered the event. But no Id in sight I guess it might be part of the reason this system isn't already supported? lol
Otigon
Otigon•11mo ago
I mean, you could get fancy in the system handler and grab the Item from the Token using it If they at least give you the token or actor ID
Vauxs
Vauxs•11mo ago
There's the speaker data
Otigon
Otigon•11mo ago
not all systems utilize that
Vauxs
Vauxs•11mo ago
but it was shown its there in the previous screenshot alas it looks like you would never get an accurate item ID from this You could go around the issue by going token -> actor -> search for an item that matches the rollTitle but this sounds painfully ripe for bugs as it pertains to storing the animation data on the item itself what if someone has two daggers? is rollTitle even accurate to the item name?
AquaRex
AquaRex•11mo ago
Im gonna look through the other supported systems, in case another one is doing something similar to this already
Vauxs
Vauxs•11mo ago
idk You are way better off asking the system devs to implement the item to the chat message I doubt Otigon went out of his way to try to support such systems with such issues
AquaRex
AquaRex•11mo ago
Hm, yea you're probably right
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Two potential PRs now... Welcome to the deep end of Foundry dev.. ;P
Vauxs
Vauxs•11mo ago
I am glad I just want to play PF2e and nothing else lol
Otigon
Otigon•11mo ago
lmk when you get around to that PR. I'll help out as best I can a little rusty on the JS after 6 months lol
TyphonJS (Michael)
TyphonJS (Michael)OP•11mo ago
Also Otigon... When I get the next TRL release out 0.2.0 I'll get AA updated and tuned up and submit a PR. It's a bit out of date.
AquaRex
AquaRex•11mo ago
Anyway, thank you all so much for the help! I would have wasted a bunch of time, if it wasn't for you guys! 😂
Want results from more Discord servers?
Add your server