Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Need some help with advanced macro

Hi, I'm playing a campaign that allows Psionics... Now I wish to make a macro that implements the Power Point Augmentation system... So I can create an If, Then, Else macro that outputs either a 0 or an 1, but I'm having trouble translating the 0/1 into a different function, let's say a different Power/Spell description... If anyone is able to give me some tips on how to do this or if it is even possible, it is welcome :D Cheers, Casper
It sounds like you've got an output and want to include that output into a follow-up command.  I'd also really like to be able to do that. But out of curiosity, how do you get the If/Then statement to work?
1446455639
Ziechael
Forum Champion
Sheet Author
API Scripter
I'm not 100% i'm following the full complexity of what you are wanting to achieve but as long as you are wanting to use the same value throughout a macro you could do with this a query, or a drop down query: ?{Augmented (1 for yes)?|0} Is an example of a normal query that allows the user to define the output, in this case defaulting to 0 but can be replaced by a 1 if needed. This can then be called again in the same macro by using the same query (either in full or with the default value dropped): ?{Augmented (1 for yes)?|0} or ?{Augmented (1 for yes)?} Alternatively, drop down queries are a bit cleaner and are easier to define for the desired output: ?{Augmented?|No,0|Yes,1} called later by ?{Augmented?|No,0|Yes,1} or ?{Augmented?} However if you are wanting more complex conditional statements you will need to consider using the API (a pro level perk) which would allow you use of powercards (a community script written by HoneyBadger), there are also some community sheets which have some quite useful/complex templates attached to them that you could hi-jack but this would prevent you from using the sheet of your choice or a custom one.
Without using a roll template or api script, you're not going to be able to do if/else statements very well. You can sorta do them with multiplication, but it makes the macros very hard to read.
@Andrew, just plucked one from the internet :P I understand what it does but it's hard to explain :/ @Ziechael & @HoneyBadger, the macro I wish to create would function the same as: (enter x), if x is larger than 1, if x is larger than 3 , if x is larger than 5, roll 4d6, else roll 3d6 , else roll 2d6 , else roll 1d6
1446467751
Ziechael
Forum Champion
Sheet Author
API Scripter
So there is a maximum augmentation value? or is anything larger than 5 just considered 'maximum'? Am i also reading right that: 0 = 1d6 1, 2 and 3 = 2d6 3, 4 and 5 = 3d6 6+ = 4d6
No maximum, just dont think I'll augment it higher than that anytime soon... It's supposed to be: 1: 1d6 3: 2d6 5: 3d6 7: 4d6 Thats why I didnt say: or equal to, but simply: larger than... The idea being you'd never enter 0/2/4/6/8 as a value since those don't have any added benefits
1446469631
Ziechael
Forum Champion
Sheet Author
API Scripter
Based on set values and outputs you could use a drop down query: ?{Augmented?|1,[[1d6]]|3,[[2d6]]|5,[[3d6]]|7,[[4d6]]} ^ With this you only need to type it out long form once if you use the same dice roll each time, every other occurrence can use ?{Augmented?} as a call to roll the same number of dice again and get different results. Or for a value you use for more than die rolls you could use: ?{Augmented?|0}   ^ allows you to define the exact number in case you want to output that elsewhere or use it for other calculation; and then anywhere you need to roll dice: [[ [[ceil(?{Augmented?}/2)]]d6]]
Durr... I'm so used to just relying on the api... I forget about simple solutions like that.
I didn't know there was a functionality with a drop down menu, I thought there only was that you enter a value yourself... Thanks for the info and advice :D I wish I had the money to go Pro :( I'd love to fiddle around with the API too :/ Ah well, perhaps some day :D Thanks again!
Hmmm implementing this is a bit harder than I thought though :P I wanted to get the macro to ask me for 1 value only... but then it screws up :P This is the macro: &{template:default} {{name=Collapse}} {{Disciple=Psychometabolism}} {{Display=Auditory}} {{Mani. Time=Standard}} {{Range=Close (30 ft.)}} {{Target=One living creature}} {{ST=Fortitude?{Augmented?|1,(15)|3,(16)|5,(17)} negates}} {{Pow. Res.=Yes}} {{PP=?{Augmented?|1|3|5}}} {{Description=?{Augmented?|1,Enemy is knocked prone on a failed save.|3,On a failed save the target is Fatigued, Sickened, or Staggered for 4 rounds in addition to being knocked prone. (Multiple applications of this power do not result in the target becoming Exhausted.)|5,On a failed save, the target is Sickened for 4 rounds in addition to being knocked prone.}}} Sadly, the answer it gives me when I for instance choose the Augmented? value of 3 is: Collapse Disciple Psychometabolism Display Auditory Mani. Time Standard Range Close (30 ft.) Target One living creature ST Fortitude(16) negates Pow. Res. Yes PP (16) Description (16) Do you perhaps know of a way around this? Or is it only possible if I make 3 different seperate queries? Cheers, Casper
1446473347
Ziechael
Forum Champion
Sheet Author
API Scripter
Sadly that is beyond the standard macro system, you would need either 3 queries or a way of representing the data mathematically. Alternatively you could look at the templates used by community sheets that allow a bit of conditional logic (surround critical hits etc) and may give you some extra flexibility with regards to the output? But again that it only an option if you aren't already using a sheet... in which case asking the sheets author to add in templates might be a good idea? As I'm not proficient with templates generally (having been firmly in the Powercards camp since my early days) I'll duck out now and await the genius of the rest of the community, I'm sure someone else will have some ideas that may help you get closer to what you want.
1446475928

Edited 1446476603
Aight, thanks a lot for the help up til now, I learned quite a bit about the extent of the uses of the macro system from you :D
1446476649

Edited 1446476659
I just realized I could also rewrite the part after the saving throw multiple times to include the variables from there on, thus having the macro decide which option to go from the saving throw... Since for instance Augmented? is 3 then it already concludes PP to be 3, ST to be 16 and the description connected to augmented 3... it just doubles the size of the macro... but that is fine I think... Wait no that doesn't work because both the template and the query are dependend on the {}... screwing up the query if I were to implement the template in it..
1446478250
Ziechael
Forum Champion
Sheet Author
API Scripter
You can use html entities to replace macro breaking syntax... just be sure to have it as an ability or if using it as a general macro you'll need to leave it closed after saving or otherwise it will translate the entities back into } etc and break again ;) This  thread , and its predecessors holds some great information on bending templates to your will.
Ooh, that'll do it :) Thanks!
1446479472
Diana P
Pro
Sheet Author
If you use html entities for the commas and closing brackets, you can end up with a macro like: &{template:default} {{name=Collapse}} {{Disciple=Psychometabolism}} {{Display=Auditory}} {{Mani. Time=Standard}} {{Range=Close (30 ft.)}} {{Target=One living creature}} ?{Augmented?|1,{{ST=Fortitude (15) negates}} {{Pow. Res.=Yes}} {{PP=1}} {{Description=Enemy is knocked prone on a failed save.}} |3,{{ST=Fortitude (16) negates}} {{Pow. Res.=Yes}} {{PP=3}} {{Description=On a failed save the target is Fatigued,, Sickened,, or Staggered for 4 rounds in addition to being knocked prone. (Multiple applications of this power do not result in the target becoming Exhausted.)}} |5,{{ST=Fortitude (17) negates}} {{Pow. Res.=Yes}} {{PP=5}} {{Description=On a failed save,, the target is Sickened for 4 rounds in addition to being knocked prone.}} } Note that if you save this as a universal macro instead of a character ability, you cannot edit/re-save it without having to re-enter the replacement html entities as they will be interpreted.  And this does almost triple the size of the macro since you are building the last half of the roll inside the query. Hope that helps.
1446479506
Diana P
Pro
Sheet Author
Lol.  And apparently I answer way too slowly when multi-tasking. :)
Yes! This does exactly what I wanted it to do now! Thank you so very much for all the help :D
1446610509

Edited 1446646380
This is the macro I'm running now and it works exactly how I want it :D &{template:default} {{name=Collapse}} {{Disciple=Psychometabolism}} {{Display=Auditory}} {{Mani. Time=Standard}} {{Range=Close (30 ft.)}} {{Target=One living creature}} {{ST=Fortitude?{Augmented?|1,(15) negates}} {{Pow. Res.=Yes}} {{PP=1}} {{Description=On a failed save the target is knocked prone.}}|3,(16) negates}} {{Pow. Res.=Yes}} {{PP=3}}{{Description=On a failed save the target is ?{Condition?|Fatigued,fatigued|Sickened,sickened|Staggered,staggered|} for 3 rounds in addition to being knocked prone. (Multiple applications of this power do not result in the same target becoming exhausted.)}}|5,(17) negates}} {{Pow. Res.=Yes}} {{PP=5}} {{Description=On a failed save the target is sickened for 3 rounds in addition to being knocked prone.}}} Thanks all for all the help!'' Lol, the forum changes the htmls too xD and I have no clue how to outsmart the forum xD
1446615179
Diana P
Pro
Sheet Author
:)  To get the macros to show properly on the forums, you have to nest the html entities also, just a step further 'cause pasting acts as the first substitution and saving the second. so each & is really &, which is &, which is &, which is & etc as far as it needs to go.  
1446646432

Edited 1446646489
That's awesome :D It worked with the edit now :D I should get into programming... stuff like this is so interesting and fun :)