Help with macros calling on macros, and lib tokens.
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Help with macros calling on macros, and lib tokens.
Ok, so I have a few general questions, which after they get answered, I may have some more.
My first question is about having a macro call upon another macro. First, is this possible? Second, would this help alleviate problems with stack overflow on my larger macros, or would it make it worse? (Basically does splitting a macro up into smaller parts make it more efficient, or no?)
My second question is about lib tokens. I have read that they help keep tokens light, but I don't know how or why (layman's terms please, I don't know squat about java or coding xD). Would this also help with stack overflows, or is it unrelated?
My first question is about having a macro call upon another macro. First, is this possible? Second, would this help alleviate problems with stack overflow on my larger macros, or would it make it worse? (Basically does splitting a macro up into smaller parts make it more efficient, or no?)
My second question is about lib tokens. I have read that they help keep tokens light, but I don't know how or why (layman's terms please, I don't know squat about java or coding xD). Would this also help with stack overflows, or is it unrelated?
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
Re: Help with macros calling on macros, and lib tokens.
Yes and yes, check out [macro:] and user defined functions
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
Ok, still trying to work out how I'm gonna split up my macros, but I have one big question, does each of my characters/tokens need their own lib token, or can they share?
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
Re: Help with macros calling on macros, and lib tokens.
You need just one library, and every token (including another library) can refer to it.
You may want more libraries for organizative purposes (such as a library for common functions, one for spells, one for inventory system, etc.), but that's a different matter.
You may want more libraries for organizative purposes (such as a library for common functions, one for spells, one for inventory system, etc.), but that's a different matter.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
Ok, so I could have one library for properties, and each individual PC, when a macro refers to the Library, would pull up their own set of properties, not just a single set? (Sorry if this is a bit repetitive, but I just want to be 100% I got the just of it).
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
Re: Help with macros calling on macros, and lib tokens.
nah I get the feeling you're not quite getting it, but mayhep I just don't understand you.Shadowfireomega wrote:Ok, so I could have one library for properties, and each individual PC, when a macro refers to the Library, would pull up their own set of properties, not just a single set? (Sorry if this is a bit repetitive, but I just want to be 100% I got the just of it).
basically tokens and lib:tokens are EXACTLY the same in every regard but one! Where tokens are only accessible when you are on the map where they are, lib:tokens are accessible from anywhere.
(the inner nerd urges me to point out that there are some little extra differences, but not important right now)
In general use this boils down that:
tokens have properties like strength, toughness, intelligence etc. Some have macros on them (but I disbanded that long ago)
lib:tokens have properties like startOnMap, npcsDoNoCrit, weaponLib, armourLib, aka: settings, armoury database etc. And they have the 'general' macros. In my case they have ALL macros.
As Irrlicht pointed out, its usual to have multiple libs. In my framework I have
lib:DH which is contains all the settings and the macro
lib:Compendium which contains the database with weapons, armour, gear etc.
lib:OnTokenMove (aka: the bag of tricks) which contains all bag of tricks macros
lib:EventMacros (belongs to the bag of tricks) which contains all settings and 'event macros'
and then a couple more.
HTH.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
Yea, I'm just getting more confused xD
The way I have my stuff set up is that there are many properties on each token, basically most relevant data from a character sheet. Each token can store up to 5 weapons, each weapon can be changed out with a macro, but the players have to put in all the relevant info, such as enhancement bonuses, the name, crit range, crit mod and so forth, and they are stored on the token for later use by my attack macro. There are properties as well that store their attributes, skills, and calculations for their AC, HP and such. If I made a lib token for these properties, would I have to do one per token, or would one lib token store all the info for all the tokens? Or am I 100% misunderstanding what a lib token does?
The way I have my stuff set up is that there are many properties on each token, basically most relevant data from a character sheet. Each token can store up to 5 weapons, each weapon can be changed out with a macro, but the players have to put in all the relevant info, such as enhancement bonuses, the name, crit range, crit mod and so forth, and they are stored on the token for later use by my attack macro. There are properties as well that store their attributes, skills, and calculations for their AC, HP and such. If I made a lib token for these properties, would I have to do one per token, or would one lib token store all the info for all the tokens? Or am I 100% misunderstanding what a lib token does?
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
Re: Help with macros calling on macros, and lib tokens.
currently you are using properties on the tokens exactly what they should be used for. Its possible to move them to a lib:token but then indeed you would need a lib:token per token.Shadowfireomega wrote:Yea, I'm just getting more confused xD
The way I have my stuff set up is that there are many properties on each token, basically most relevant data from a character sheet. Each token can store up to 5 weapons, each weapon can be changed out with a macro, but the players have to put in all the relevant info, such as enhancement bonuses, the name, crit range, crit mod and so forth, and they are stored on the token for later use by my attack macro. There are properties as well that store their attributes, skills, and calculations for their AC, HP and such. If I made a lib token for these properties, would I have to do one per token, or would one lib token store all the info for all the tokens? Or am I 100% misunderstanding what a lib token does?
I know that aliasmask created a system where properties of tokens are stored on lib:tokens, but no clue how that works.
It is however very uncommon to it this way and a LOT of hassle!!! So i would strongly advise against it.
you normally use lib tokens to store macros on and 'general' properties (like settings and databases)
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
Ok, now I gotcha, thanks for the help!
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
So, after getting that worked out, I have decided how to split up my macro, but I seemed to have done it wrong. Please tell me if I understand this correctly:
When you use the [macro(macro_name@location)] at the end of the first macro, pointed at the second macro, you will run the second macro and the second macro will be able to call upon the variables and information in the first macro, and putting it at the end of the second macro to call the third will allow the third macro to recall the info from the first two?
When you use the [macro(macro_name@location)] at the end of the first macro, pointed at the second macro, you will run the second macro and the second macro will be able to call upon the variables and information in the first macro, and putting it at the end of the second macro to call the third will allow the third macro to recall the info from the first two?
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
Re: Help with macros calling on macros, and lib tokens.
Yes, but for each additional macro you call you must remember to append all the necessary variables that it is going to elaborate from previous macros. So, remember to append all that is required just before calling the next macro.
Don't know if that's the actual problem you're having, just reminding it for safety.
Don't know if that's the actual problem you're having, just reminding it for safety.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
Yea, you lost me at append... So I am going to guess this is my problem. How does one append?
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
Re: Help with macros calling on macros, and lib tokens.
I'm in a hurry, so pardon the quick answer, but look at the examples using json.append() in the [macro:] wiki page.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
Ok, I think I got it, tell me if this is correct:
I have the following variables in my macro: roll,roll2,wep,wepd
to pass them along to the next macro, I'd do something like this at the end of the first macro:
PT2 being the macro on Lib:Test.
Then in the PT2 macro, I'd need to start with something like this:
Is this correct? (I am working on doing all parts like this, so I'll hopefully know if I did it right, but if this is wrong, hopefully I'll have an answer either before I finish, or soon thereafter)
Next question being, say I don't need roll2 in PT2, but I need it in PT3, could I just leave it out of the beginning of PT2, and keep everything else the same, or would I have to make the wep line instead of , and can I pull data directly from PT1 to PT3, or would I have to put all of the info in PT2 as well?
I have the following variables in my macro: roll,roll2,wep,wepd
to pass them along to the next macro, I'd do something like this at the end of the first macro:
Code: Select all
[passedVars=json.append("",roll,roll2,wep,wepd)]
[h:macro("PT2@Lib:Test")]
Then in the PT2 macro, I'd need to start with something like this:
Code: Select all
[ roll = json.get( PT1.args, 0 )]
[ roll2 = json.get( PT1.args, 1 )]
[ wep = json.get( PT1.args, 2 )]
[ wepd = json.get( PT1.args, 3 )]
Next question being, say I don't need roll2 in PT2, but I need it in PT3, could I just leave it out of the beginning of PT2, and keep everything else the same, or would I have to make the wep line
Code: Select all
[wep=json.get(PT1.args, 1)]
Code: Select all
[ wep = json.get( PT1.args, 2 )]
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
- Shadowfireomega
- Giant
- Posts: 218
- Joined: Thu Dec 23, 2010 12:12 am
- Location: San Antonio, Texas
Re: Help with macros calling on macros, and lib tokens.
Ok, so I have fiddled around with it, and I seem to have come to a dead end, I fixed a few things I saw wrong with it (or so I hope) and cannot seem to figure out what is wrong, so here is everything.
This one is specifically an attack macro that I have been adding onto and tweaking for a while, but when I started a new group, one of my players cannot seem to get it to go without a stack overflow, so I am trying to split it up in three pieces to see if that helps.
Part 1, macro called Selection:
This part gets the d20 rolls, and allows the player to select one of their weapons, dragging the props from their token.
Part 2, Macro called Variables:
This part figures out crit, damage mods, attack mods, basically everything that will go into the attack, damage, and crit rolls.
Part 3, Attack:
This portion is where the attack, damage, and crit are calculated and reported.
I get the following error when I run it:
Error in body of roll.
Statement options (if any): macro("Variables@Lib:Test")
Statement Body : passedVars
I have no idea what I am doing wrong.
All three portions of the macro are on the token "Lib:Test"
This one is specifically an attack macro that I have been adding onto and tweaking for a while, but when I started a new group, one of my players cannot seem to get it to go without a stack overflow, so I am trying to split it up in three pieces to see if that helps.
Part 1, macro called Selection:
Spoiler
Code: Select all
[h:h=0] <!-- Read the widened crit range portion-->
<!-- get choice by position -->
[H: listProps = json.append("","wep1","wep2","wep3","wep4","wep5")]
[H: listValues = json.append("",wep1,wep2,wep3,wep4,wep5)]
[H: abort(input(strformat("choice|%s|Enter Choice|LIST",json.toList(listValues))))]
[H: propChosen = json.get(listProps,choice)]
[H: propValue = eval(propChosen)]<!--Asks what pre-filled weapon is being used-->
<!--Attack rolls, I place them highest, cause I never know where I will plug in the values-->
[h:roll=d20] <!--I define roll here so I can use it to show base, unmodified rolls.-->
[h:roll2=d20]<!--This is for a second attack roll, most likely for a critical threat.-->
<!--Below here it pulls the data from the chosen weapon and gives each a variable that we will use later on in attacks, this is what enables us to use the finite input instead of making individual macros per weapon-->
[h, switch(propchosen), code:
case "wep1":
{
[wep=wep1]
[wepd=Wep1D]
[wept=Wep1T]
[weph=Wep1H]
[wepdt=Wep1DT]
[wepae=Wep1AE]
[wepde=Wep1DE]
[wepcm=Wep1CM]
[wepcr=Wep1Cr]
[wepedd=Wep1EDD]
[wepedt=Wep1EDT]
[wepecd=Wep1ECD]
[wepect=Wep1ECT]
};
case "wep2":
{
[wep=Wep2]
[wepd=Wep2D]
[wept=Wep2T]
[weph=Wep2H]
[wepdt=Wep2DT]
[wepae=Wep2AE]
[wepde=Wep2DE]
[wepcm=Wep2CM]
[wepcr=Wep2CR]
[wepedd=Wep2EDD]
[wepedt=Wep2EDT]
[wepecd=Wep2ECD]
[wepect=Wep2ECT]
};
case "wep3":
{
[wep=Wep3];
[wepd=Wep3D];
[wept=Wep3T];
[weph=Wep3H];
[wepdt=Wep3DT];
[wepae=Wep3AE];
[wepde=Wep3DE];
[wepcm=Wep3CM];
[wepcr=Wep3CR];
[wepedd=Wep3EDD];
[wepedt=Wep3EDT];
[wepecd=Wep3ECD];
[wepect=Wep3ECT]
};
case "wep4":
{
[wep=Wep4];
[wepd=Wep4D];
[wept=Wep4T];
[weph=Wep4H];
[wepdt=Wep4DT];
[wepae=Wep4AE];
[wepde=Wep4DE];
[wepcm=Wep4CM];
[wepcr=Wep4CR];
[wepedd=Wep4EDD];
[wepedt=Wep4EDT];
[wepecd=Wep4ECD];
[wepect=Wep4ECT]
};
case "wep5":
{
[wep=Wep5];
[wepd=Wep5D];
[wept=Wep5T];
[weph=Wep5H];
[wepdt=Wep5DT];
[wepae=Wep5AE];
[wepde=Wep5DE];
[wepcm=Wep5CM];
[wepcr=Wep5CR];
[wepedd=Wep5EDD];
[wepedt=Wep5EDT];
[wepecd=Wep5ECD];
[wepect=Wep5ECT]
}
]
[passedVars=json.append("",roll,roll2,wep,wepd,wept,weph,wepdt,wepae,wepde,wepcm,wepcr,wepedd,wepedt,wepecd,wepect)]
[macro("Variables@Lib:Test"):passedVars]
Part 2, Macro called Variables:
Spoiler
Code: Select all
[ roll = json.get( macro.args, 0 )]
[ roll2 = json.get( macro.args, 1 )]
[ wep = json.get( macro.args, 2 )]
[ wepd = json.get( macro.args, 3 )]
[ wept = json.get( macro.args, 4 )]
[ weph = json.get( macro.args, 5 )]
[ wepdt = json.get( macro.args, 6 )]
[ wepae = json.get( macro.args, 7 )]
[ wepde = json.get( macro.args, 8 )]
[ wepcm = json.get( macro.args, 9 )]
[ wepcr = json.get( macro.args, 10 )]
[ wepedd = json.get( macro.args, 11 )]
[ wepedt = json.get( macro.args, 12 )]
[ wepecd = json.get( macro.args, 13 )]
[ wepect = json.get( macro.args, 14 )]
<!--Damage rolls for crit workout, right under the weapon macros so they can be applied right away-->
[h:dmg=eval(wepd)]<!--Grabs the die representitive in the wepdmg for respective weapon and rolls it-->
[h:dmg2=eval(wepd)]<!--This is for 2x crit-->
[h:dmg3=eval(wepd)]<!--This is for 3x crit-->
[h:dmg4=eval(wepd)]<!--This is for 4x crit-->
<!--Thanks to starman for the next two lines, he crashed down 40+ lines into these two.-->
<!--Below here is a workout for widened critical range. The crit range of the hit equals 21-roll, if the weapons is equal or greater, it adds +1 to H, later triggering the crit damage calculations and text output. H resets at beginning and end of macro.-->
[h:CritR=21-roll]
[h,if(wepcr>=critr):H= H+1]
<!--Below here are some values that will put into effect some of the 3.5 rules, such as what damage applies to what attacks-->
[h, switch(wept), code:
case "Melee":
{
[AAB=StrMod] <!--AAB is Attribute Attack Bonus-->
[ADB=StrMod] <!--ADB is Attribute Damage Bonus-->
[hmod=1]
};
case "Thrown":
{
[AAB=DexMod]
[ADB=StrMod]
[hmod=2]
};
case "Ranged":
{
[AAB=DexMod]
[ADB=0]
[hmod=2]
}
]
<!--This below accounts for the 1.5 weapon damage when using a 2 handed weapon or a 1 handed weapon in 2 hands-->
[h,switch(hmod),code:
case "1":
{
[if(weph==2):ADB=floor(StrMod*1.5);ADB=StrMod]
};
case "2":
{
["blank"]
}
]
[h, switch(wepcm):
case "2": critd=dmg2;
case "3": critd=dmg2+dmg3;
case "4": critd=dmg2+dmg3+dmg4]
[passedVars=json.append("",dmg,aab,adb,critd,roll,roll2,wep,wepdt,wepae,wepde,wepcm,wepedd,wepedt,wepecd,wepect)]
[h, macro("Attack@Lib:Test":passedVars)]
Part 3, Attack:
Spoiler
Code: Select all
[ dmg = json.get( macro.args, 0 )]
[ aab = json.get( macro.args, 1 )]
[ adb = json.get( macro.args, 2 )]
[ critd = json.get( macro.args, 3 )]
[ roll = json.get( macro.args, 4 )]
[ roll2 = json.get( macro.args, 5 )]
[ wep = json.get( macro.args, 6 )]
[ wepdt = json.get( macro.args, 7 )]
[ wepae = json.get( macro.args, 8 )]
[ wepde = json.get( macro.args, 9 )]
[ wepcm = json.get( macro.args, 10 )]
[ wepedd = json.get( macro.args, 11 )]
[ wepedt = json.get( macro.args, 12 )]
[ wepecd = json.get( macro.args, 13 )]
[ wepect = json.get( macro.args, 14 )]
<!--Now on to the actual attack!-->
You unleash your [R:wep]!<br>
You roll a [t:roll] for a confirmed hit against AC:[t: roll+AAB+BAB+WepAE+ItemAttackModifier+SizeMod+FeatAttackModifier+MiscAttackModifier]<br>
[r, switch(h), code:
case "0":
{
[h:"blank"]
};
case "1":
{
[r:"You land a critical hit against AC:"]
[t:roll2+BAB+AAB+WepAE+ItemAttackModifier+FeatAttackModifier+MiscAttackModifier]
[r:"<br> for"]
[t:dmg+CritD+((ADB+WepDE+ItemDamageModifier+FeatDamageModifier+MiscDamageModifier)*wepcm)]
[r: wepdt]
[r:"damage! OR <br>"]
}
]
For non-crit damage total of [t:dmg+ADB+WepDE+ItemDamageModifier+FeatDamageModifier+MiscDamageModifier] [t:wepdt] damage!
[h,if(wepedd==0):Extra=0; Extra=1]
[t,switch(extra),code:
case "0":
{
[h:"blank"]
};
case "1":
{
[r:"<br>and an extra"]
[t:eval(wepedd)]
[T:wepedt]
[r:" damage"]
}
]
[h,if(wepecd==0):"";h=h+1]<!--What I did here is if you have any extra weapon critical dice (from a burst special effect per se) it adds another 1 to h, only activating the extra dice if you have them AND if you roll a crit.-->
[h,if(h==2):ExtraC=1; ExtraC=0]
[r, switch(ExtraC), code:
case "0":
{
[h:"blank"]
};
case "1":
{
[r:"<br>and an extra"]
[t:eval(wepecd)]
[r:wepect]
[r:" critical damage"]
}
]
[h:h=0]
I get the following error when I run it:
Error in body of roll.
Statement options (if any): macro("Variables@Lib:Test")
Statement Body : passedVars
I have no idea what I am doing wrong.
All three portions of the macro are on the token "Lib:Test"
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros