I DID IT!!!!
<doin' the Snoopy dance>
I made an HTML5 frame.
I built a form, like so:
Code: Select all
[h: processFormLink=macroLinkText("processForm@Lib:Torg", "all")]
<form name="LastRollForm" id="LastRollForm" action=[r: processFormLink] method="get">
<input type="hidden" name="tokID" value=[r: TokID]>
<input type="hidden" name="tokTorg" value=[r: tokTorg]>
<input type="hidden" name="mName" value=[r: getCurrentMapName()]>
<br><br>
Last Roll
<input name="LastRoll" id="LastRoll" type="number" onchange="valueChange('LastRoll', 'LastRollForm')" value='[r: getProperty("LastRoll")]'>
</form>
I created a Javascript script and put it in character sheet's <head>, like so:
Code: Select all
<!--submits form on value change-->
<script type="text/javascript">
[r:"function valueChange(id, form) {
document.forms[form].submit();
}
"]
</script>
...and, I created a macro for the form submit action, like so:
Code: Select all
<!-- Get macro args-->
<!--tokID,tokTorg,mName,textInputName-->
[h: mArgs=macro.args]
<!-- Get Token ID-->
[h: TokID = json.get(mArgs, "tokID")]
<!--Get Map Name of Target Token-->
[h: mName = json.get(mArgs, "mName")]
<!-- Get Torg Library Token ID-->
[h: tokTorg = json.get(mArgs, "tokTorg")]
<!-- Remove Non-Skill related entries in mARgs-->
[h:mArgs = json.remove(mArgs, "tokID")]
[h:mArgs = json.remove(mArgs, "mName")]
[h:mArgs = json.remove(mArgs, "tokTorg")]
<!--Get Tken Property Name from mArgs-->
[r: tokProp = json.fields(mArgs)]
[r: propValue = json.get(mArgs, tokProp)]
[r: setProperty(tokProp, propValue, tokID, mName)]
So, you change a value in the text input box, it fires the onchange event which calls the javascript script.
The javascript 'submits' the form, which runs the MT macro.
The MT macro grabs the changed value and (silently and invisibly) writes it to the Token Property!
This will work for Proof of Concept.
I have to add error checking and stuff, but...IT WORKED!!!