RPTools.net

Discussion and Support

Skip to content

It is currently Wed Dec 13, 2017 7:52 am 






Reply to topic  [ 4 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Wed Sep 20, 2017 8:24 pm
Posts: 15
 Post subject: More questions on Forms and Frames
PostPosted: Thu Oct 12, 2017 2: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


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: More questions on Forms and Frames
PostPosted: Thu Oct 12, 2017 3:00 am 
Quote:
As I understand it:
0. openFrame states that a form is going to be created and calls displayForm to do it.
displayForm does the following:
1 Defines where the data from the form will be stored (by calling processForm): [h: processorLink = macroLinkText("processForm@Lib:token", "all")]
2 Performs an action on the data (printing it out to chat window: <form action="[r:processorLink]" method="json">
3 Sets up the input fields and the submit button.


0. no. basically you can copy paste the code of 'displayForm' completely inside the
{<h3>my form:</h3>
->here<-
}
It is however unwise to do that because of nesting levels of {}. So you call 'displayForm' which generates a bunch of html and the resulting html ends up between the {}. OpenFrame IS the macro that creates the form!
1. no, defines to which macro it will be send to when you click 'submit', nothing is stored.
it does this in this line:
<form action="[r:processorLink]" method="json">
2. no. it allows to user to interact with the form. The form (and the macro 'displayform') does NOTHING with the data!! It is literally 'a form'.
3. yes. (well... it generates the html for a submit button, that is send to 'openFrame' and that creates the fields and the button...but that's semantics).

and then there is "4.", which would be 'processForm'. This is the part where the result of the form is send. It is send in the form of a json object (IRC). So if you want to do anything with it, you will need to extract it first from the json and THEN you can do stuff with it (inside that macro).

note that this stuff is all on that wiki page, it helps to read the entire article, instead of only a part.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Kobold
 
Joined: Wed Sep 20, 2017 8:24 pm
Posts: 15
 Post subject: Re: More questions on Forms and Frames
PostPosted: Fri Oct 13, 2017 3:58 pm 
Thanks for the answer, it has made a big difference in my understanding.

I actually did read the whole tutorial a number of times prior to putting the post up.
I just required your answers to my questions and then a re-look at the tutorial and I suddenly understand some of the statements there.

There is a bit of a paradigm shift with using frames as apposed to more linear programming.
This is not any kind of criticism. I think anyone prepared to put the time into creating tutorials like this deserves a medal but some people (I am obviously one) need a little more detailed explanation.

Interestingly one section I obviously did miss was "Don't forget the token context"
Using the technique in the link there and your explanation of how the data flows between macros I was able to update Token properties.

Templar


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: More questions on Forms and Frames
PostPosted: Sat Oct 14, 2017 7:09 am 
good to hear!

now if you think that wiki could use some extra lines here and there so the message gets across better: contact craig (send him a pm) for wiki access. In the early days you could simply register there, but due to numerous spam bots that option has been closed down.

this will be much appreciated!

/cheerz.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 4 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman