LOEFD
Join ServerLeague of Extraordinary FoundryVTT Developers
development-basics
socket woes
not the socket firing
Some of the basics
You have
sockets: true
in your manifest?No lol
But, I'm not working inside my module, just using the console
Lol our wiki page is super helpful
https://foundryvtt.wiki/en/development/getting-started-with-development#how-do-i-get-started-with-sockets
/S
https://foundryvtt.wiki/en/development/getting-started-with-development#how-do-i-get-started-with-sockets
/S
Ok, well the socket needs your module registered to be a valid scope I think
Which means setting that in manifest and restarting foundry
How does scope work?
Do I need to change it to
scs.phaseChanged
?You can probably use 'world' to play around
Ahhhh, hmmm
Good question
Hold on let me check confetti
I searched the wiki and couldn't find that. I even kind of remembered seeing it before, but I doubted myself since it didn't show up
Has to be 'module.MODULE_ID' I think
The stub answered those questions https://github.com/VanceCole/macros/blob/master/sockets.js
(it's not helpful to say 'lol just use socketlib' whoops)
Oh good we linked to vance
I think it's a bit complicated to use sockets for what I'm doing since I just remembered my trick with high-jacking the settings update hook
It's easier
Hijacking settings is legit
game.settings.set("scs", "currentPhase", val);
Hooks.on("updateSetting", setting => {
if (setting.data.key === "scs.currentPhase" && !game.user.isGM) {
// Do something for player clients
};
});
You can put this on the settings' onChange instead of using the hook if you want
That's how I do in GM screen
I don't have access to the same variables there