MapTool 1.3 Development Build 38

New build announcements plus site news and changes.

Moderators: dorpond, trevor, Azhrei, Craig

User avatar
trevor
Codeum Arcanum (RPTools Founder)
Posts: 11311
Joined: Mon Jan 09, 2006 4:16 pm
Location: Austin, Tx
Contact:

Post by trevor »

Heh, you guys crack me up !

Amazing work figuring this out, btw. Giliath and I will work on ironing out the kinks (well, more giliath than me, unless he gets busy)
Dreaming of a 1.3 release

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

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)}
actually works, while this statement

Code: Select all

{out=if(1d6<2&&1d6<3>1," Fighting roll is ",3)}
runs, it always evals to FALSE (not surprisingly).

On the other hand,

Code: Select all

{out=5d6} {out=if(1d6<2&&1d6<3>1," Fighting roll is ",out)}
displays the value of "out" as determined by the roll of the 5d6 twice. Which is really strange. Switching to [] instead of {} gives me this out put:

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.

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

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
A wandering lost soul

User avatar
panzuriel
Kobold
Posts: 9
Joined: Tue Jul 22, 2008 9:56 am

Post by panzuriel »

Woohoo!!! I was thinking last night that I might dive into the code and see if I could add conditionals (I was thinking ternary operator). I wake up and someone has done it! Thanks Goliath!!!

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

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.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Post by RPTroll »

My thought was half formed and never stated regarding {} and comments.

I was thinking that until we get a separate channel for exploded values or the ability to mouse over, it might be cool if the {} generated a comment with the exploded rolls.

salmelo
Giant
Posts: 210
Joined: Fri May 23, 2008 10:23 pm

Post by salmelo »

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

User avatar
Mathemagician
Dragon
Posts: 666
Joined: Tue May 22, 2007 2:27 pm

Post by Mathemagician »

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!

User avatar
giliath
RPTools Founder
Posts: 275
Joined: Tue Jan 31, 2006 11:10 am
Location: Austin, TX

Post by giliath »

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.
~Giliath

User avatar
Mathemagician
Dragon
Posts: 666
Joined: Tue May 22, 2007 2:27 pm

Post by Mathemagician »

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.

salmelo
Giant
Posts: 210
Joined: Fri May 23, 2008 10:23 pm

Post by salmelo »

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

salmelo
Giant
Posts: 210
Joined: Fri May 23, 2008 10:23 pm

Post by salmelo »

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

User avatar
Micco
Giant
Posts: 148
Joined: Mon Jun 16, 2008 10:21 pm

Post by Micco »

==, (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...

User avatar
Mathemagician
Dragon
Posts: 666
Joined: Tue May 22, 2007 2:27 pm

Post by Mathemagician »

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.

User avatar
hennebeck
Dragon
Posts: 394
Joined: Sun Jun 01, 2008 12:06 am
Location: THe City of Roses

Post by hennebeck »

I can't load any saved campaigns.
I see the image in the preview window.
And then I hit load, it says loading in the little white bar and then shows me the grassland map again with nothing new loaded.

Post Reply

Return to “Announcements”