RPTools.net

Discussion and Support

Skip to content

It is currently Thu Jul 20, 2017 11:39 pm 






Reply to topic  [ 191 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13  Next

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Giant
 
Joined: Thu Nov 20, 2008 3:49 am
Posts: 183
Location: Germany (GMT +1)
 Post subject:
PostPosted: Thu Nov 27, 2008 8:45 am 
Hi all.

Using a minimally adapted version of k.fan's original character sheet macro, I get an error message telling me that
Code:
Could not execute the command: Invalid input type 'TAB' in the parameter string 'TabBasics | Basics | Stufe, LE, etc. | TAB'

It plain doesn't let me use the TAB option...?

My code is (abbreviated some input lines identical to the one saying "Dukaten")
Code:
[H: status = input(
    "TabBasics | Basics | Stufe, LE, etc. | TAB",
 "bla | | Grundlegendes | LABEL",
      "bla |"+ token.name +" | Name | LABEL",
      "Dukaten_ | " + Dukaten + " | Dukaten | TEXT | width=3",
    "TabSkills | Handwerk | Handwerkliche Talente | TAB",
      "bla | Blubbediblubb | Note | LABEL"
)]
[H: abort(status)]


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Fri Mar 28, 2008 11:30 pm
Posts: 1865
Location: Layfayette Hill, PA
 Post subject:
PostPosted: Thu Nov 27, 2008 10:51 am 
It appears the changes/additions referred to in the doc posts of this thread are not in the current build. I think there was some build confusion as a number of rather old (stuff that was done shortly after b45 went live) fixes did not make it in to the b46/47 build.

So I would recommend referencing an older version of the docs (which you would have had to print out...).


Top
 Profile  
 
User avatar  Offline
Giant
 
Joined: Thu Nov 20, 2008 3:49 am
Posts: 183
Location: Germany (GMT +1)
 Post subject:
PostPosted: Thu Nov 27, 2008 10:57 am 
Ah, I see... so it's mainly a matter of waiting for b48(+) when all the documented features are actually in. :lol:

I can live with that (barely). No seriously, macros have gotten lots of loving in recent builds, and the thing I was trying to write would really just be icing on the cake.

Thanks to all programmers making this happen.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Sep 11, 2007 6:31 pm
Posts: 5410
 Post subject:
PostPosted: Thu Nov 27, 2008 2:18 pm 
Ugh... I am having trouble getting my syntax right inside my loop. What i want to is to build a CHECK string from a list.

validTargets is a token Property. In another macro, I add a list of "creatures" who fill in validTargets.
Code:
[h: numTargets = listCount(validTargets)]

<MACRO>
[h: attackTargets = '']
[h: targetString= '']

[H,C(numTargets),CODE: {
   [h: eval( targetNumber +roll.count) = ''  ]
}]


[H,C(numTargets),CODE: {
   [h: targetString = targetString + " 0 |" + listGet(validTargets, roll.count) + "| CHECK"   ]
}]

[h: succces = input(targetString )
[h:abort(success)]


Once I can get this working, I should be able to check for checked targets, append them to a temp list in the macro, and then use this temp list to power the actual attack macro with crit detection.

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


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sat Apr 21, 2007 3:51 pm
Posts: 674
 Post subject:
PostPosted: Thu Nov 27, 2008 2:58 pm 
jfrazierjr wrote:
Ugh... I am having trouble getting my syntax right inside my loop. What i want to is to build a CHECK string from a list.


I've got to run (picking up in-laws for dinner tonight), so I can't put this into MT and test it, but on a quick look the following loop has a problem:

[H,C(numTargets),CODE: {
[h: targetString = targetString + " 0 |" + listGet(validTargets, roll.count) + "| CHECK" ]
}]

In the internal statement, you need a variable in the first spot, before the 0. Something like:

[h: targetString = targetString + "target" + roll.count+ " | 0 |" + listGet(validTargets, roll.count) + "| CHECK" ]


Then you will have a bunch of variables, target0 through target12 (if you had 13 possible targets), which are set to either 0 if unchecked or 1 if checked.

Then you'd add a new loop to go through them and figure out which ones are set to 1.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Sep 11, 2007 6:31 pm
Posts: 5410
 Post subject:
PostPosted: Thu Nov 27, 2008 4:13 pm 
Lindharin wrote:
jfrazierjr wrote:
Ugh... I am having trouble getting my syntax right inside my loop. What i want to is to build a CHECK string from a list.


I've got to run (picking up in-laws for dinner tonight), so I can't put this into MT and test it, but on a quick look the following loop has a problem:

[H,C(numTargets),CODE: {
[h: targetString = targetString + " 0 |" + listGet(validTargets, roll.count) + "| CHECK" ]
}]

In the internal statement, you need a variable in the first spot, before the 0. Something like:

[h: targetString = targetString + "target" + roll.count+ " | 0 |" + listGet(validTargets, roll.count) + "| CHECK" ]


Then you will have a bunch of variables, target0 through target12 (if you had 13 possible targets), which are set to either 0 if unchecked or 1 if checked.

Then you'd add a new loop to go through them and figure out which ones are set to 1.



Thanks, I had already figured that out (I copied the wrong thing), but the problem is that the input string I don't know how to get it properly quoted. Each option to Input needs to be quoted, followed by a comma for the next option. Soo.. how do I get quotes in there since the normal delimiter for string contact is quotes? As far as I know, there is no "escape" character which would allow me to embed a literal quote.

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


Top
 Profile  
 
 Offline
Giant
 
Joined: Mon Feb 19, 2007 12:18 am
Posts: 156
Location: Perth, Western Australia
 Post subject:
PostPosted: Thu Nov 27, 2008 4:58 pm 
jfrazierjr wrote:

Thanks, I had already figured that out (I copied the wrong thing), but the problem is that the input string I don't know how to get it properly quoted. Each option to Input needs to be quoted, followed by a comma for the next option. Soo.. how do I get quotes in there since the normal delimiter for string contact is quotes? As far as I know, there is no "escape" character which would allow me to embed a literal quote.


I think I read somewhere in here that you can use double quotes to enquote single quotes and then the parser will place the single quotes into the resulting string but will evaluate the single quotes as quotes when the string itself is evaluated (ie using html like color='red' ).. assuming it hasn't been changed from the build it was written against this has the info in it:

http://forums.rptools.net/viewtopic.php?t=5177

heres the relevant text:

Quote:
An important note: you can use either double or single quotes to indicate a string. Note that I had to use both types in the <span> tag below, because I wanted a quoted string 'color:red' to be inside the larger string. If I had used the same kind of quote in both places, MapTool would become quite confused and give me the unhelpful error message "Could not execute the command: null".



it's the macro sticky and the relevant section is under WRITING MACROS (about 2/3 of the way down)


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Sep 11, 2007 6:31 pm
Posts: 5410
 Post subject:
PostPosted: Thu Nov 27, 2008 6:18 pm 
Ok... I am really darn close now. This spits out the right string, which I can copy/paste manually into an input(). But when I call the input directly in the macro with targetString as the argument, it barfs... Help?

Code:
[h: numTargets = listCount(validTargets)]

<!--    MACRO SCOPPED VARIABLES -->
[h: attackTargets = ""]
[h: targetString= ""]
Targets: {numTargets}<br>
[H,C(numTargets),CODE: {
   [h:  foo = eval( "targetNumber" +roll.count   +   "=" +  "''")   ];
}]


[H,C(numTargets),CODE: {
   [h: targetString = targetString +    "'targetNumber" +  roll.count + " | 0 | " + listGet(validTargets, roll.count) + " | CHECK'<br> " + if(numTargets >  (roll.count+1) , " , " , "   ") ]
}]
{targetString}
 

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


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sat Apr 21, 2007 3:51 pm
Posts: 674
 Post subject:
PostPosted: Thu Nov 27, 2008 7:09 pm 
**** EDIT: Ignore this. I missed your prior post, so you're already past this stage. ****

jfrazierjr wrote:
Thanks, I had already figured that out (I copied the wrong thing), but the problem is that the input string I don't know how to get it properly quoted. Each option to Input needs to be quoted, followed by a comma for the next option. Soo.. how do I get quotes in there since the normal delimiter for string contact is quotes? As far as I know, there is no "escape" character which would allow me to embed a literal quote.


Ah, try this:

[h: targetString = targetString + " ' target" + roll.count+ " | 0 |" + listGet(validTargets, roll.count) + "| CHECK ' , " ]

That's a single quote at the start of the line, and a single quote at the end, followed by the comma.

Because it ends with a comma after the last iteration of the loop, though, you need to add one more line after the end of the loop. It can be something just to fill the space, though, like:

[h: targetString = targetString + " ' blah |---------------- | --------------| LABEL ' "]


Last edited by Lindharin on Thu Nov 27, 2008 7:13 pm, edited 1 time in total.

Top
 Profile  
 
 Offline
Dragon
 
Joined: Sat Apr 21, 2007 3:51 pm
Posts: 674
 Post subject:
PostPosted: Thu Nov 27, 2008 7:13 pm 
jfrazierjr wrote:
Ok... I am really darn close now. This spits out the right string, which I can copy/paste manually into an input(). But when I call the input directly in the macro with targetString as the argument, it barfs... Help?


I'm not sure the input function would like the <br> inside the targetString.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Thu Sep 11, 2008 1:04 pm
Posts: 925
 Post subject:
PostPosted: Fri Nov 28, 2008 12:23 am 
jfrazierjr wrote:
Ok... I am really darn close now. This spits out the right string, which I can copy/paste manually into an input(). But when I call the input directly in the macro with targetString as the argument, it barfs... Help?


Yea I think it looks right in chat but I think two things are wrong. First off like Lindharin said input() probably doesn't like <br>. The second problem is that you have ' in the string. But I'm pretty sure input() requires you to have " in it.

I'm guessing this is what you want?

Code:
[H: validTargets = "Ork, Goblin, Kobold"]
[h: numTargets = listCount(validTargets)]

<!--    MACRO SCOPPED VARIABLES -->
[h: attackTargets = ""]
[h: targetString= "input("]
Targets: {numTargets}<br>
[H,C(numTargets),CODE: {
   [h:  foo = eval( "targetNumber" +roll.count   +   "=" +  "''")   ];
}]

[C(numTargets,'<BR>'),CODE: {
   [h: targetString = targetString + ' "targetNumber' + roll.count + ' | 0 | ' + listGet(validTargets, roll.count) + ' | CHECK " ' + if(numTargets >  (roll.count+1) , " , " , "   ") ]
}]
[H: targetString = targetString + ")"]
{targetString}<BR>
[eval(targetString)]


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Sep 11, 2007 6:31 pm
Posts: 5410
 Post subject:
PostPosted: Fri Nov 28, 2008 2:24 pm 
Ok.. thanks to everyone, I have gotten a bit further. Now, I am having trouble with embedding a CODE block inside an if statement:

Code:
[h: numTargets = listCount(validTargets)]

<MACRO>
[h: attackTargets = ""]
[h: allTargets = ""]
[h: targetString= "input("]
[H,C(numTargets),CODE: {
   [h:  foo = eval( "targetNumber" +roll.count   +   "=" +  "''")   ];
}]

[C(numTargets,'<BR>'),CODE: {
   [h: targetString = targetString + ' "targetNumber' + roll.count + ' | 0 | ' + listGet(validTargets, roll.count) + ' | CHECK " ' + if(numTargets >  (roll.count+1) , " , " , "   ") ]
}]
[H: targetString = targetString + ")"]
[h: eval(targetString)]


[FOR(i ,0,listCount(validTargets)-1), CODE: {
    [h: thisRoll = eval("rollNum" + roll.count +   "=" + d20)  ]
   [h: attackString = if((eval("targetNumber" + roll.count) == 1), CODE:{["foo"]} , "bar"    )]
   [attackString]   
}]


If I replace that if statement inside the FOR loop to have "foo" instead of CODE:{["foo"]} (or any variation I have tried) it works and spits out the expected output based on which check boxes were selected.

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


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Thu Sep 11, 2008 1:04 pm
Posts: 925
 Post subject:
PostPosted: Fri Nov 28, 2008 3:59 pm 
jfrazierjr wrote:
If I replace that if statement inside the FOR loop to have "foo" instead of CODE:{["foo"]} (or any variation I have tried) it works and spits out the expected output based on which check boxes were selected.


That's cause you can't have CODE blocks in the middle of an if(). You need to set it up an an [if():] block like so.

Code:
 [h,if(eval("targetNumber" + roll.count) == 1),CODE: {
  [attackString = "foo"]
 };{
  [attackString = "bar"]
 }] 


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Thu Sep 11, 2008 1:04 pm
Posts: 925
 Post subject:
PostPosted: Tue Dec 02, 2008 6:14 pm 
b48 is out and your new options still aren't in the build yet. I was kinda looking forward to the TAB option as a way to improve some input displays.


Top
 Profile  
 
User avatar  Offline
Cave Troll
 
Joined: Tue Nov 25, 2008 4:29 pm
Posts: 43
Location: Huntersville, NC
 Post subject:
PostPosted: Tue Dec 02, 2008 6:23 pm 
I noticed that listSort() still doesn't exist in b48, either...


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 191 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





cron

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman