Growlly's Totally Noob Questions about Macros
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Re: Growlly's Totally Noob Questions about Macros
Are you trying to translate to or from s textarea? What is your input source, a form input? The form input for ; is a bit wonky as is a couple of other characters. The best way to see what it is actually passing is to dump the variable after it's passed. I don't recall, but I think it's something like ;;. Also, when trying to replace the ; or reverse the process the order of operation is important so as to not mess up the other replace lines.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Growlly's Totally Noob Questions about Macros
It's basically your notes code. Anytime a semi-colon is used when entering notes, upon reopening it became: ;aliasmask wrote:Are you trying to translate to or from s textarea? What is your input source, a form input? The form input for ; is a bit wonky as is a couple of other characters. The best way to see what it is actually passing is to dump the variable after it's passed. I don't recall, but I think it's something like ;;. Also, when trying to replace the ; or reverse the process the order of operation is important so as to not mess up the other replace lines.
I checked the order of operations and that was it. The replace code had to be added first in the more completed code you provided later (you might want to add it to your post).
So, this works:
Code: Select all
[H, if(! json.isEmpty(notes)), code: {
[h: notes = replace(notes,";",";")]
[H: notes = replace(notes,"&","&")]
[H: notes = replace(notes,"\\\\","\")]
[H: notes = replace(notes,"<","<")]
[H: notes = replace(notes,"/","/")]
[H: notes = replace(notes,"[\$]","$")]
};{}]
Thanks for the help.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Growlly's Totally Noob Questions about Macros
If you're using RPEdit this line will not translate correctly:
[h: notes = replace(notes,";",";")]
The reason I write:
[h: notes = replace(notes,"&#"+"59",";")]
Is because the form input will translate the literal ; back to ; so it will read as
[h: notes = replace(notes,";",";")]
after you import/export the macro code.
[h: notes = replace(notes,";",";")]
The reason I write:
[h: notes = replace(notes,"&#"+"59",";")]
Is because the form input will translate the literal ; back to ; so it will read as
[h: notes = replace(notes,";",";")]
after you import/export the macro code.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Growlly's Totally Noob Questions about Macros
Noted. I was using it in your notes code (which I quoted above). Both ways work in that use case... but I'll switch to the method you use with RPEdit for consistency.aliasmask wrote:If you're using RPEdit this line will not translate correctly:
[h: notes = replace(notes,";",";")]
The reason I write:
[h: notes = replace(notes,"&#"+"59",";")]
Is because the form input will translate the literal ; back to ; so it will read as
[h: notes = replace(notes,";",";")]
after you import/export the macro code.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Growlly's Totally Noob Questions about Macros
If you're not outputting to a textarea, then you don't need all those conversions. Also, I would only save the original input text however you get that. That little snippet of code is from my RPEdit drop-in where I save and load from a textarea box.
There is another lib token (Lib:msg_mngr) that I didn't write but I made some updates to. It's in need of some updates and afaik is not 100% functioning.
For my own in game notes I have lib token called lib:dialog. It's integrated with my framework so it's not a standalone drop-in but instead of a dialog it uses the input() function. That's because I choose which dialog to post to chat. Output to the input() function needs it's own set of conversions as well.
So, breaking it down there are 3 main ways to get input. First from a text box using the input() function, another from textarea using a <form> and lastly some like using a token's notes field. How are you entering your text? The token's notes field and textarea are very similar but have a couple of variations.
For output, you can output to chat, dialog or frame which are all essentially the same with the exception of using a style sheet which can't be done in chat. It's just standard 3.1 HTML. You can also output using the input() function. There are certain characters that need to be converted if to be displayed in HTML. For example, if inputting from textarea the CRLF need to be converted to <BR>. Also, the < symbol needs to be changed to an HTML entity <. That covers 99% of the conversion for HTML output. All those special characters I use for the textarea like changing & to & is to avoid mixed text from accidentally converting it to something else. Same is true for all the other characters converted. Things get tricky if you decide to mix plain text with html before converting.
There is another lib token (Lib:msg_mngr) that I didn't write but I made some updates to. It's in need of some updates and afaik is not 100% functioning.
For my own in game notes I have lib token called lib:dialog. It's integrated with my framework so it's not a standalone drop-in but instead of a dialog it uses the input() function. That's because I choose which dialog to post to chat. Output to the input() function needs it's own set of conversions as well.
So, breaking it down there are 3 main ways to get input. First from a text box using the input() function, another from textarea using a <form> and lastly some like using a token's notes field. How are you entering your text? The token's notes field and textarea are very similar but have a couple of variations.
For output, you can output to chat, dialog or frame which are all essentially the same with the exception of using a style sheet which can't be done in chat. It's just standard 3.1 HTML. You can also output using the input() function. There are certain characters that need to be converted if to be displayed in HTML. For example, if inputting from textarea the CRLF need to be converted to <BR>. Also, the < symbol needs to be changed to an HTML entity <. That covers 99% of the conversion for HTML output. All those special characters I use for the textarea like changing & to & is to avoid mixed text from accidentally converting it to something else. Same is true for all the other characters converted. Things get tricky if you decide to mix plain text with html before converting.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools