Page 13 of 13

Posted: Tue Dec 02, 2008 9:48 pm
by Rumble
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.

In case you're still fighting with it, I apparently had exactly the same idea, and doped out how to do this exact thing this morning. My code looks like:

Code: Select all

[h:expList="orc 1, orc 2, orc 3, orc 4, orc leader"]

[h:outputString=""]

[h,FOREACH(enemy,expList):outputString=outputString+" 'target"+roll.count+"|0|"+enemy+"|CHECK" + " ' " + ","]

[h:inputString=eval("input("+outPutString+" ' " + "def|AC|defense" + " ' "+ ")")]

[h:status=inputString]

[h:abort(status)]

[h:numEntries=listCount(expList)-1]
Number of items in list: [numEntries]<br>

[h:targList=""]

[h,FOR(i,0,numEntries):targList = if(eval("target"+i), listAppend(targList,listGet(expList,i)),targList)]
This builds a set of checkboxes from a list, then rebuilds a new list based on what was targeted (trimming out any unchecked dudes).

Posted: Tue Dec 02, 2008 11:34 pm
by lmarkus001
NOTE: What is documented here is NOT in B46/47/48. The "B46" changes documented here have not made it in to the build cycle.

Posted: Sun Dec 07, 2008 11:17 am
by RPTroll
I should have read the last post first <groan>

Re: input() and other new b42 macro functions

Posted: Fri Dec 12, 2008 5:27 am
by Daniel
Specific stuff that is not in, or not working (from my testing):

List operations:
listSort() - undefined function
optional alternative seperator argument for list functions does not seem to work

input():
- TAB type is not recognized


knizia.fan, could you highlight the functions that are not yet included in the current build on the front page? Would probably save a lot of questions and hair pulling on the part of people trying to use these functions. :lol:

Re: input() and other new b42 macro functions

Posted: Tue Dec 16, 2008 9:18 am
by Veggiesama
Daniel wrote:Specific stuff that is not in, or not working (from my testing):

List operations:
listSort() - undefined function
optional alternative seperator argument for list functions does not seem to work

input():
- TAB type is not recognized
In addition, strPropFromVars() and formatStrProp() are unrecognized on my end in b48.

Re: input() and other new b42 macro functions

Posted: Tue Dec 16, 2008 3:04 pm
by PyroMancer2k
Anyone know what happen to K.fan? He seems to have vanished. I know after b46 came out and didn't see the update of the additions he said were going into it he said that he would resubmit them but then no word.

The forum shows his last visited as - which I think means he hasn't logged into the new forums yet. And the last post he made was almost a month ago. Cause it seems without him all these changes he was adding aren't going into the build.

Re: input() and other new b42 macro functions

Posted: Fri Dec 19, 2008 12:18 am
by lmarkus001
The various bug fixes and enhancements listed in this thread and documented in the first post are generally not in the live version of MapTools (somehow they missed the build process and have not been discovered by Trevor). So here is a synopsis of what is actually in b46-48.

b42
* input() function - asks the user for multiple variables at once.
* abort(val) function - if val is zero, aborts execution and later calculations are not performed
* listGet(list, index) - returns the entry in the index position (first position is index 0)
* listDelete(list, index) - returns a new list with the item at index position deleted.
* listCount(list) - returns the number of list entries
* listFind(list, target) - returns the index of the target string in the list, or -1 if none of the list entries match.
* listAppend(list, target) - adds target to the end of the list
* listInsert(list, index, target) - inserts target before the entry at position index
* listReplace(list, index, target) - replaces the entry at position index with the target
* getStrProp(properties, key) - find a key and return the value, or "" if not found
* setStrProp(properties, key, value) - set the value for a key,inserting it if not present. Returns the new property string.
* deleteStrProp(properties, key) - delete a key. Returns the new property string.
* countStrProp(properties) - returns how many key/value settings are in the string.
* indexKeyStrProp(properties, N) - returns the Nth key in the list.
* indexValueStrProp(properties, N) - returns the Nth value in the list.
* varsFromStrProp(properties) - creates variables for each key and assigns the corresponding value. Returns the number of entries found.

b43
* getStrProp() now accepts an optional 3rd argument which is returned (instead of an empty string) when the key is not found. (Contributed by k.fan)

b46
* New looping options for rolls: WHILE(condition), FOR(var,start,end), FOREACH(var,list)
* New branching options for rolls: IF(condition), SWITCH(expression)
* New code calling options for rolls: MACRO("macro@location"), CODE

Re: input() and other new b42 macro functions

Posted: Tue Mar 31, 2009 11:52 am
by Plissken
Question about value...

I want to use a default value that is from the player's property sheet. How do I do this?

I tried a few variations (STR is the character's strength score):

1.) [H: input( "Strength | {STR} " ) ]
2.) [H: input( "Strength | [STR] " ) ]


3.) [h: var = STR ]
[H: input( "Strength | var " ) ]

4.) [H: input( "Strength | getProperty( STR ) " ) ]

None work.

Is it not possible to use a default value from the character's property sheet without knowing the value beforehand?

Re: input() and other new b42 macro functions

Posted: Tue Mar 31, 2009 12:18 pm
by tygaran
Plissken wrote:Question about value...
1.) [H: input( "Strength | {STR} " ) ]
2.) [H: input( "Strength | [STR] " ) ]
3.) [h: var = STR ]
[H: input( "Strength | var " ) ]
4.) [H: input( "Strength | getProperty( STR ) " ) ]
None work.
Is it not possible to use a default value from the character's property sheet without knowing the value beforehand?
You Need to use string concatenations. Something like this...

[h: input("Strength|"+STR)]

The value of STR would get added to the inpute string. So, if STR's value was 14, the process would replace +STR with +"14" and make th einpute line's string equivalent to "Strength|14" and give the results you need.

Re: input() and other new b42 macro functions

Posted: Mon Feb 07, 2011 3:11 pm
by XVRogue
Hey everyone, I'm trying to create a macro for a power that allows the use of rerolls.

What I'm looking to do is make a dialogue box that displays the various options for the attack.

i.e. it will ask for incidental bonuses, such as combat advantage, or cover, it will ask if the target is the quarry, if you have prime shot, etc.

All of that works just fine.

The other part of the input box is that it will display what you rolled to hit, and for your damage dice, and ask (using checkboxes) if you want to reroll them.

Now, using the inputs of 0/1 I have if statements later that reroll the dice based on these selections.

My issue is the following:

How can I make an input list display a variable.

Right now when I want it to display the attack roll, I've tried putting in my variable: {d20roll} and also as [d20roll] but it just displays it as a string written identically.

Is there anyway to make these input windows display a variable and not just the word?

EDIT: I figured it out, first I wrap the variable name in Quotes, and then I use + on either end for it to utilize the variable.

Example:

Code: Select all

 "AtkRoll | 1 |"+d20roll+"| CHECK",
 "Die1 | 1 |"+DamageRoll1+"| CHECK",
 "Die2 | 1 |"+DamageRoll2+"| CHECK",
 "Die3 | 1 |"+DamageRoll3+"| CHECK")]

Re: input() and other new b42 macro functions

Posted: Thu Jun 20, 2013 3:02 pm
by waltotheter
Everything works except for when I execute the attack command the last part of the code error's out. I've read over the forum but still can't figure it out. Here's the error.

   Error in body of roll.       Statement options (if any):       Statement Body : WpnMaxDamage_ + eval(WpnCritDamage_) + MiscDmg

I'm using your default attack code on the front page of this thread.

Let me know if you can help!