Post by damooseneo on Aug 19, 2020 23:11:44 GMT
I'm cleaning up a lot of the work on my custom template and getting to a point I want to clean up some...annoying...elements after getting the functional things figured out. So, some questions
#1 - Best way to handle Factions & Icons
This is code I've used before, but it was always annoying but it was meant for me, never distribution, so I dealt with it. But I'm building something to share, so I'd like to fix this up if able.
I have this snippet in my text replace sequence:
- Keep the cursor at the end of the input; without the atom tag, it was always in the middle and that lead to weirdness. With the atom tag I can't be IN the tag, which helps, but now I'm on the left side of the atom tag, instead of the right/end.
- I want to match the plural; so say, for instance, a faction is "Knight." The script matches just fine, I get "Knight(Icon)" and all is good and right with the world. I type "Knights" and I get "Knight(Icon)s" and things are weird. I'd like to get "Knight(Icon)" and "Knights(Icon)" out of it. the faction_names() is a variable containing a string of factions; "Knight|Dragon|Wizard" and the like. (Typing this out I have an idea now, but since I'm here I might as well ask).
#2 - Adding text to the end of the text box
I explored this via keywords but even that was wonky. There's a few instances where a line of text should be appended to the end of the field; what will vary depending on the type of card, but solving the basic of "appending text to the end of the field" will solve any other answer for me. Adding a script that does input + string in the text filter doesn't seem to add anything.
#1 - Best way to handle Factions & Icons
This is code I've used before, but it was always annoying but it was meant for me, never distribution, so I dealt with it. But I'm building something to share, so I'd like to fix this up if able.
I have this snippet in my text replace sequence:
# Match Faction Name to bold
replace_rule(
match: faction_names(),
in_context: filter_context,
replace: "<atom-faction><b-auto>&</b-auto><sym-auto>&</sym-auto></atom-faction>"
) +
The "atom" is new, and helps tie everything together nicely and prevents some of the weirdness I had in my old code. But it finds any of my factions, gives them a bold tag AND adds the sym tag to display the faction's icon after the name. Two elements I'd like to see work are: - Keep the cursor at the end of the input; without the atom tag, it was always in the middle and that lead to weirdness. With the atom tag I can't be IN the tag, which helps, but now I'm on the left side of the atom tag, instead of the right/end.
- I want to match the plural; so say, for instance, a faction is "Knight." The script matches just fine, I get "Knight(Icon)" and all is good and right with the world. I type "Knights" and I get "Knight(Icon)s" and things are weird. I'd like to get "Knight(Icon)" and "Knights(Icon)" out of it. the faction_names() is a variable containing a string of factions; "Knight|Dragon|Wizard" and the like. (Typing this out I have an idea now, but since I'm here I might as well ask).
#2 - Adding text to the end of the text box
I explored this via keywords but even that was wonky. There's a few instances where a line of text should be appended to the end of the field; what will vary depending on the type of card, but solving the basic of "appending text to the end of the field" will solve any other answer for me. Adding a script that does input + string in the text filter doesn't seem to add anything.