Trying to create a macro that compares initiatives.
Moderators: dorpond, trevor, Azhrei
Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
-
- Cave Troll
- Posts: 52
- Joined: Tue Aug 04, 2009 2:42 am
Trying to create a macro that compares initiatives.
For the anima framework I am working on, I'm trying to compare the initiative of two tokens in the initiative screen. In the anima rules, if one person roles 150 higher on their initiative roll than the person they are attacking then the defending person is at a -90 to their defense roll. Currently, the defender person simply checks a box when defending when surprised. However, I'd like to automate everything I can, so I want to have the macro get the initiative values for both people and compare them, but all the initiative macros seem to only apply to the current token. Is there a way to retrieve the initiative value of a specific token from within a macro?
Re: Trying to create a macro that compares initiatives.
You can find all the initiative related functions under Initiative Function in the wiki. Wiki: getInitiativeList() will list all the tokens in the init panel along with related data.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Cave Troll
- Posts: 52
- Joined: Tue Aug 04, 2009 2:42 am
Re: Trying to create a macro that compares initiatives.
Hmmm... I've taken a look at the initiative functions already. I see what the getInitiativeList() does, but I don't think that will work, because I need the initiative of only the two tokens involved in the attack, the attacker and the defender. getInitiative() seems like what I want, but it only applies to the current token, it seems to me, which doesn't help me, because I need to get the initiative for two separate tokens. Am I missing something?
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Re: Trying to create a macro that compares initiatives.
umm yea... use a loop over all the initiative tokens and an "if" to compare which is current in the loop vs which is the defender until you get the right one.daveceaser wrote:Hmmm... I've taken a look at the initiative functions already. I see what the getInitiativeList() does, but I don't think that will work, because I need the initiative of only the two tokens involved in the attack, the attacker and the defender. getInitiative() seems like what I want, but it only applies to the current token, it seems to me, which doesn't help me, because I need to get the initiative for two separate tokens. Am I missing something?
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
-
- Kobold
- Posts: 13
- Joined: Fri Mar 23, 2012 4:45 am
Re: Trying to create a macro that compares initiatives.
I'd be tempted to use the getInitiative and switchToken. I tend to grab all the stats from the first token, then switch to the second token, grab all the stats I need. Do the calculations. Then switch to whichever token needs changing and apply the changes.
Code: Select all
[h:yourint=getInitiative()]
[h:switchToken(enemy)]
[h:emenyint=getInitiative()]
-
- Cave Troll
- Posts: 52
- Joined: Tue Aug 04, 2009 2:42 am
Re: Trying to create a macro that compares initiatives.
Just reporting that I used the switchToken command successfully. Thank you.