RPTools.net

Discussion and Support

Skip to content

It is currently Tue Sep 19, 2017 7:02 pm 






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

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6237
 Post subject:
PostPosted: Tue Dec 02, 2008 9:48 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.



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


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Fri Mar 28, 2008 11:30 pm
Posts: 1866
Location: Layfayette Hill, PA
 Post subject:
PostPosted: Tue Dec 02, 2008 11:34 pm 
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.


Top
 Profile  
 
User avatar  Offline
TheBard
 
Joined: Tue Mar 21, 2006 7:26 pm
Posts: 3478
Location: Austin, Tx
 Post subject:
PostPosted: Sun Dec 07, 2008 11:17 am 
I should have read the last post first <groan>


Top
 Profile  
 
User avatar  Offline
Giant
 
Joined: Thu Nov 20, 2008 3:49 am
Posts: 183
Location: Germany (GMT +1)
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Fri Dec 12, 2008 5:27 am 
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:

_________________
"This web of time [...] embraces every possibility. We do not exist in most of them. In some you exist and not I, while in others I do, and you do not. [...] In yet another, I say these very same words, but am an error, a phantom."

J.L. Borges


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Aug 29, 2007 12:18 am
Posts: 756
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Tue Dec 16, 2008 9:18 am 
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.

_________________
My D&D 4e Campaign FrameworkMy Shadowrun 4e Campaign Framework
RPGA#: 5223846427 — Skype: Veggiesama — Fear the ferret.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Thu Sep 11, 2008 1:04 pm
Posts: 925
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Tue Dec 16, 2008 3:04 pm 
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.


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Fri Mar 28, 2008 11:30 pm
Posts: 1866
Location: Layfayette Hill, PA
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Fri Dec 19, 2008 12:18 am 
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

_________________
D&D3.5 / Pathfinder Framework


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Mon Jan 07, 2008 10:44 pm
Posts: 438
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Tue Mar 31, 2009 10:52 am 
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?


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sat Feb 21, 2009 10:56 pm
Posts: 375
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Tue Mar 31, 2009 11:18 am 
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.


Top
 Profile  
 
 Offline
Kobold
 
Joined: Wed Jan 19, 2011 5:01 pm
Posts: 10
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Mon Feb 07, 2011 3:11 pm 
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:
 "AtkRoll | 1 |"+d20roll+"| CHECK",
 "Die1 | 1 |"+DamageRoll1+"| CHECK",
 "Die2 | 1 |"+DamageRoll2+"| CHECK",
 "Die3 | 1 |"+DamageRoll3+"| CHECK")]


Top
 Profile  
 
 Offline
Kobold
 
Joined: Wed May 08, 2013 5:41 pm
Posts: 2
 Post subject: Re: input() and other new b42 macro functions
PostPosted: Thu Jun 20, 2013 2:02 pm 
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!


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

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





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

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman