Macro stop functioning after 1.7 update

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
binn05
Kobold
Posts: 8
Joined: Tue Apr 16, 2013 2:06 am

Macro stop functioning after 1.7 update

Post by binn05 »

For the last 6 months, I was stuck with only using Maptools 1.3 (latest version). And I start developing a personal GURPS Framework for me and my group. The macro code below worked fairly well at v1.3.
Now I'm back to where I can use x64 windows and I upgraded to v1.7.0. The problem is my macro stopped working.
And I have no idea why.
This macro is for testing attribute scores. The <---- is just for explaining what the macro is doing, since most of it is in Portuguese, and it is not part of the macro.

Code: Select all

[h:teste = 3d6]       <----- rolls 3d6
[h: x=input(
"ModificadorAtrib| 0 | Modificador do Teste"         <----- asks for an attribute modifier
)]
[h:abort(x)]

[h: Atributo = macro.args]    <---- defines base attribute as macro.args
[h: AtributoEfetivo = (Atributo+ModificadorAtrib)]   <--------  defines the modified attribute value

           Teste contra [Atributo] com modificador de [ModificadorAtrib].<be>      <-------- just text to print in chat telling the player what is happening
           Valor modificado de [AtributoEfetivo].<br>
           Jogada de [r:teste].<br>

             [r, if (teste > AtributoEfetivo || teste >=17): evalMacro('[MACRO("TesteAtributoFalha@Lib:GURPSNOH"): "AtributoEfetivoEnviado="+AtributoEfetivo+"; TesteEnviado="+teste]')]   <------ here is the problem. This should determine if the macro for failure tests be called upon.

             [r, if (teste <= AtributoEfetivo): evalMacro('[MACRO("TesteAtributoSucesso@Lib:GURPSNOH"): "AtributoEfetivoEnviado="+AtributoEfetivo+"; TesteEnviado="+teste]')]   <------ and this macro should be called if the test is successfull.


So, which is the new way of doing it in 1.7.0?

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

Re: Macro stop functioning after 1.7 update

Post by wolph42 »

you forgot to tell us what the error message is.

anyway, that last part is rather convoluted and a nasty nesting with use of quotes and double quotes in a way that surprises me it worked at all. Basic rule with a nesting that does not work is to unnest, so:

Code: Select all

[h:result = setStrProp("","AtributoEfetivoEnviado",AtributoEfetivo)]
[r:result = setStrProp(result,"TesteEnviado",teste)]

[r, if (teste > AtributoEfetivo || teste >=17), CODE{
	[MACRO("TesteAtributoFalha@Lib:GURPSNOH"): result]
};{
	[MACRO("TesteAtributoSucesso@Lib:GURPSNOH"): result]
}]


binn05
Kobold
Posts: 8
Joined: Tue Apr 16, 2013 2:06 am

Re: Macro stop functioning after 1.7 update

Post by binn05 »

wolph42 wrote:
Wed Sep 09, 2020 2:56 am
you forgot to tell us what the error message is.
Sorry. It was late and I was tired. /facepalm.

If the IF statement calls for TesteAtributoFalha@Lib:GURPSNOH macro, this macro has inside it 4 IF statements, written in the same way, to determine which final macro to use.

The same happens for TesteAtributoSucesso@Lib:GURPSNOH.

The problem is that both macros are only using the first IF statement inside them, giving always the same type of failure or success.
wolph42 wrote:
Wed Sep 09, 2020 2:56 am
anyway, that last part is rather convoluted and a nasty nesting with use of quotes and double quotes in a way that surprises me it worked at all
I used the example showed in the macro (roll options) wiki page.
macro roll options eval example.jpg
macro roll options eval example.jpg (54.54 KiB) Viewed 1947 times
I will try unnesting it, using your example, latter in the day.

User avatar
bubblobill
Giant
Posts: 167
Joined: Sun Jan 24, 2010 3:07 pm

Re: Macro stop functioning after 1.7 update

Post by bubblobill »

I think your problem is that the stringProp arguments are not properly formed.
You want to pass something like "AtributoEfetivoEnviado=foo; TesteEnviado=bar"

Code: Select all

evalMacro('[MACRO("TesteAtributoFalha@Lib:GURPSNOH"): "AtributoEfetivoEnviado="+AtributoEfetivo+"; TesteEnviado="+teste]')] 

is probably literally producing
[MACRO("TesteAtributoFalha@Lib:GURPSNOH"): "AtributoEfetivoEnviado="+AtributoEfetivo+"; TesteEnviado="+teste]

instead of 
[MACRO("TesteAtributoFalha@Lib:GURPSNOH"): "AtributoEfetivoEnviado=foo; TesteEnviado=bar"]
Try changing to

Code: Select all

evalMacro('[MACRO("TesteAtributoFalha@Lib:GURPSNOH"): "AtributoEfetivoEnviado='+AtributoEfetivo+'; TesteEnviado='+teste+'"]')]
This should allow the variables to be resolved and their values to be used instead of their names.

I hope
Bubblobill on the forum.
@Reverend on the MapTool Discord Server

Responsible for less atrocities than most... I do accept responsibility for these though: SmartDoors, Simple d20 Framework - barebones, Drop-in: All 3.5 SRD Monsters, Drop in: Simple Character Editor, Battletech Framework

Post Reply

Return to “Macros”