Problem with encode(), forms and umlauten

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Problem with encode(), forms and umlauten

Post by CoveredInFish »

Plus ... usually learning a new syntax isnt all that hard - and thats (mostly) all you have to do. Programming and designing a framework will work very similar. Much easier to learn a new programming language than learn programming at all. At least it always felt so for me ...

Sure your knowledge of quirks, workarounds and hacks special to MTscript will be obsolete - but while that is somewhat sad - its actually A Good Thing(tm). :wink:

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Problem with encode(), forms and umlauten

Post by wolph42 »

booga wrote:
jfrazierjr wrote: Well.. you could have always stayed with just the simple macros without any complex scripting as it was around b50 or so.... It has always been know and communicated that the MTScript language was nothing more than a stop gap and would absolutely not be the long term approach for MapTool's future versions.
I guess I just missed the memo ;).

Well, that's no big deal. I love Maptool, I'm sure I'll keep using it in the future and promote it to my former countrymen.
+1

and i'll most likely too retire, that is ill stick with 1.3. It serves my purpose. I will always commend on progress and i surely understand the need to go with a new parser, but for me too, just too many hours have been spend on the current script.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Problem with encode(), forms and umlauten

Post by wolph42 »

wolph42 wrote:
booga wrote:
jfrazierjr wrote: Well.. you could have always stayed with just the simple macros without any complex scripting as it was around b50 or so.... It has always been know and communicated that the MTScript language was nothing more than a stop gap and would absolutely not be the long term approach for MapTool's future versions.
I guess I just missed the memo ;).

Well, that's no big deal. I love Maptool, I'm sure I'll keep using it in the future and promote it to my former countrymen.
+1

well... I did now this would happen around build 70 or so, but by then i already had spent too many hours in what i had, wasn't planning to wait a year or 2 for the new parser and had some hopes that maybe there would be a way to convert the old script to the new

if not then i'll most likely too retire, that is ill stick with 1.3. It serves my purpose. I will always commend on progress and i surely understand the need to go with a new parser, but for me too, just too many hours have been spend on the current script.

User avatar
booga
Dragon
Posts: 365
Joined: Fri Dec 14, 2007 9:00 am

Re: Problem with encode(), forms and umlauten

Post by booga »

Lee is working on a patch to address this lack of unicode support in MT 1.2 (my apologies if that's not the proper way to describe the symptoms of this issue). If you are using foreign characters (such as umlaut, french accens, special characters from other languages) and it is causing problems within your macros, please contact Lee my PM to provide him with specific examples of code that is causing problem.

Tielc
Cave Troll
Posts: 25
Joined: Wed Jul 16, 2014 10:41 pm

Re: Problem with encode(), forms and umlauten

Post by Tielc »

I suppose I am digging this up now too. I am writing a tool that pulls data out of hero lab to populate my tokens with properties and macros (similar to HL2MT). I have been running into issues when bringing over some of the text directly (from the character sheet) into a macro (form). It works as suggested by putting it into a property. However, I'm trying to understand, and to avoid other cases where I need to put them into properties how to properly resolve this.

Is this something I can modify in the launcher in 1.3b91 or b90? I don't see a specific setting there. Or do I have to modify the mt.cfg file? Likewise, while writing in .net and opening the file stream, I can chose an encoding method, is there one I should specify?

Finally, is there any disadvantage to keeping the character sheet in a Property and calling it from a Macro in terms of performance or filesize? Another alternative is also to use the NERPS version and save out the HTML file, and load it externally. Though, for some reason, I'm set on trying to make this all work within the standard builds.

Edit: I've since learned after digging into this a little more, my issue is actually the sequential characters "n't" is any text. So the words doesn't, wasn't, etc. cause the issue where the frame will not show. Here's a very simple example

Code: Select all

[frame("Test Frame"): {<html> <body>don't</body></html>}]
or
[frame("Test Frame"): {don't}]

User avatar
booga
Dragon
Posts: 365
Joined: Fri Dec 14, 2007 9:00 am

Re: Problem with encode(), forms and umlauten

Post by booga »

Is this something I can modify in the launcher in 1.3b91 or b90? I don't see a specific setting there. Or do I have to modify the mt.cfg file? Likewise, while writing in .net and opening the file stream, I can chose an encoding method, is there one I should specify?
With the b91 launcher opened (haven't tried with b90, could be the same), click on the Advanced tab. There is a small line that says "advanced java parameter." That's where you'd add the UTF information for example:

Code: Select all

 -Dfile.encoding="UTF-8"
Finally, is there any disadvantage to keeping the character sheet in a Property and calling it from a Macro in terms of performance or filesize? Another alternative is also to use the NERPS version and save out the HTML file, and load it externally. Though, for some reason, I'm set on trying to make this all work within the standard builds.
Saving the encoded cs in a token property works very well in my experience, and save loading time on complex character sheets. The only drawback is that it makes the token size larger, which could make upload/download time longer if the connected server and players do not have a fast internet connection. The reason behing that is when there is any change on a token (state, light, movement, orientation, propety, anything really), Maptool update the whole token on all the connected clients.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Problem with encode(), forms and umlauten

Post by aliasmask »

Try holding your output in a variable. One trick I use with funky raw text is to put it all in a macro and use getMacroCommand(getMacroIndexes(macroName)). Then I don't have to worry about messing with quotes or special characters to put the data in to a variable. Then use [r: output] to dump it to chat.

In your example, I would do this:

Code: Select all

[frame("Test Frame"): {[r: "<html> <body>don't</body></html>"]}]
The benefit of doing it this way also saves on stack size.

Tielc
Cave Troll
Posts: 25
Joined: Wed Jul 16, 2014 10:41 pm

Re: Problem with encode(), forms and umlauten

Post by Tielc »

Thanks, for the response. Any chance you saw my edit to what was causing the issue? The n't in the body of a macro causes it to just output to the chat window and not launch a frame.

Tielc
Cave Troll
Posts: 25
Joined: Wed Jul 16, 2014 10:41 pm

Re: Problem with encode(), forms and umlauten

Post by Tielc »

Sorry, reply came in before I was finished writing mine :) I like the idea of storing the macro itself. I'll definitely look into that.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Problem with encode(), forms and umlauten

Post by aliasmask »

Tielc wrote:Thanks, for the response. Any chance you saw my edit to what was causing the issue? The n't in the body of a macro causes it to just output to the chat window and not launch a frame.
IMO, this is a bug. The single quote shouldn't break the frame roll option, but it does. That's why the output should be put in to a statement rather than outside of one. The way the parser is looking at it is the open quote, in the statement (frame) is never closed. So, it just dumps it to the chat treating the whole thing a string.

Tielc
Cave Troll
Posts: 25
Joined: Wed Jul 16, 2014 10:41 pm

Re: Problem with encode(), forms and umlauten

Post by Tielc »

aliasmask wrote:Try holding your output in a variable. One trick I use with funky raw text is to put it all in a macro and use getMacroCommand(getMacroIndexes(macroName)). Then I don't have to worry about messing with quotes or special characters to put the data in to a variable. Then use [r: output] to dump it to chat.

In your example, I would do this:

Code: Select all

[frame("Test Frame"): {[r: "<html> <body>don't</body></html>"]}]
The benefit of doing it this way also saves on stack size.
I'm not quite sure I get what you meant by putting it into a Macro? Like create one macro button, then call that macro button from another?

Also, I'm still having issues with this text, by assigning it to a variable within the macro and using [r: Output], or using [r:"I put a lot of text here"].

This is some sample code from a character sheet I am pulling out of HeroLab

Code: Select all

[frame("Thorim Stonebreaker"): {[r:"<html><body>He has a long braided brown beard, flowing from his very unkempt hair. It's as though he could care little for his outward appearance, save his beard. The scale mail he wears, bears the mark of his clan, as does his Dwarven War Axe. They were gifts from his father, when he grew out of adolescent and joined the ranks of the other Dwarfs in the Clan’s Tunnel Watch.<br/></body></html>"]}]
That doesn't work, but again, as soon as I remove all the apostrophes, from the words it's and clan's it works. I think I'm going to stick to holding it in a Property.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Problem with encode(), forms and umlauten

Post by aliasmask »

Drop this in to your campaign to see what I'm talking about. Also, the above code when I put the getMacroIndexes inside getMacroCommand doesn't like that, so I separated those two.

The parser doesn't like the unicode single quote in the string when parsing the frame roll option.
View wrote:

Code: Select all

[H: name = "Thorim Stonebreaker"]
[H: index = getMacroIndexes(name,",")]
[H: output = getMacroCommand(index)]
[frame(name): {[r: output]}]
Thorim Stonebreaker wrote:

Code: Select all

<html><body>He has a long braided brown beard, flowing from his very unkempt hair. It's as though he could care little for his outward appearance, save his beard. The scale mail he wears, bears the mark of his clan, as does his Dwarven War Axe. They were gifts from his father, when he grew out of adolescent and joined the ranks of the other Dwarfs in the Clan’s Tunnel Watch.<br/></body></html>
Attachments
lib.Example.rptok
(52.07 KiB) Downloaded 37 times

Tielc
Cave Troll
Posts: 25
Joined: Wed Jul 16, 2014 10:41 pm

Re: Problem with encode(), forms and umlauten

Post by Tielc »

I know I'm coming back to this way later in life. However, today I learned that apostrophes (') can be replaced with their html code equivalents, ie. ' (for single quote) or &#8217 (for apostrophe). I was putting everything in properties, but I will probably pull a lot of those now that I know this works.

Post Reply

Return to “Macros”