More questions on Forms and Frames
Posted: Thu Oct 12, 2017 3:42 am
Hi yet again,
Sorry that I keep putting these posts up but I really want to get the most out of MapTools if possible.
Unfortunately we have our own custom system that we have been playing for about 30 years now so I can't really use the fantastic pre-made macros that are available for downloading.
I have pretty much got the hang of Dialogues and have made a few basic macros but am interested in trying to work with Forms and Frames.
Unfortunately there are some basic concepts I seem to be missing.
After looking at some more complex Campaign downloads I decided to start simple (yeah I know, Obvious right).
I have been looking at this tutorial :
http://www.lmwcs.com/rptools/wiki/Forms ... t.2Feditor
Simple as it is, I still have some issues.
As I understand it:
openFrame states that a form is going to be created and calls displayForm to do it.
displayForm does the following:
- Defines where the data from the form will be stored (by calling processForm): [h: processorLink = macroLinkText("processForm@Lib:token", "all")]
- Performs an action on the data (printing it out to chat window: <form action="[r:processorLink]" method="json">
- Sets up the input fields and the submit button.
<---openFrame--->
[frame("myForm"): {
<h3>my form:</h3>
[r, macro("displayForm@Lib:token"): ""]
}]
<---displayForm--->
[h: processorLink = macroLinkText("processForm@Lib:token", "all")]
<form action="[r:processorLink]" method="json">
Character name: <input type="text" name="charName"><br>
Strength: <input type="text" name="str"><br>
<input type="submit" name="myForm_btn" value="Okay">
</form>
<---processForm--->
<pre>
[r: json.indent(macro.args,2)]
</pre>
======================================================
Assuming I have this correct (no certainty there )
I was interested in trying to do something else with the data.
I would like to take the 2 pieces of data into separate variables, modify them and add them to a token property.
e.g.
[TokenCharName = charName]
[TokenStrengh = str]
Assuming these are 2 token property names.
I have tried this and nothing seems to work.
Unfortunately I can't work out where to do it.
Since this is the line that "does something": <form action="[r:processorLink]" method="json">
I thought it might be in here. Perhaps using "code:{}" ??
Is anyone keen on doing some explaining to me?
Templar
Sorry that I keep putting these posts up but I really want to get the most out of MapTools if possible.
Unfortunately we have our own custom system that we have been playing for about 30 years now so I can't really use the fantastic pre-made macros that are available for downloading.
I have pretty much got the hang of Dialogues and have made a few basic macros but am interested in trying to work with Forms and Frames.
Unfortunately there are some basic concepts I seem to be missing.
After looking at some more complex Campaign downloads I decided to start simple (yeah I know, Obvious right).
I have been looking at this tutorial :
http://www.lmwcs.com/rptools/wiki/Forms ... t.2Feditor
Simple as it is, I still have some issues.
As I understand it:
openFrame states that a form is going to be created and calls displayForm to do it.
displayForm does the following:
- Defines where the data from the form will be stored (by calling processForm): [h: processorLink = macroLinkText("processForm@Lib:token", "all")]
- Performs an action on the data (printing it out to chat window: <form action="[r:processorLink]" method="json">
- Sets up the input fields and the submit button.
<---openFrame--->
[frame("myForm"): {
<h3>my form:</h3>
[r, macro("displayForm@Lib:token"): ""]
}]
<---displayForm--->
[h: processorLink = macroLinkText("processForm@Lib:token", "all")]
<form action="[r:processorLink]" method="json">
Character name: <input type="text" name="charName"><br>
Strength: <input type="text" name="str"><br>
<input type="submit" name="myForm_btn" value="Okay">
</form>
<---processForm--->
<pre>
[r: json.indent(macro.args,2)]
</pre>
======================================================
Assuming I have this correct (no certainty there )
I was interested in trying to do something else with the data.
I would like to take the 2 pieces of data into separate variables, modify them and add them to a token property.
e.g.
[TokenCharName = charName]
[TokenStrengh = str]
Assuming these are 2 token property names.
I have tried this and nothing seems to work.
Unfortunately I can't work out where to do it.
Since this is the line that "does something": <form action="[r:processorLink]" method="json">
I thought it might be in here. Perhaps using "code:{}" ??
Is anyone keen on doing some explaining to me?
Templar