gcs icon indicating copy to clipboard operation
gcs copied to clipboard

Prompting for replacement with double "@" in VTT-Notes field

Open crnormand opened this issue 2 years ago • 5 comments

I was trying to enter VTT Notes for a First Aid skill for Foundry:

["Target PC then click to aid"/hp +1d-3! @target p:[!/anim heal*blue*loop c *0.5 @self]

Which would do 2 things:

  1. It would create a button that would execute the /hp chat command using the @target parameter (which will send the command to the owner of that token, to give them the option to execute it).
  2. Execute an animation to show blue animation over the player's token if the skill check passes.

Unfortunately, the editor interprets the double "@" as a parameter to be swapped out.

I was wondering... could you check the text between the "@" and if it contains a space (or a character that would not normally be allowed in a tag, .e.g. "!", "[", etc.), treat it as regular text, and not perform a substitution?

crnormand avatar Sep 07 '22 20:09 crnormand

Unfortunately, substitution tags permit anything except another @ symbol between them, on purpose, so that the creator of the data can provide a prompt that has meaning. I could look into some sort of escape mechanism, though.

richardwilkes avatar Sep 07 '22 21:09 richardwilkes

That makes sense. When is this normally used? When you are asking for a skill or advantage name or something like that?

Could it be disabled just for the VTT notes field? I am wondering if that use case would apply to the vtt notes field.

crnormand avatar Sep 07 '22 22:09 crnormand

It triggers a prompt when you add something to the sheet which has them.

... and yes, we could just not look for them in the VTT Notes field, but that would potentially have severe drawbacks, as then you couldn't customize anything in that field properly when there should be substitution text supplied without manually doing so -- and often people won't even be aware that there is anything in there they need to edit.

richardwilkes avatar Sep 07 '22 22:09 richardwilkes

That was why I was wondering what the normal use case was.

I only know about using it for templates (which I haven't really used... I mean, I have been a user of a template, but I have never created one).

And if that was the primary use of that kind of substitution, then one could argue that it probably wouldn't need to happen on the vtt-notes field.

Just spitballin' (as we say in the south).

crnormand avatar Sep 07 '22 23:09 crnormand

I could add code to ignore an @ with a \ in front of it. You would then need to convert those on your side, though, from "@" to "@". At that point, it might make sense to just pick some other character for your syntax. I know you already have people using it, so that's not ideal... but since storing it in GCS is going to cause that headache anyway, it might be better to just pick something else and convert it on import into your current syntax. i.e. maybe tell them to use "~", so the above would become:

["Target PC then click to aid"/hp +1d-3! ~target p:[!/anim heal*blue*loop c *0.5 ~self]

in GCS and you'd swap those ~ out for @ on import into GGA... or if it isn't too disruptive, just allow ~ to work, too, then no conversion is needed on import.

richardwilkes avatar Oct 08 '22 00:10 richardwilkes

Reviewing this, I decided that there really shouldn't be a need to do substitution in the VTT Notes field, since those are really only there to make buttons in the VTT environment. So, the change I just pushed removes substitution processing for the VTT Notes field in all cases.

richardwilkes avatar Nov 06 '22 01:11 richardwilkes