Macro Error help

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
flekhabren
Cave Troll
Posts: 29
Joined: Fri Aug 10, 2012 7:23 am

Macro Error help

Post by flekhabren »

I'm trying to dynamically generate a list of numbers to use on an input box to select the level of a power used. When I use the code below I only get the original value of mList.

[While(count<=mList), code:{[listAppend(mList,count)][h:count=count+1]}]
[h:mLevel=listSort(mList,"N")]

I figured out it was appending but not updating the list after appending the value. So when I adjusted it to this I get an "Error in body of roll.

[While(count<=mList), code:{[h:mList = listAppend(mList,count)][h:count=count+1]}]
[h:mLevel=listSort(mList,"N")]

I dont understand.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Macro Error help

Post by wolph42 »

In the loop you get while count<=1,2,3 ... Which makes no sense. Hence an error

You probly want something like

Code: Select all

[count(5):mlist=listappend(mlist, roll.count)]

flekhabren
Cave Troll
Posts: 29
Joined: Fri Aug 10, 2012 7:23 am

Re: Macro Error help

Post by flekhabren »

for example if mList=7

I want count to start at 1 building a list of 7,1,2,3,4,5,6 and then sorting it.

or if mList is 12, 12, 1, 2, ..., 10, 11

then sort it in order putting the largest number in back. so that I end up with a count of 1 to X

maybe i need to specify the first value in the list in the while statement?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Macro Error help

Post by wolph42 »

That's exactly what my code does.
Just add
[num=mlist] and change count(5) into count(num) to make it generic

flekhabren
Cave Troll
Posts: 29
Joined: Fri Aug 10, 2012 7:23 am

Re: Macro Error help

Post by flekhabren »

That worked great. Thanks.

Post Reply

Return to “Macros”