Thanks for the help in the past. I have another, probably quick, question.
I would like a popup dialogue that lists all the states and how they are currently set, in check box format. Bonus points if we can get them in 2 columns.
(I figure later I can use deleteStrProp or listDelete to remove out the ones I do not care about, before parsing them)
I currently have a macro that does just that, but it is A LOT of lines of code. I got the idea in my head to really boil it down to an easy core of code, but I do not know how to get it into the dialogue input...
Very brief example of what I have now (incomplete example)
Code: Select all
[h: statusBlind = getState("Blind")]
[h: statusConfused = getState("Confused")]
[h: statusDazed = getState("Dazed")]
[h: statusDazzled = getState("Dazzled")]
[h: statusDeafened = getState("Deafened")]
[h: statusDisabled = getState("Disabled")]
[h: statusDying = getState("Dying")]
[h: statusEntangled = getState("Entangled")]
[h: statusExhausted = getState("Exhausted")]
[h: statusFatigued = getState("Fatigued")]
[h: statusGrappled = getState("Grappled")]
[h: statusInvisible = getState("Invisible")]
[h: statusNauseated = getState("Nauseated")]
[h: statusParalyzed = getState("Paralyzed")]
[h: statusProne = getState("Prone")]
[h: statusShaken = getState("Shaken")]
[h: statusSickened = getState("Sickened")]
[h: statusStaggered = getState("Staggered")]
[h: statusStunned = getState("Stunned")]
[h: statusUnconscious = getState("Unconscious")]
[h: abort(input(
strformat("statusBlind|%{statusBlind}|Blind|CHECK|"),
strformat("statusConfused|%{statusConfused}|Confused|CHECK|"),
strformat("statusDazed|%{statusDazed}|Dazed|CHECK|"),
strformat("statusDazzled|%{statusDazzled}|Dazzled|CHECK|"),
strformat("statusDeafened|%{statusDeafened}|Deafened|CHECK|"),
strformat("statusDisabled|%{statusDisabled}|Disabled|CHECK|")
))]
Ignore everything from the wiki example except for the <!-- Build input form advanced --> section. That's what I want to work. (the example is mostly unchanged, because everything I have tried won't work properly. I just input junk variables topically so you understand the intent)
(Edited, removed non-essential code, to make clear the question and intent)
Code: Select all
<!-- Delete me -->
[h: resetAllStates = 0]
[h: listPile = ""]
[h: statesPile = getTokenStates()]
[h, FOREACH(current, statesPile), CODE:
{
[h: stateOutput = 0]
[h: stateOutput = getState(current)]
[h: listPile = listAppend(listPile, current)]
[h: listPile = listAppend(listPile, stateOutput)]
}
]
<!-- Build input form advanced -->
[H: inputStr = json.append(inputStr,"junk|<html><b>A complex example</b></html>|-|LABEL|SPAN=TRUE")]
[H, foreach(stat,listPile): inputStr = json.append(inputStr, strformat("state|%{state}|status|CHECK|"),"))]
<!-- put local variables in input form -->
[H: inputStr = json.evaluate(inputStr)]
<!-- get user input -->
[H: hasInput = input(json.toList(inputStr,"##"))]