Ok .. based on many searches and lots of trials, it appears doing the image in the drop down in a frame/form isn't going to happen ...
Unless somebody has a nice solution?
Ok .. so I changed it to a list of option buttons (I tried image buttons, but they ended up too big, since we can't control image size) ...
The frame/form looks fine, however, not I'm running into problems with getting the macro/action to fire when you click a button ... I've gone over all the frame/form tutorials around ... and I just can't see what I'm doing that won't fire it ... I've tried to break down the code to see where it's failing, but from what I can tell, nothing is failing ... it's just not firing ...
So .. starting with your lib:disguise.
I added a new macro button on it, named "CreateImage".
And added this line into it ... simply to identify that "yes, it fired" ...
Code: Select all
[h: chk = input("Checkpoint: Change") ]
I then dropped this code in a macro on my token (for testing for now ... once I get it working, I'll drop it into the Disguise token ...).
Code: Select all
[h: processorLink = macroLinkText('ChangeImage@lib:disguise', 'all')]
[H: disguises = getProperty("h.disguise")]
[H: tokenImg = getTokenImage()]
[H, if(json.isEmpty(disguises)): disguises = "[]"]
[h: header = "<html><head><title>Disguise</title></head><body><form name='disguise' action='[r:processorLink]' method='json'>" ]
[h: footer = "</form></body></html>" ]
[h: buttons = "<input type='submit' name='Change' value='Change Image'> </input>" ]
[h: buttons = buttons + "<input type='submit' name='Remove' value='Remove Image'> </input>" ]
[H: inputStr = "<table border='0'>"]
[H, if(!json.contains(disguises,tokenImg)), code: {
[H: disguises = json.append(disguises,tokenImg)]
[h: inputStr = inputStr + strformat("<tr><b>Token Image added to Disguise List:</b></tr><tr><img src='%s' width=50 height=50></tr>",tokenImg) ]
};{
[H: inputStr = inputStr + "<tr><b>Change Token Image to add to Diguise List</b></tr> " ]
}]
[H: menu = -1]
[h: inputStr = inputStr + "<tr>" ]
[h, foreach ( item, disguises ), CODE: {
[h, if (tokenImg == item): ls = " checked='checked'"; ls = "" ]
[h: inputStr = inputStr + strformat("<input type='radio' value='%s' %s><img src='%s' width=50 height=50></input><br>", item, ls, item) ]
}]
[h: inputStr = inputStr + "</tr></table>" ]
[frame("Disguise"): { [r: header + inputStr + buttons + footer ] } ]
so then I click on that test button, it brings up the frame no problem .. it sees new images, it lists them .. perfectly ... so I click "Change Image" ... nothing.
if I run [r: macroLinkText("ChangeImage@lib:disguise", "all") ]
I get this back:
macro://ChangeImage@lib:disguise/all/Impersonated?
Which looks correct.
If I run [r: macroLink ( "test", "ChangeImage@lib:disguise", "all") ]
it creates a link .. when I click it ... input box comes up as expected ...
so why isn't the form picking it up? I'm soooo confused ...
I tried to reduce it to a smaller script .. and I got this ... it also doesn't fire:
Code: Select all
[h: processorLink = macroLinkText('ChangeImage@lib:disguise', 'all')]
[h: xx = '<form name="disguise" action="[r:processorLink]" method="json">
Character name: <input type="text" name="charName"><br>
Strength: <input type="text" name="str">
<input type="submit" name="Change" value="Change Image"> </input>
</form>' ]
[frame("test"): { [r: xx ] } ]
What am I missing? is it a privilege thing? ie macro on the lib:token is supposed to have some setting? I just don't get it ...