MapTool 1.3 Development Build 38
Moderators: dorpond, trevor, Azhrei, Craig
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.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]
Then it gives me the following error:
Code: Select all
Could not execute the command: null
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]
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 »
0+0=1, for very unstable CPUs.
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 {}.Naryt wrote:YesRPTroll 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 {}.
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>
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>
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.borchard:
#9
borchard:
#10
borchard:
#12
Food for thought.
0+0=1, for very unstable CPUs.
BigO wrote: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.Orchard wrote:My buddy is trying to use it to pass images and stuff, and it's having serious trouble.
If I do this:
I get what I expect, the chat window says WIN to me. If I do this:Code: Select all
{MahString=" WIN "}
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
{if(1d20>=MahAC, " WIN ", " 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.Code: Select all
{MahString=" WIN "}{if(1d20>=MahAC, MahString, " FAIL ")}
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?
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, doOrchard wrote:No, that doesn't work.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 ")}
Input:Output:Code: Select all
{MahString=" WIN "}{if(1d20>=MahAC, "MahString", " FAIL ")}
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.Code: Select all
WIN ahStrin
Code: Select all
{MahString"' "+"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"+" '"}
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
oopsMathemagician wrote: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"+" '"}
That's great! Particularly the string bug.==, (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.
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:I can't figure why, it works when i use it in my targeting macros...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've figured it out. What a headache!
Code: Select all
{mystring="' "+"Beep Beep :D "+" '"}{yourstring=mystring}
Code: Select all
' Beep Beep :D 'Beep Beep :D
Code: Select all
{mystring="' "+"Beep Beep :D "+" '"}{yourstring=mystring}
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}
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.