Most of it is what I created for standard lib tokens. It has some debugging tools and utility functions I use. onCampaignLoad makes all the macros on the lib token in to UDF or user defined functions. (see Wiki: defineFunction()) So, the macro "addWeapon" can be called with a prefix which I defined as "am.sg." which are my initials and sg for sg1 so I can make sure the functions are unique to this lib token. So, to call the addWeapon macro insteald of using [macro:] I just referenced it by am.sg.addWeapon(). That's all you really need to know about onCampaignLoad.
The debug functions pause, watch and label help to look at variables as you are running the macros to see if you are dealing with the proper data. pause() pauses the execution when it hits the line where it's inserted, watch() prints a frame but continues with execution and label prints a frame with a label you specify. The format to use is am.sg.pause("varName1","varName2"), am.sg.watch("varName"), am.sg.label("label") and am.sg.label(1). The varNames must be in quotes and the labels just print to screen so you know the last executed line in code before a crash.
The output function allow you to send output to the chat screen. This is needed because all output is suppressed in the functions. It also adds another layer of control adding "owner" and "other" as options for output targets. owner is anyone with token ownership and other is everyone else. Good for having output only the gm can see while showing everyone else different output. For me, I usually have a gm tooltip that the players can't see. By specifying other for a second output, the gm doesn't have to see double the output.
deferFunction is just a utility function I came up with to break in the middle of a macro to run another macro.
Function for this lib will include
addWeapon() - adds the weapon data to a json array so you can have an unlimited number of weapons
editWeapon() - allows you to change any weapon in the list of weapons. I'll probably include a delete option here.
setMainWeapon() - takes a weapon from the weapon list and makes it your primary. So, when you click attack it uses the main weapon. I'm not sure of the mechanics of your game and using multiple weapons so we'll just start off with having only 1 active weapon.
weaponAttack() - uses the main weapon for an attack. Again, don't know the mechanics, so it'll do a full weapon attack, but it's easy to add an option to only make the first attack when there are multiple attacks.
I'm not going to go any further beyond this with the coding. It should give a nice base to build your own functions. I do recommend using notepad++ or similar editor in conjunction with my RPEdit drop-in token to quickly edit macros on a token. I have some mods specifically for notepad++ in my signature that makes the IDE easier to read, gives tooltips on functions and copies single macro blocks easily for use with RPEdit.
You learn best by figuring this stuff out on your own, so I don't want to do all the work for you.
Help with weapon attack macro
If you have searched the other User Creations subforums and an answer to your question has not been found, please post here!
Moderators: dorpond, trevor, Azhrei, Gamerdude
Re: Help with weapon attack macro
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Return to “Requests for HELLLLP!”
Jump to
- General
- ↳ Announcements
- ↳ Ideas for New Applications
- ↳ General Discussion
- ↳ Developer Notes
- ↳ Java Programming Info
- ↳ User Creations
- ↳ Requests for HELLLLP!
- ↳ Tilesets, Token Libraries, and Complete Maps
- ↳ Token Libraries
- ↳ Tilesets/Graphics for Map-making
- ↳ Complete Maps
- ↳ Campaign Frameworks
- ↳ D&D 5e Frameworks
- ↳ D&D 4e Frameworks
- ↳ D&D 3.5/Pathfinder 1e Campaign Macros
- ↳ D&D 3.5 & PF1e Framework
- ↳ Shadowrun 4e Frameworks
- ↳ Savage Worlds Frameworks
- ↳ Published Module Support
- ↳ Tutorials
- ↳ Graphics, Images, Tokens, Maps
- ↳ Drop-In Macros and Scripts
- ↳ Campaign Frameworks
- ↳ Drop-In Macro Resources
- ↳ Links & External Resources
- ↳ Looking For Group
- ↳ "Living" Campaigns
- ↳ Dungeons and Dragons
- ↳ Savage Worlds
- ↳ WoD
- ↳ Wargaming
- ↳ Documentation Requests/Discussion
- ↳ Session Report-Back
- Tools
- ↳ MapTool
- ↳ How To
- ↳ Macros
- ↳ Feature Requests
- ↳ Resolved
- ↳ Bug Reports
- ↳ Resolved
- ↳ WIP - User FAQ
- ↳ Testing
- ↳ MapTool 1.4
- ↳ TokenTool
- ↳ DiceTool
- ↳ InitiativeTool
- ↳ CharacterTool
- ↳ Support: d20 D&D
- ↳ Support: D&D 4e
- ↳ Support: Hero System
- ↳ Support: Savage Worlds
- ↳ Support: GURPS
- Other
- ↳ RPTools Sightings
- ↳ Running Campaigns
- ↳ Thiera's College of Adventurers
- ↳ Age of Might
- ↳ Scales of War
- ↳ Renwold
- ↳ Dead Men Walking
- ↳ Dark Sun - 4th Edition
- ↳ Warhammer Fantasy Roleplay
- ↳ Return of Uchly Namen
- ↳ Insert Campaign Here
- ↳ Antium
- ↳ The Mystic Moon
- ↳ World of Lagal
- ↳ GangerRun
- ↳ FB Scales of War
- ↳ Sellswords of Eberron
- ↳ Archive
- ↳ Orbs of Chaos
- ↳ World of Omegus
- ↳ Keep on the Shadowfell - 4E
- ↳ Rise of the Runelords
- ↳ Aurith In The Age Of Steam
- ↳ Widdershins
- ↳ Nos's Pathfinder Campaign
- ↳ Falcons Hollow
- ↳ Verwirrte Welten
- ↳ With it or on it
- ↳ Starter Set - Jeff