macros suddenly broken, only gives 1 as result.

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

femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

macros suddenly broken, only gives 1 as result.

Post by femanon »

testing out an unlikely condition for my token, I started pressing a macro really fast, now for some reason the results only come out with 1 for certain macros, even after restarting maptools. how do i fix this?

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: macros suddenly broken, only gives 1 as result.

Post by CoveredInFish »

Maybe we could help if we knew the macro in question. This does not sound like a common problem.

femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Re: macros suddenly broken, only gives 1 as result.

Post by femanon »

CoveredInFish wrote:Maybe we could help if we knew the macro in question. This does not sound like a common problem.
the macro shouldnt really matter, I never changed it, I just clicked it a lot and it stopped working.

Nevermind, I figured out the problem, although not the cause. repeated clicking seems to have caused a variable called d20roll to revert back to 1d20, although the roll was still present. I guess the lesson here is maptools can't handle 10s of clicks per second.
Last edited by femanon on Mon Oct 01, 2012 11:57 am, edited 1 time in total.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: macros suddenly broken, only gives 1 as result.

Post by Rumble »

I don't recall ever seeing a similar problem report. There's not much help we can offer without more information, though. For instance:

a) what is the code for the macro you clicked
b) when you say it just results in 1, is that just that macro, or other unrelated macros that also now result in 1?
c) does the macro edit any token properties? If so, did a critical token property get set to be 1?

femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Re: macros suddenly broken, only gives 1 as result.

Post by femanon »

Rumble wrote:I don't recall ever seeing a similar problem report. There's not much help we can offer without more information, though. For instance:

a) what is the code for the macro you clicked
c) does the macro edit any token properties? If so, did a critical token property get set to be 1?
I honestly have no idea why the roll results in a 1, undefined variables usually get their numbers asked for.

[T: 1d20roll+variables+morevariables+Evenmorevariables]
is basically what the roll is. which always results in 1
[T: d20roll+variables+etc..
was how it looked before rapid clicking changed it.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: macros suddenly broken, only gives 1 as result.

Post by Rumble »

Okay, I think I wasn't clear - what is the actual code of the macro? Is the macro itself rewritten? If so, what was is supposed to be vs. what did it turn into? There are functions to write macros, but if none of them are being used, then you have discovered a unique bug (probably due to a race condition caused by clicking the button really fast).

Absent the actual code, the only thing I can think of is that your "1d20+foo+bar+baz" is being condensed and losing its "+" symbols, before it is evaluated. See, if you have this code:

Code: Select all

[t:1d20+x+y+z]
but for whatever reason, the plus signs are stripped out and you get

Code: Select all

[t:1d20xyz]
that will always evaluate to 1 (or whatever the first number is) - the characters after the number are ignored. If that's what's happening (and it probably is) then we will need to see the actual code to figure out where the "+" signs are being dropped (or, alternatively, you can track it down).

femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Re: macros suddenly broken, only gives 1 as result.

Post by femanon »

Rumble wrote:Okay, I think I wasn't clear - what is the actual code of the macro? Is the macro itself rewritten? If so, what was is supposed to be vs. what did it turn into? There are functions to write macros, but if none of them are being used, then you have discovered a unique bug (probably due to a race condition caused by clicking the button really fast).

Absent the actual code, the only thing I can think of is that your "1d20+foo+bar+baz" is being condensed and losing its "+" symbols, before it is evaluated. See, if you have this code:

Code: Select all

[t:1d20+x+y+z]
but for whatever reason, the plus signs are stripped out and you get

Code: Select all

[t:1d20xyz]
that will always evaluate to 1 (or whatever the first number is) - the characters after the number are ignored. If that's what's happening (and it probably is) then we will need to see the actual code to figure out where the "+" signs are being dropped (or, alternatively, you can track it down).
I dont see what I'm misunderstanding, Thats the macro I used, yes there are other bits and pieces in the macro, no none of them are needed to repeat the bug. There's no way for me to know for sure whats being stripped out, but the mouse over T: for the failed calculation does still show every + sign where it should be

[h: vari4 = 1]
[h: vari3 = 5]
[h: vari2 = 4]
[h: vari1 = 2]
[h: d20roll = 1d20]
[T: d20roll+vari1+vari2+vari3+vari4]
[T: 1d20roll+vari1+vari2+vari3+vari4]

this will reproduce the error message, but the ACTUAL problem is that clicking on a macro too fast seemed to change it's contents for whatever unknown reason, and that kind of digging around is beyond my skill level.

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

Re: macros suddenly broken, only gives 1 as result.

Post by wolph42 »

just to be clear:
if you start maptools b87 in java 6. You do NOT load a campaign file but simple paste
this code

Code: Select all

[h: vari4 = 1]
[h: vari3 = 5]
[h: vari2 = 4]
[h: vari1 = 2]
[h: d20roll = 1d20]
[T: d20roll+vari1+vari2+vari3+vari4]
[T: 1d20roll+vari1+vari2+vari3+vari4] 
in the campaign panel in a new macro.
Then when you click the macro repeatedly the content changes??

Is this what you tested? If not can you confirm it?

edit: never mind, you made a typo:
1d20roll+vari1+vari2+vari3+vari4
will always result in 1. If you change it into:
d20roll+vari1+vari2+vari3+vari4
its fixed.

femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Re: macros suddenly broken, only gives 1 as result.

Post by femanon »

wolph42 wrote:just to be clear:
if you start maptools b87 in java 6. You do NOT load a campaign file but simple paste
this code

Code: Select all

[h: vari4 = 1]
[h: vari3 = 5]
[h: vari2 = 4]
[h: vari1 = 2]
[h: d20roll = 1d20]
[T: d20roll+vari1+vari2+vari3+vari4]
[T: 1d20roll+vari1+vari2+vari3+vari4] 
in the campaign panel in a new macro.
Then when you click the macro repeatedly the content changes??

Is this what you tested? If not can you confirm it?
....
I just told you, Understanding why the contents changed is beyond me, and I already explained that they changed after clicking the macro very very quickly 10+ times a second when I was testing, it changed a total of one time,
opening a new campaign and dumping that in a macro will ONLY as i've ALREADY SAID give you a "1" result.

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: macros suddenly broken, only gives 1 as result.

Post by CoveredInFish »

femanon wrote:this will reproduce the error message, but the ACTUAL problem is that clicking on a macro too fast seemed to change it's contents for whatever unknown reason, and that kind of digging around is beyond my skill level.
And this actual problem is what makes us interested. If this is confirmed behavior it would be something that has to be investigated. You've got the attention of some pretty experienced long-time users here.

We ask so picky questions because this is something that surprises us - we can not reproduce it. So we want you to help us understand and reproduce your problem exactly.

Code: Select all

[T: d20roll+vari1+vari2+vari3+vari4]
[T: 1d20roll+vari1+vari2+vari3+vari4]
The second line will always be parsed to 1 regardless of your clicking speed. Do you see the leading 1? Since "1d20roll" is no valid variable name nor a valid dice expression the maptool parses stops after the value it can figure out - and thats the 1. The tooltip still shows the complete expression, regardless of what the parser "understood".

Other than this (explainable) behaviour I cant produce any error with that macro code. And I so clicked it fast :-)

femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Re: macros suddenly broken, only gives 1 as result.

Post by femanon »

CoveredInFish wrote:
femanon wrote:this will reproduce the error message, but the ACTUAL problem is that clicking on a macro too fast seemed to change it's contents for whatever unknown reason, and that kind of digging around is beyond my skill level.
And this actual problem is what makes us interested. If this is confirmed behavior it would be something that has to be investigated. You've got the attention of some pretty experienced long-time users here.

We ask so picky questions because this is something that surprises us - we can not reproduce it. So we want you to help us understand and reproduce your problem exactly.

Code: Select all

[T: d20roll+vari1+vari2+vari3+vari4]
[T: 1d20roll+vari1+vari2+vari3+vari4]
The second line will always be parsed to 1 regardless of your clicking speed. Do you see the leading 1? Since "1d20roll" is no valid variable name nor a valid dice expression the maptool parses stops after the value it can figure out - and thats the 1. The tooltip still shows the complete expression, regardless of what the parser "understood".

Other than this (explainable) behaviour I cant produce any error with that macro code. And I so clicked it fast :-)
well I dont know what to tell you, I clicked it for about 2 minutes when I did it, but I don't know if even doing that will reproduce the result or not for anyone since I have no idea why it changed. all I know is I was clicking my macro and the results started turning up 1 1, 1, 1, 1, 1, 1, 1, over and over suddenly. If you guys want to find and debug it, that's cool I guess, but I don't see how needing to be able to spam a macro at that speed is something I'll ever need to do again.

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: macros suddenly broken, only gives 1 as result.

Post by jfrazierjr »

You set a token variable to "x" and now it recalls the value FROM the token when you think it's a "local"(scoped to the macro execution itself) variable?????
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..

femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Re: macros suddenly broken, only gives 1 as result.

Post by femanon »

jfrazierjr wrote:You set a token variable to "x" and now it recalls the value FROM the token when you think it's a "local"(scoped to the macro execution itself) variable?????
I cant even understand what youre trying to ask me.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: macros suddenly broken, only gives 1 as result.

Post by aliasmask »

"1d20roll" is not a valid variable name. I always get a 1 for the 2nd value. If I change the line to 2d20roll... I always get a 2 result. The parser doesn't understand what you're doing after the 1, so it ignores the rest of the line. The solution is not to do that.

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

Re: macros suddenly broken, only gives 1 as result.

Post by wolph42 »

aliasmask wrote:"1d20roll" is not a valid variable name. I always get a 1 for the 2nd value. If I change the line to 2d20roll... I always get a 2 result. The parser doesn't understand what you're doing after the 1, so it ignores the rest of the line. The solution is not to do that.
You've been ninja'd about 5 posts ago ...

That and I suspect that the OP tries to make clear that that '1' (or 'roll' or that entire line), appeared in the macro after clicking on the macro repeatedly

Post Reply

Return to “Macros”