MapTool 1.3 Development Build 38
Moderators: dorpond, trevor, Azhrei, Craig
RPTroll wrote:OK. This is killing me not being able to test. Here's some code for Savage Worlds. See any obvious problems?
Ok. Here's what I'll try at some point tonight (unless someone wants to pull up my savage worlds campaign and give it a shot themselves.
Fatige, Shaken and Fighting are all token properties.
Faigue and Shaken ranng from 1 to n
Fighting is a die roll like d8e
{out=' '}
{mod=Fatigue+Shaken}
{wild=d6e}
{melee=Fighting}
{out=if(melee<2," Miss ",out)}
{out=if(melee<2&&wild<2>1," Fighting roll is ",out)}
[out]
{out=' '}
{out=if(melee>1,roll,out)}
[out]
First, it asks for the value of "out" twice...I dont' know if this is an intended behavior, but I suppose the {out=' '} is prompting this.
Then it gives me the following error:
Code: Select all
Could not execute the command: null
This is the exact code I used (to compensate for the fact that I don't have your tokens or campaign):
Code: Select all
{out=' '}
{Fatigue=1d100}
{Shaken=1d100}
{Fighting=d8e}
{mod=Fatigue+Shaken}
{wild=d6e}
{melee=Fighting}
{out=if(melee<2," Miss ",out)}
{out=if(melee<2&&wild<2>1," Fighting roll is ",out)}
[out]
{out=' '}
{out=if(melee>1,roll,out)}
[out]
Putting in spaces in some of the places where I think it is probably needed didn't help, but I suspect that your "wild<2>1" is going to cause problems (In fact, I don't think that's a possibility given integer values...you probably mean <3>1!).
This statement:
Code: Select all
{out=if(1d6<3>1, 1,0)}
Code: Select all
{out=if(1d6<2&&1d6<3>1," Fighting roll is ",3)}
On the other hand,
Code: Select all
{out=5d6} {out=if(1d6<2&&1d6<3>1," Fighting roll is ",out)}
Code: Select all
« out=5d6 = out = 20 = 20 » « out=if(1d62&&1d63>1," Fighting roll is ",out) = out = 20 = 20 »
So, I'd say the IF statements have just a bit of debugging to be done...but frankly, most of us are going to be able to work around the current issues for a bit.
0+0=1, for very unstable CPUs.
Naryt wrote:RPTroll wrote:hmmm. If you export the chat and do a view source does it show the actual comment? This could be very useful indeed if you could embed the rolls inside of that for error checking and debugging of {}.
Yes
This is the source for a two comment output that used the hidden comments for {} and whatnot. Note how it outputs information--again it ONLY gives the RESULT, not the mechanics. But this is a case where if you are completely hiding it, then you might as well use the [], and if you are displaying it, THEN it's time to use {}.
Code: Select all
<html>
<head>
<style type="text/css">
<!--
body { font-family: sans-serif; font-size: 12pt }
span.roll { background-color: #efefef; background-attachment: scroll; background-repeat: repeat }
div { margin-bottom: 5px }
-->
</style>
</head>
<body id="body">
<div>
<table cellpadding="0">
<tr>
<td style="margin-right: 5px" valign="top">
borchard:
</td>
<td valign="top">
<font color="#000000"><span><!--9 This is a test-->
<br>
#9</span></font>
</td>
</tr>
</table>
</div>
<div>
<table cellpadding="0">
<tr>
<td style="margin-right: 5px" valign="top">
borchard:
</td>
<td valign="top">
<font color="#000000"><span><!--10 This is a test-->
<br>
#10</span></font>
</td>
</tr>
</table>
</div>
</body>
</html>
That said, remember that the [] is a better way to do this if you are completely hiding the output.
Code: Select all
<html>
<head>
<style type="text/css">
<!--
body { font-family: sans-serif; font-size: 12pt }
span.roll { background-color: #efefef; background-attachment: scroll; background-repeat: repeat }
div { margin-bottom: 5px }
-->
</style>
</head>
<body id="body">
<div>
<table cellpadding="0">
<tr>
<td style="margin-right: 5px" valign="top">
borchard:
</td>
<td valign="top">
<font color="#000000"><span><!--9 This is a test-->
<br>
#9</span></font>
</td>
</tr>
</table>
</div>
<div>
<table cellpadding="0">
<tr>
<td style="margin-right: 5px" valign="top">
borchard:
</td>
<td valign="top">
<font color="#000000"><span><!--10 This is a test-->
<br>
#10</span></font>
</td>
</tr>
</table>
</div>
<div>
<table cellpadding="0">
<tr>
<td style="margin-right: 5px" valign="top">
borchard:
</td>
<td valign="top">
<font color="#000000"><span><!--«<span class='roll' style='color:blue'> R=1d20 = R = 12 = 12 </span>» This is a test-->
<br>
#12</span></font>
</td>
</tr>
</table>
</div>
</body>
</html>
This last one, looks like this:
borchard:
#9
borchard:
#10
borchard:
#12
Note that all three look the same in output, but the last one gives you mechanics if you are able to view the source. Gives the GM a bit of error checking ability.
Food for thought.
0+0=1, for very unstable CPUs.
BigO wrote:Orchard wrote:My buddy is trying to use it to pass images and stuff, and it's having serious trouble.
Indeed I am (said buddy is me). I hope I get the syntax right, I'm doing this from memory because I don't have maptools with me.
If I do this:Code: Select all
{MahString=" WIN "}
I get what I expect, the chat window says WIN to me. If I do this:Code: Select all
{if(1d20>=MahAC, " WIN ", " FAIL ")}
I also get what I expect. It prompts me for the ac, and outputs WIN if the roll is above the ac, FAIL if it's below. This shows me that you CAN use strings in variables and in if statements. HOWEVER, if I put the two together:Code: Select all
{MahString=" WIN "}{if(1d20>=MahAC, MahString, " FAIL ")}
I DON'T get what I expect. I would expect to still see WIN if it's above the ac but instead it prompts me for the value of WIN.
Since WIN was never a variable, just a string value, it would appear that when a variable containing a string is accessed dynamically that the contents are treated as a dynamic variable name and created on the fly.
Is this intended behavior? If so, is there a way to force the parser to treat it as a string?
Orchard wrote:Micco wrote:You've got to cast the MahString to a string by enclosing it in quotes. No need to put a space around it, that needs to go around your actual string value.Code: Select all
{MahString=" WIN "}{if(1d20>=MahAC, "MahString", " FAIL ")}
No, that doesn't work.
Input:Code: Select all
{MahString=" WIN "}{if(1d20>=MahAC, "MahString", " FAIL ")}
Output:Code: Select all
WIN ahStrin
Remember we want it to pass the value of "MahString" if the d20 roll >= MahAC, not the string "MahString", which is what putting it in quotes seems to do. Strangities.
ok, first off, i hope those quotes work right, second, I've been working on implementing target declaration in my macros, and in the process may have come across a solution, when you set MahString, do
Code: Select all
{MahString"' "+"WIN"+" '"}
you may also have to append spaces to the beginning and end of WIN.
Personally i'm hoping for some method of forcing the parser to treat a variable (or property) as a string, like maybe appending $ to the beginning of the name
- Mathemagician
- Dragon
- Posts: 666
- Joined: Tue May 22, 2007 2:27 pm
salmelo's approach is the correct one, except he forgot an =
I will update my previous post. I knew you were doing something wonky with the ' and " salmelo, but I couldn't remember what!

Code: Select all
{MahString="' "+"WIN"+" '"}
I will update my previous post. I knew you were doing something wonky with the ' and " salmelo, but I couldn't remember what!
Okay, I fixed a few things that will be in the next build.
==, (added !=)
Added true/false constants.
We now allow comments in the form of // Comments.
The parser always supported multilines, but the piece in MapTool that feeds the parser doesn't, so we gotta get Trevor to update that. *hint hint*
And I fixed the string bug where you were losing the first and last character of "some" strings.
==, (added !=)
Added true/false constants.
We now allow comments in the form of // Comments.
The parser always supported multilines, but the piece in MapTool that feeds the parser doesn't, so we gotta get Trevor to update that. *hint hint*
And I fixed the string bug where you were losing the first and last character of "some" strings.
~Giliath
- Mathemagician
- Dragon
- Posts: 666
- Joined: Tue May 22, 2007 2:27 pm
Mathemagician wrote:salmelo's approach is the correct one, except he forgot an =Code: Select all
{MahString="' "+"WIN"+" '"}
I will update my previous post. I knew you were doing something wonky with the ' and " salmelo, but I couldn't remember what!
oops

==, (added !=)
Added true/false constants.
We now allow comments in the form of // Comments.
The parser always supported multilines, but the piece in MapTool that feeds the parser doesn't, so we gotta get Trevor to update that. *hint hint*
And I fixed the string bug where you were losing the first and last character of "some" strings.
That's great! Particularly the string bug.

But, of course, now I need to go strip all the leading and trailing spaces out of my property text strings!
Ah, the price of progress...
- Mathemagician
- Dragon
- Posts: 666
- Joined: Tue May 22, 2007 2:27 pm
salmelo wrote:Mathemagician wrote:I spoke too soon. When I tried Salmelo's code it worked for spitting the string back out, but it still prompts me for values of "WIN" when I put it in the if statement.
I can't figure why, it works when i use it in my targeting macros...
I've figured it out. What a headache!
Code: Select all
{mystring="' "+"Beep Beep :D "+" '"}{yourstring=mystring}
produces, as expected
Code: Select all
' Beep Beep :D 'Beep Beep :D
but, if I then go to tack on {yourstring} to the end of that:
Code: Select all
{mystring="' "+"Beep Beep :D "+" '"}{yourstring=mystring}
I am prompted for the value of Beep.
However, should I stop trying to put the circular peg in the square hole, and attempt:
Code: Select all
{mystring="' "+"Beep Beep :D "+" '"}{yourstring="' "+mystring+" '"}{yourstring}
I get the desired output.
Moral of the story, any time you want to assign a string to a variable, use "' "+...+" '"
Phew. Ok, sorry I said you were wrong salmelo.

I've updated my post on page 3...it should now accurately (well, supposing we had targetting working in the Aria's format) reflect Aria's desired code, without long math statements

Last edited by Mathemagician on Mon Jul 28, 2008 6:29 pm, edited 1 time in total.