#"I Am The Firewall" Macro

1 messages ยท Page 1 of 1 (latest)

errant shuttle
#

I figure this will be easier as a thread, @raw kernel.

So, right off the bat without even trying to run it, the name is still wrong - it should be "I Am The Firewall". I fixed it locally, but it really should be corrected for public consumption.

Trying to run it errors out with:

raw kernel
#

For the name, are you talking for file name or a different location?

#

Will look into the error when I get home

errant shuttle
raw kernel
#

naming is fixed

raw kernel
errant shuttle
raw kernel
# errant shuttle Yes.

I am unable to reproduce that error, can you send me what you have in the macro itself? I want to confirm that there isn't an error somewhere on what github is showing

errant shuttle
#

I just redid it now to capture the "The" change, and it still throws an error:

raw kernel
#

do you have a token on the scene selected when you execute the macro?

#

I also pushed a fix for a different error that I was getting

raw kernel
#

What version of foundry are you running? I built them in version 11, so something may have changed

errant shuttle
#

v10. They're off for testing purposes, but I have too many modules I use that didn't make the transition to v11. I won't be moving to v11 until SR5 forces me to.

#

Ah... fixed it.

#

I wonder if v11 defines "actor" in a global scope that v10 doesn't allow.

#

I changed all references to actor as the variable to hacker and it gets a bit further.

#

Fixed canvas.tokens.objects.childern; to .children

#

Now dies a few lines later with:

raw kernel
#

well I define actor in the script which I wonder if v10 did something with that or maybe one of your macros

#

I was gonna just change everywhere I use the variable actor to something else so that it doesn't happen to anyone else

#

I just pushed the change. did it on rally and calibrate as well

errant shuttle
#

I'll poke at it some more later, but for now, I need to get back to work.

raw kernel
#

I feel that one

errant shuttle
#

So... I'm back poking at this. Why are you looking at prototypeToken.disposition instead of the token directly? A token's disposition can be changed once it's on the canvas and what's on the prototype may not match it's use in a given scene.

raw kernel
#

because I already have an array of all of the token actors. The actors do not have the token on them. they have a prototype token on their object

errant shuttle
#

Okay... but that's not going to give you the disposition as set on the scene. The on-scene disposition is part of the Token, not the Actor or the Actor's PrototypeToken.

#

I've tweaked it in my version to check element.document.disposition, which I think captures the correct value on the token.

raw kernel
#

actually, that is whole line is a hold over from a set of data that I was getting on an older version of either SR5 or foundry. I missed the fix on that macro although rally/calibrate have it updated

errant shuttle
#

Yeah... element.document.disposition is the right thing to reference. If I take a PC token and set it to Hostile, it isn't included even though the PC's prototype is Friendly.

#

Also, why are you using mode: 2 on the AE? Generally speaking, you want to use mode: 0 which is the system's custom handler. I'm not sure precisely what it does behind the scenes, but as I understand conversations with @rigid sandal it has some smarter logic behind it.

raw kernel
#

2 is just add

#

I will see if I can find clear documentation from foundry on what the different values are

errant shuttle
#

Also on the AEs, you appear to be using .name... Do they properly show up with a name in v11? Because in v10, it's .label.

raw kernel
#

they replaced label with name in v11

errant shuttle
#

PITA...

raw kernel
#

I wondered when that replacement took place exactly. So what I will do is just put both in, as an extra field does not hurt anything

errant shuttle
#

function findObject() is declared, but never used.

raw kernel
#

That was used for looking up different item names where there were multiple possibilities. May do a rev 2 where it can find every ar based item to see if you could theoretically be running in ar

#

I will pull it out for merge but will keep it around to play with on my local

errant shuttle
#

So, this is the version I'll be using (before some house-rule specific adjustments).

I removed the device check, because one issue the system itself has is that you can't disable a Character's matrix Device without deleting it. You can toggle between multiple devices, but one of them is always active. It's checking if one exists but not if one is in-use (and there's no UI method I'm aware of to disable the one an Actor has).

I also deleted the VR check because there is currently no UI I'm aware of to set that particular value.

#

I like how you pay attention to i18n strings for the skill names instead of hardcoding them.

raw kernel
#

i18n?

errant shuttle
#

A short hand for "Internationalization" (because it's a long friggin' word - an "i", 18 letters, and an "n"), aka the translation strings.

#

It's something that will go away in my final version, because I'm using custom skills that aren't set up for translation. ๐Ÿ™‚

raw kernel
#

ah, haven't come across that short hand yet

errant shuttle
#

In any case, a more advanced/elaborate version of this would include putting a slightly different version on the originating character. I think Effect Macro can be set up to trigger on the Actor's turn. If so, I could embed a macro to go through and remove the AEs from friendlies.

#

In fact, you might want to include a macro to cycle through and remove them. Right now, it has to be deleted manually which isn't terribly onerous.

#

I wonder if a macro can detect a keyboard state when it's activated, like... could you set it up so if you CTRL-Clicked, it would run a removal operation intead of the roll-and-create operation.

raw kernel
#

maybe, I am thinking about ways to remove all of the effects from characters. with the unlinked tokens it won't stay past the life of the token on the field. but for the linked tokens that could be an issue

errant shuttle
#

Sure, but IATF isn't a long-term bonus. It expires on the hacker's next turn.

raw kernel
#

That is something you can set on AEs, of how long they last in rounds and turns

#

and is it next turn or next pass?

errant shuttle
#

Kinda... there are duration settings, but they don't actually do anything unless you've got some other module managing time. The system doesn't do it inhernently.

#

In SR5 alone, the only thing having a duration does is determine whether or not the AE is categorized as "Temporary". All that does is determine whether or not an icon shows up on the token.

raw kernel
#

really? well damn

errant shuttle
#

Yeah, the AE system was ripped out of D&D5E, which doesn't automate much as a opinionated design choice. D&D5E has lots of things to be hooked into, but leaves them to modules to automate.

raw kernel
#

does the effect macro "on combat turn starting" work for each round or no?

errant shuttle
#

I'm not sure. I haven't looked into it yet.

raw kernel
#

also, I believe the hot-sim button sets VR to true

errant shuttle
#

I read some of the documentation, and I think it has one for top-of-turn and one for combatant's-turn.

errant shuttle
raw kernel
#

oh I know, there is no button for cold-sim sadly (as that also changes the init dice pool

errant shuttle
#

Actually, does toggling to Matrix Initiative set the VR flag?

#

If it does, that'd be a valid reason to use it as a key.

raw kernel
#

it might, hotsim has its own flag

errant shuttle
#

Yeah, which adds an extra die to Matrix Initiative. I'm not in a position I can test much right now.

raw kernel
#

I am looking at it now. matrix init doesn't seem to change any flags outside of what init is used

errant shuttle
#

Yeah... I suspect that VR flag is for not-yet-implemented-feature.

raw kernel
#

yea, I think you may be correct. I will leave the check in as it is not hurting anything as it is looking for vr to be false

errant shuttle
#

It checks if an IATF effect already exists, if it does, it deletes it, then makes a new one. Why not just update the existing one if it's already there?

raw kernel
#

the issue comes when there is not an effect already existing

errant shuttle
#

if-exist, update, else create. I have it working fine.

#

I also have it rigged to do a pass and delete them all if you invoke the macro while holding down CTRL.

#

This has my house rule adjustments in place (different skill, half-hits for the bonus), and I renamed the variables so they're different from elements of the object paths, but you should be able to figure out the rest.

raw kernel
#

effect.update won't work as that is something from Effect Macro and not foundry

#

nvm, that might work. missed the find call

errant shuttle
#

It's not, it works just fine.
Yeah, effect is a variable defined by your code. EM does handle it as a special keyword when invoked inside/by EM, but we're not doing that here. .update is standard Foundry.

raw kernel
#

surprised .update worked there given it doesn't always work on embedded objects

#

why did you have those do an await as well? since they are the end of the script?

errant shuttle
#

No clue, I'm just playing copy-paste monkey. I don't really know the API or JS at all.

raw kernel
#

It would make sense to await the return if you have more to do after, but since it just ends there you could just do without it

errant shuttle
#

The basic logic I get, but I don't know the language. ๐Ÿ™‚

raw kernel
#

ah. await is for an async call you need the response from before continuing on

#

I am going to look into if it is possible to add a special effect to the decker to used the skill to remove the effect on the start of their next turn. As it turns out the Effect Macro "On combat turn start" does trigger for SR passes

errant shuttle
#

That would be even better that the CTRL function I built into it.

#

The unneeded awaits are the two inside the if (effect) block, yeah?

raw kernel
#

yea

#

My current issue is figuring out how to add that functionality in the script as I do not see the effect macro script under the effects on the character. So not sure how they are stored yet

errant shuttle
#

They're stored in flags:

raw kernel
#

would not have thought to look under flags. was looking at several other possibles

errant shuttle
#

Almost anything that a module creates is going to be stored as a flag. It's pretty much the only place they're meant to put arbitrary data.

raw kernel
#

good to know

raw kernel
#

I noticed a bug with unlinked tokens. the effect is put on both the token actor and the actor in actors side bar. I will try to pull the token actors only and edit their effects

#

So a rework is in order

raw kernel
#

You will need to do the changes you need for your custom skills. but this now adds an effect macro to the decker that when it is their turn in combat again it removes the macro from everyone including themselves

errant shuttle
#

Having a look at this now...
displayMod and displayPool are declared, assigned values, then unused.
findObject() is still declared but unused.
You're still getting the decker's disposition from the prototype token, not the canvas token.

errant shuttle
#

You may want to have it check for a selected token before doing anything, something like...

if (canvas.tokens.controlled.length != 1) {
    ui.notifications.warn("Please select a single hacker's token.");
    return;
}

...as the very first thing. Otherwise, it'll fail silently from the user perspective.

errant shuttle
#

Um... well... it doesn't appear to work at all. It never gets to the console.log(target.name); after element.actors.forEach(target => { in v11 and silently fails to do anything. In v10 it throws an error at that forEach loop:

raw kernel
#

can you confirm if v10 has canvas.tokens.documentCollection?

errant shuttle
#

Nope... and I'm not saying it doesn't, I'm saying I don't know how I'd go about confirming it either way.

raw kernel
#

in console type it in and see what it returns

#

if it doesn't exist it will return undefined

errant shuttle
#

It exists.

raw kernel
#

can you send a screen shot of what it returns?

errant shuttle
raw kernel
raw kernel
errant shuttle
#

What makes you think Effect Macro is involved at that stage?

raw kernel
#

I don't, I am saying it is the only module I have installed and it is working. So I am wondering if one of the modules you have running is messing with it some how

#

I don't have a v10 to test on

errant shuttle
#

I have no modules active on my v11 test world, it still does nothing. Something around that point is failing silently in v11 and failing loudly in v10. It's still failing in the same place.

raw kernel
errant shuttle
#

No. I said that "It never gets to the console.log(target.name);"

raw kernel
#

add a console.log just before the changes.push line and see if that is ever displayed

#

I wonder why it works for me and not for you. what browser are you using?

errant shuttle
#

Chrome.

raw kernel
#

now I am really confused

errant shuttle
#

The console before changes.push fires.

raw kernel
#

move it to inside the first forEach but before the second

raw kernel
#

Here is one that should work on v10, I went and downloaded a windows exe for v10

rigid sandal
# errant shuttle Also, why are you using `mode: 2` on the AE? Generally speaking, you want to use...

It's a while back in your conversation, but, here I go:
The modify mode (mode: 0) understands values with .base, .value and .mod and allows for easy modification of them. Attributes, limits, skills, and so forth fall under that category.
While add (mode: 2) only adds the value on top of the given key (.base or .value), the modify-mode will add the value always into .mod, no matter where the key actually points (system.attribute.body.value, system.attribute.body.base or just system.attribute.body). This allows for ActiveEffect changes to show up in the little value pop ups (see attributes) and be more transparent.
The modify mode also uses add as a fallback, should the given key not point to something with a .mod (for example modifiers).

#

So basically: Always use modify or overwrite (which also has system specific handling btw, but does the same in practise)

raw kernel
#

ah, good to know. will make sure I use either mode: 0 or mode: 5 on things

#

while you are here taM, any idea why the script would work for one of us and not the other when we both only have effect macro module and are both on chrome with v11 of foundry?

rigid sandal
#

Any errors in console?

raw kernel
#

not on v11, T.J. is saying it is failing silently

rigid sandal
#

Nothing that is obvious. If it's related to T.J.s world, I'd expect some error... so maybe the script isn't actually executing somehow

#

Maybe paste it into the F12 console directly and this would give an error, if there is one to be had

raw kernel
errant shuttle
#

That seems to work... though there is a new issue! (New issues are progress!)

#

The var decktoken bit is relying on the token and the actor having the same name. This is not guaranteed to be true.

raw kernel
#

yea I noticed

#

the other option is to check by id. when I wrote that section I was still hopeful of only one script for both versions and since fields like that may have changed I didn't touch it since I new name didn't

#

now that I have two different ones, I will adjust to look for id

errant shuttle
#

I wouldn't have even noticed at all if well... I wasn't doing it. I've got a character that the players don't know the name of. They call him "The Kid" because that's what he is, so that's what his Token is called.

raw kernel
#

for v10

errant shuttle
#

Looks good!

raw kernel
errant shuttle
#

BTW... I figured out why you may not have realized that Temporary Effects generated an icon on the token: the AE needs to have an icon set. If there's nothing to display, there's nothing to display.

raw kernel
#

That would do it, and I have not figured out or created an icon for it yet (I want to have one for each of the macros that are character actions)

errant shuttle
#

This is the one I use for IATF, though the colors are specific to my style guide - I use those green and grey shades for all matrix-related things.

#

I use this for rally:

#

I have one I use for Calibrate, but I'm not happy with it, so I'm not going to share it.

raw kernel
#

guessing you made those?

errant shuttle
#

Hrmm... nope, still has an issue. The disposition checking isn't working.

raw kernel
#

on which one?

errant shuttle
#

v10.

raw kernel
#

paste this into console and then tell me what it returns

let decker = canvas.tokens.controlled[0].actor;
let deckid = decker._id;
var decktoken = canvas.tokens.documentCollection.filter(element => {
    return element.actorId === deckid
});
let deckalliance = decktoken[0].disposition;

deckalliance
#

is this on the v10 you shared with me?

errant shuttle
#

Yeah. Feel free to hop in and have a look. The tokens inside the hexes are all friendly. The Kid, who is the responsible adult actor is in the middle of the second row. The three above the hexes are Hostile, the "Mr. Crate Actor" in between them is neutral.

#

The only change I made to the macro is adding the icons so they show up on the tokens (makes it easy to see which ones get it).

raw kernel
#

I see that

#

I found the issue

#

I forgot to check each token against the targets list

errant shuttle
#

I kinda like seeing the scrolling text rain down across the screen with that many tokens. ๐Ÿ™‚

raw kernel
#

I think I got it that time

errant shuttle
#

I'm gonna check something, gimme a second...

raw kernel
#

I saw it, fixed

errant shuttle
#

You need to add the target check on the removal, too. The Friendly was removing from the... he he he. Okay. ๐Ÿ™‚

raw kernel
#

forgot to update the removal script part

errant shuttle
#

If I haven't said it before, I really appreciate all the effort you're putting in to this. I am so happy to see all the recent interest in the SR5 implementation.

raw kernel
#

I moved from theater of the mind to foundry because of too many times where a map was needed. And it is cheaper for me to run with the same or better functionality as roll20

errant shuttle
#

Yeah, I've got one player that's about 3000 mi from the rest of us. We'd be playing in person if he weren't. It was never my preferred system, but I did D&D5E via FGC/FGU for a long while... until I just couldn't stomach running D&D anymore. I came to Foundry because FG's SR support was somewhere between non-functional and non-existent (but still published) depending on version. I found Foundry and never looked back (R20 was never on the table).

raw kernel
#

I have one player who loves roll20 and likes to complain about foundry not doing something correctly. So I just find a module to make it do the thing

errant shuttle
#

Can't speak to the v11 version, but the v10 version seems to work great. I'll let you know on Friday morning if my group manages to screw it up. ๐Ÿ™‚

raw kernel
#

ok, hopefully someone will be able to test th v11 outside of myself

#

once I get this svg edited to all white I will be pushing a new commit up

errant shuttle
#

Which one? I can do it pretty quick. ๐Ÿ™‚

raw kernel
#

the firewall one, I have it white. trying to figure out how this extension in vscode can save it

errant shuttle
#

Oh. Can't help ya' there. ๐Ÿ™‚

raw kernel
#

I am about to just edit the text manually. would probably have been done by now

errant shuttle
#

But that's getting off-topic for this thread....

raw kernel
#

feel free to approve the PR if rally and calibration both work as well

#

If I need to do a v10 version let me know

errant shuttle
#

I haven't checked them yet. Maybe tonight (it's noon local). I do have to spend some time doing my actual job today. (I joke, I've been doing it between other things... some of my work is firing shit off and waiting for it to finish.)

#

If I find issues with them, I'll make a separate thread. I think we can close this one out now.

raw kernel
#

lol, it is the same for me. I am noon local now and the work I have atm is documentation for soon to be development work

errant shuttle
#

So... I just discovered a fundamental flaw.

#

Users cannot add or remove Active Effects to actors they do not own.

#

This works fine if the GM rolls it. It doesn't work if a player does.

raw kernel
#

oh.... well that makes things more difficult

errant shuttle
#

There are ways to do it, something about socket commands and bouncing things off the GM user, but I wouldn't even know where to begin.

raw kernel
#

can the observer level work for them?

errant shuttle
#

Nope. Has to be owner.

raw kernel
#

damn

#

ok, will look up how to take the command and have the GM run it

errant shuttle
#

Me doing the roll instead of them was far better than me having to do all the adjustments manually, though.

#

So... big step in the right direction.

raw kernel
#

It appears it may need a new module to work. There is one called Warp Gate that might be able to do what we need

errant shuttle
#

Yeah... Warp Gate does have a bunch of functionality for things like that.

raw kernel
#

It may help with other ideas well. I will look into using it for an update change on the script

raw kernel
#

@errant shuttle, I got it working from the players end. does need a new macro though

errant shuttle
raw kernel
#

The only downside is I think I still have to have a v10 and v11 version. although we are now down to just the name/label issue

#

if you want to see if the v11 just happens to work for you I can send it over and you can give it a try

errant shuttle
#

Shouldn't you just be able to do both and let it complain?

#

Besides... @rigid sandal and I were talking earlier, and I may be forced into v11 soonish anyway. coolcry

raw kernel
#

no because this time warp gate is having an issue in referencing (it uses the old v10 method still, so v11 has to force a call)

#

I am not surprised. which modules are you concerned about again?

errant shuttle
#

Perfect Vision, Multilevel Tokens, and the suite of DF modules.

#

I think the colored global lighting thing I use PV for is going to be core in v12.

#

Sadly, there is no replacement for MLT's cloning function, which is the best way I've found to do multi-level scenes.

raw kernel
#

once I figured out how to use rippers levels module it is not bad. There are still some things I need to figure out with it though.

#

like how to make actors only appear on certain levels

#

I got the background to work though

#

What are the DF modules?

#

DFreds?

errant shuttle
raw kernel
#

oh, and the last release was a while ago

errant shuttle
#

Yeah...

raw kernel
#

The curvy walls looks really handy. Wish I had that for some of my google maps I have made

#

We should take this to main channel

errant shuttle
#

@raw kernel I had a few minutes to test the latest version of the macro. The apply works, the remove does not. It fires and Warp Gate prompts for approval, but nothing happens. There are no errors or warnings in the console.

raw kernel
#

let me make sure I pushed the change to make that work

#

I see the issue, I missed the change on it for v10

errant shuttle
#

Another label vs name thing?

raw kernel
#

yep

#

check line 107 on your macro and you should see it say name instead of label

#

I will put that edit in my next pr into main

#

this line

warpgate.mutate(element,{embedded: {ActiveEffect: {"I Am The Firewall": warpgate.CONST.DELETE}}}, {}, {permanent: true,comparisonKeys: {ActiveEffect: 'name'}});
errant shuttle
#

Yeah, I found it... it didn't help.

Also, I noticed that AE doesn't have a name. Should description on 119, 142, 150, and 166 also be label?

raw kernel
#

no it should not.

#

this in your test server?

errant shuttle
#

No, I had an impromptu mini-session with a player tonight so I was trying it live.

raw kernel
#

I wonder if it is something with warp gate

#

the macro works on v11

#

let me stand up my v10 server and see what it is doing

errant shuttle
#

I'm on my test server now.