List Input with Images: Difference between revisions
Jump to navigation
Jump to search
(New page: ==Full Code of List Input With Images Macro== <source lang="mtmacro" line> [H: tokenList=getExposedTokenNames()] [H: imgList = tokenList] [H: Num = listCount(imgList)] [h,COUNT(Num),CODE:...) |
No edit summary |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
The following is the full code for the [[Creating a List Input with Names and Images]] tutorial. | |||
< | <syntaxhighlight lang="mtmacro"> | ||
[H: tokenList=getExposedTokenNames()] | [H: tokenList=getExposedTokenNames()] | ||
[H: imgList = tokenList] | [H: imgList = tokenList] | ||
[H: Num = listCount(imgList)] | [H: Num = listCount(imgList)] | ||
Line 13: | Line 14: | ||
[h:status=input( | [h:status=input( | ||
"Target|"+imgList+"|Select Target|LIST|SELECT=0 ICON=TRUE ICONSIZE=30", | |||
"newName| |Enter a new name for this token" | |||
)] | )] | ||
[h:abort(status)] | [h:abort(status)] | ||
Line 25: | Line 26: | ||
[h:token.name=newName] | [h:token.name=newName] | ||
The token's name has been changed to <i>[r:newName]</i>. | The token's name has been changed to <i>[r:newName]</i>. | ||
</ | </syntaxhighlight> | ||
[[Category:Cookbook]] |
Latest revision as of 23:59, 15 March 2023
The following is the full code for the Creating a List Input with Names and Images tutorial.
[H: tokenList=getExposedTokenNames()]
[H: imgList = tokenList]
[H: Num = listCount(imgList)]
[h,COUNT(Num),CODE:
{
[h:tokenName=listGet(imgList,roll.count)]
[h,token(tokenName): image=getTokenImage()]
[h:imgList=listReplace(imgList,roll.count,tokenName+" "+image)]
}]
[h:status=input(
"Target|"+imgList+"|Select Target|LIST|SELECT=0 ICON=TRUE ICONSIZE=30",
"newName| |Enter a new name for this token"
)]
[h:abort(status)]
[h:targetName = listGet(tokenList,Target)]
[h:switchToken(targetName)]
[h:token.name=newName]
The token's name has been changed to <i>[r:newName]</i>.