VIDEO EXAMPLE OF HOW TO USE
Last Updates:
- 11-25-18 - OP page rewrite
- 12-01-18 - Minor config.xml update
- 5-23-19 - MISSING APIs Folder (1:50 of video): The newer version 7.6.6 has an "autoComplete" folder under Notepad++ folder. Put maptool.xml there instead.
I like writing macros in my own text editor (notepad++) so I edit multiple macros at once. I put together some files in a zip to modify notepad++ to include function descriptions, special coloring and code collapsing. The config files include all the functions from the wiki including the nerps only functions up to 11-25-18. Those are listed as 1.4.1.9 and 1.4.2.0 in the wiki.
README - Notepad++ Config Files
Code: Select all
After extracting the Notepad++ Config Files to a new folder,
copy files to these locations:
C:\Users\[YOUR NAME]\AppData\Roaming\Notepad++
AppData.Roaming.Notepad++ files, not folder
Files Included:
config.xml (optional) - has my common settings
functionList.xml (optional) - contains regex to display function list for Notepad++ feature
shortcuts.xml - Has Ctrl-Shift-C macro for copying a function block from Notepad++ to RPEdit
userDefineLang.xml (required) - contains the color coding of functions and variables for MapTool
32bit version: C:\Program Files (x86)\Notepad++\plugins\APIs
64bit version: C:\Program Files\Notepad++\plugins\APIs
maptool.xml
In Notepad++ you can set the auto-completion for function or keyword or use the hot keys.
Ctrl-Enter: Show list of keywords and functions
Ctrl-Shift-Space: After the "functionName(" show the function details.
You will need admin privileges to paste maptool.xml.
?????????????????????????????????????????????????????????????????????????????????
For questions visit: http://forums.rptools.net/viewtopic.php?f=20&t=25531#p255459
?????????????????????????????????????????????????????????????????????????????????
This process works for a full installation of Notepad++ from
http://notepad-plus-plus.org/ Notepad++ 7.5.9 released Oct 15 2018
If you didn't create a shortcut, you can go to
C:\Program Files\Notepad++\notepad++.exe, right click and pin to taskbar.
RPEdit
I use the RPEdit token to copy/paste the macro code to and from MapTool and notepad++. Read more about RPEdit syntax here.
README - RPEdit (macro editor assistant)
Code: Select all
(Note: Lib tokens should always be on the token layer and it's recommended that they be on their own map and hidden from players. But these are just recommendations.)
How to use:
* Drop token on to map.
* Run onCampaignLoad on this token
* Drag "Edit Token" macro to Campaign Window.
* Select a token to edit macro and click Edit Token macro
* Click Load and then Okay
* Copy/paste code to plain text editor like Notepad++
Format for macros in plain text editor:
@@ @macroName
your code here...
!!
The @PROPS@ line sets other macro button attributes but isn't needed when creating new macros.
##### WARNING #####
If you manually edit a macro or move a macro on token,
you need to run Edit Token again.
##### WARNING #####
If not, then you may end up overwriting the wrong macros. No worries though, you can copy/paste all the macros from your editor to update properly after reloading with Edit Token.
Lib:Token
And for any project I recommend having a dedicated lib token for all your macros. This lib token has basic debugging tools, added output capabilities and makes all your macros in easy-to-use UDFs.
README - Lib Token (UDFs and Debugging)
Code: Select all
(Note: Lib tokens should always be on the token layer and it's recommended that they be on their own map and hidden from players. But these are just recommendations.)
Benefits to using this lib token:
* All your macros have UDFs created for them. Easier to use and more functional than using macro().
* Output using the UDFs is suppressed so comments aren't spammed to chat as blank lines.
* Custom output() function looks like the normal chat output but labels token with player name.
* Special output() targets include "owner" and "other" for gm and player output separation.
* Includes very basic debugging tools to watch() variables, pause() execution and label() code progress.
How to use: onCampaignLoad
* It's recommended that you customize your token to represent the code you're writing.
* A lib token name always begins with lib:
* Edit onCampaignLoad and change the line where prefix = "xx.lib." to something else to be customized to your project. More in comments of macro.
* After making your changes, in order for them to take effect you need to run onCampaignLoad.
How to use: output()
* By default the functions created from the macros blocks normal output.
* Send output to chat window with output() function.
[H: output(chatText)]
[H: output(chatText,targets)]
[H: output(chatText,targets,token)]
* chatText is the html output you're sending to the chat
* targets can be any player name, all, gm, self, owner, other, -gm, -self (see comments for details). If targets is blank "" then it defaults to all. But if it is "all,-gm" where the result is blank, then no output is sent.
* token is the token name or id of a token on the current map. If token is blank "" then chat is posted as current player. If token isn't passed, then it's defaulted to currentToken, the currently impersonated token.
How to use pause(), watch() and label():
pause() - pause exectution of code and display watched variables.
Variables watched are passed by their name, so you need to
put quotes around the names like so,
[pause("var1","obj1","array1")]
watch() - much like pause but it doesn't stop execution.
when your code stops, it will display the final values of
the watched variables.
[watch("var1","obj1","array1")]
label() - like the watch function, this will post when execution stops.
label takes ONE argument and it is posted in a popup. It's used to
show that you made it to that point in the code with a popup. I often
just put a progressive set of numbers.
[label(1)] [label("Macro Name")]
I recommend reading the wiki on strformat. It's your bread and butter for properly formatting your output to be sent to the chat. Also, saving output to a variable saves on system resources and bypasses many stack overflow issues.
If you find any errors or think of something really needed on this token please let me know down in the comments.
keywords: amsave notepad rpedit starter