How to make a macro execute another macro?

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

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. :)

Kurghoth
Kobold
Posts: 15
Joined: Fri Aug 22, 2014 4:36 am
Location: Ancona, Italy
Contact:

Re: How to make a macro execute another macro?

Post by Kurghoth »

Ok that's the point

As I said before there is a Token that allow me to "see" the spell on the map... the one called "Aura Debilitante" that have a green skull icon.

This is how the macro should work.

1. Select the token
2. once you click on the macro the following should happen.
- The property "Turni" of the token should be set to turni-1
- other property of the token should be set on another token named "AuraTemp". This token will be used to check attack status of the spell vs defence status of the enemies. I used that to have a "fixed" name to recall property from.
- The macro should now select all the token in the area of effect and then all the "friendly" token should be suddenly deselected (friendly tokens are setted using the status "Amico")
- Now the macro should compare "Penetrazione Spirituale" of the spell with "AssSpiFigura" of the selected enemies. If "Penetrazione Spirituale" >= "AssSpiFigura" then the damage (previously setted on "AuraTemp" token) is dealt to the target.

I hope this is clear. If is not i will try to explain better.

This is the map i was using to test the macros:
https://www.dropbox.com/s/94q2s4kty22ln ... rpmap?dl=0

And this is the cmpgn file:
https://www.dropbox.com/s/mwdk67gvmdvy1 ... cmpgn?dl=0

The game is a game I am developing and is not yet published ^_^

I forgot to say a couple of things before:

I have Windows 8.1 with Java latest version (both 32bit and 64bit) installed and I am using Maptool ver. 1.3.b89

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: How to make a macro execute another macro?

Post by wolph42 »

1. Select the token
really ?!? you have what... 15 maps??

you need to do a better job than that.

1. go to map ?
2. select the token called ?? on layer ??
3. go to panel ??
4. here you find a macro called ??
5. click it, the following *should* happen: ?? but doesn't?

Kurghoth
Kobold
Posts: 15
Joined: Fri Aug 22, 2014 4:36 am
Location: Ancona, Italy
Contact:

Re: How to make a macro execute another macro?

Post by Kurghoth »

Maybe I am getting wrong but you seem upset... Remember that I am new to maptool... actually I started using it something like 10 days ago...
really ?!? you have what... 15 maps??
I linked one map... how it happen that you see like 15 maps...?
you need to do a better job than that.
That's what I am trying to do... learn to do better...
1. go to map ?
The map is the same that I linked and is named "Cave01"

2. select the token called ?? on layer ??
Kurghoth wrote:As I said before there is a Token that allow me to "see" the spell on the map... the one called "Aura Debilitante" that have a green skull icon.


It's in the Token layer
3. go to panel ??
4. here you find a macro called ??
In global panel you should find a macro called "Aura Debilitante"

If you don't here is the code (that I already provided before)

Code: Select all

[macro("Next@lib:debilitante"): ""]
[macro("Target@lib:debilitante"): ""]
[macro("Calcola@lib:debilitante"): ""]
I also tried to launch macro from the global panel using the macro (in the global panel) called This is the macro!!!

Code: Select all

[macro("RidTurni@Global"): ""]
[macro("SelTarget@Global"): ""]
[macro("CalcoloDanni@Global"): ""]
This macro have Auto Execute enabled and apply to selected token disabled
5. click it, the following *should* happen: ?? but doesn't?
I tried to explain better than I can how the macro should work... step by step... if I launch the macros from global panel one by one everything work fine but if I try to launch them from the lib:debilitante or from the global panel using [macro:()] I keep getting the error that I already mentioned before:
Error in body of roll.       
Statement options (if any): macro("Next@lib:debilitante")       
Statement Body : ""
I apologize if I haven't been clear enough... I am really doing my best to explain and learn. I know something about "coding" from VBA and here is almost everything new for me...

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: How to make a macro execute another macro?

Post by wolph42 »

Ok there is quite some stuff going on. First of all: see the link in my sig the big one ("getting started") and check it out. You are REALLY missing a LOT of stuff which results in these kinds of issues. Especially check out 'debug tutorial'

a few things:
1. did you notice the 'select map' in the upper right? that in combination with 'map menu'. Your campaign file is a mess and contains lots of maps with the same name: thats a disaster waiting to happen. So clean that up first. (e.g. two maps with the same lib:token name on them will send things haywire)
2. Global macros are linked to your pc. I never use them. You should move them to the campaign panel.
3. When someone is willing to have a look at your campaign file, it is custom to present the campaign file *including* (that is imported into the campaign file) and then with the above steps so it can be recreated AND state what the *problem* is. You gave a description of what it *should* do, but not of what goes wrong.
4. I've tried the macro (loaded it into the campaign macro and turned on 'apply to selected token' and I got no errors. It worked.
The 'turni' was lowered by 1. Tokens were NOT selected, is that the problem??

Kurghoth
Kobold
Posts: 15
Joined: Fri Aug 22, 2014 4:36 am
Location: Ancona, Italy
Contact:

Re: How to make a macro execute another macro?

Post by Kurghoth »

Ok there is quite some stuff going on. First of all: see the link in my sig the big one ("getting started") and check it out. You are REALLY missing a LOT of stuff which results in these kinds of issues. Especially check out 'debug tutorial'
I will ^_^
1. did you notice the 'select map' in the upper right? that in combination with 'map menu'. Your campaign file is a mess and contains lots of maps with the same name: thats a disaster waiting to happen. So clean that up first. (e.g. two maps with the same lib:token name on them will send things haywire)
I cleared the map section... now i only have the map needed... there is one think I don't understand... as long as I need the same macro on all the maps, do I have to change the lib:token on each map? or i have to keep one map at time in my campaing file so the name of the lib token is unique? is this explained on your tutorial? if it is i will learn from that :D
2. Global macros are linked to your pc. I never use them. You should move them to the campaign panel.
I used Global to let player use the campaign macros... is it better if i give macros to player tokens and move the global macro to campaign macro?
3. When someone is willing to have a look at your campaign file, it is custom to present the campaign file *including* (that is imported into the campaign file) and then with the above steps so it can be recreated AND state what the *problem* is. You gave a description of what it *should* do, but not of what goes wrong.
I apologize... I thought I was been clear. If I wasn't I will try to do better next time.
4. I've tried the macro (loaded it into the campaign macro and turned on 'apply to selected token' and I got no errors. It worked.
The 'turni' was lowered by 1. Tokens were NOT selected, is that the problem??
My problem is that the macro don't even start because i get that error:

Code: Select all

Error in body of roll.       
Statement options (if any): macro("Next@lib:debilitante")       
Statement Body : ""
So it not lower the turns count, it not target anything and it non deal any damage...

Edit:
I checked Apply to selected token and now seems to work again. It also deal damage where it is necessary. Is it possible that the problem was the mess with the thousand map imported?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: How to make a macro execute another macro?

Post by wolph42 »

I cleared the map section... now i only have the map needed... there is one think I don't understand... as long as I need the same macro on all the maps, do I have to change the lib:token on each map? or i have to keep one map at time in my campaing file so the name of the lib token is unique? is this explained on your tutorial? if it is i will learn from that :D
a lib:token is accessible from ALL maps. So make sure it has a UNIQUE name. Also (as general advise) make sure that all your lib:tokens are on one map (so you can easily find them).
I used Global to let player use the campaign macros... is it better if i give macros to player tokens and move the global macro to campaign macro?
'Global' means from YOUR pc usealbe for ANY (global) campaign file. (As they are linked to your pc) no matter which campaign file is loaded.
'Campgaign' means it linked to the CAMPAIGN file, hence accessible to everyone who has loaded (or is connected to) the campaign file. (Note to turn on 'allow players access to campaign macros').
My problem is that the macro don't even start because i get that error:
The only time I got an error was when nothing was selected (or apply to selected was turned off).
my advise is to use the following at the start of the macro:

Code: Select all

[toks = getSelectedNames()]
[assert(listCount(toks) == 1, "Make sure (only) one token is selected",0)]
[switchToken(toks)] 
and uncheck 'apply to selected tokens'.

OR

Code: Select all

[toks = getSelectedNames()]
[foreach(tok, toks), CODE:{
    [switchToken(tok)]
    <!-- your code here -->
}] 
and uncheck 'apply to selected tokens'.

Kurghoth
Kobold
Posts: 15
Joined: Fri Aug 22, 2014 4:36 am
Location: Ancona, Italy
Contact:

Re: How to make a macro execute another macro?

Post by Kurghoth »

The code you provided has to go into the macro that call the lib:token macros? I tried to put in there and to switch off the "apply to selected token" but it give me the same error... anyway if i just keep the "apply to selected token" on everything just work fine... now i will have to improve the macro to make this routine happen for any Aura spell on the map...

New challenge for me but now i have instruments to understand better...

By the way... even if I didn't realize that... i was just studying with your tutorial... my browser open with this page:

http://lmwcs.com/rptools/wiki/Main_Page :D

Just one last question:
I don't want to know how because I am afraid it will be a mess until i learn more things... but... is it possible to make a PC token summon a NPC token?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: How to make a macro execute another macro?

Post by wolph42 »

The code indeed goes to lib:token macros.
I don't want to know how because I am afraid it will be a mess until i learn more things... but... is it possible to make a PC token summon a NPC token?
yes. and vice versa for that matter. You might want to make sure that 'allow players to edit macro' is turned OFF in your macros!

You also might want to check out the bag of tricks by then (as it has a macro 'summon token' on it).

Kurghoth
Kobold
Posts: 15
Joined: Fri Aug 22, 2014 4:36 am
Location: Ancona, Italy
Contact:

Re: How to make a macro execute another macro?

Post by Kurghoth »

Ok... thanks for the help and again... sorry for I haven't been clear enough...

Post Reply

Return to “MapTool”