Is it possible for a macro to read from a text file?
Moderators: dorpond, trevor, Azhrei
Forum rules
Posting now open to all registered forum users.
Posting now open to all registered forum users.
Is it possible for a macro to read from a text file?
It would be most useful in setting up a large set of standardized NPCs and monsters as token files, but I see no evidence that it is possible (and I can see why it might not be).
Re: Is it possible for a macro to read from a text file?
I often put raw text in to a macro and read the text from that to parse through the info. Here's a code snippet to help:
This puts each line of text in to an array field.
Code: Select all
<!-- read in raw dialog -->
[H: EOL = decode("%0A")]
[H: buttonIndex = getMacroIndexes("rawDialog")]
[H: descriptions = json.fromList(getMacroCommand(buttonIndex),EOL)]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Is it possible for a macro to read from a text file?
That would be about 99% as good. Thanks. Should have thought of it myself. Is there a limit on how much text one can paste in at a time? (I'm guessing at least 64k, which is way more than I'd ever need, but one never knows.)
Re: Is it possible for a macro to read from a text file?
I've done a full spell library of 1600 entries. You problem occurs when you loop more than 1000 times because there is a limit to the loops in MT. You can get fancy and exceed that, but the simple way is to process only 1000 things per loop at a time.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools