Purchase Form: Difference between revisions
No edit summary |
|||
Line 14: | Line 14: | ||
== 2. Buy Template == | == 2. Buy Template == | ||
The buy template is set by the table's "buytemplate" attribute. Hero Lab finds a panel with the specified id, and displays it under the description text. | |||
Note that instead of a panel, you can create a template with the id and the istransaction="yes" flag, and Hero Lab will use that template instead (by automatically generating a panel / layout with the appropriate id). | |||
The buy template you specify should generally use the "Transact" compset. It displays the transaction pick, allowing the user to edit the amount of money paid for the item, whether to buy the item for free, etc. | |||
The buy template is just a template backed by a pick, like any other. If you want to reuse the same template, but have it behave differently in different situations, you can set fields on the transaction pick during the [[TransactSetup Script]]. Those fields can then be checked by the buy template script, and the script can show or hide different controls based on their contents. | |||
You can also use the "xactspecial" attribute on the table portal to set the "@special" symbol in the [[TransactSetup Script]]. This allows you to have the script behave differently when called from different tables. (Note that when a gizmo form is being shown, you can do the same by setting the "xactspecial" attribute of the thing.) | |||
== 3. Add Buttons == | == 3. Add Buttons == |
Revision as of 18:12, 2 March 2011
See this image: Purchase Form Diagram
1. Stacking
The stacking behavior droplist is automatically shown or hidden by Hero Lab. It is shown if all of the following conditions are satisfied:
- The purchase form was NOT summoned from a chooser (choosers can only select one item at a time).
- The currently selected thing IS stackable.
- The currently selected thing is NOT info-only.
- A "buy panel" (see 2., below) IS being displayed.
- The portal IS flagged as allowstack="yes" (the default).
If it's not being displayed when you think it should be, make sure that the thing you selected is stackable. A pick may not be stackable if it's flagged as stacking="never" or its compset is set to forbid stacking.
2. Buy Template
The buy template is set by the table's "buytemplate" attribute. Hero Lab finds a panel with the specified id, and displays it under the description text.
Note that instead of a panel, you can create a template with the id and the istransaction="yes" flag, and Hero Lab will use that template instead (by automatically generating a panel / layout with the appropriate id).
The buy template you specify should generally use the "Transact" compset. It displays the transaction pick, allowing the user to edit the amount of money paid for the item, whether to buy the item for free, etc.
The buy template is just a template backed by a pick, like any other. If you want to reuse the same template, but have it behave differently in different situations, you can set fields on the transaction pick during the TransactSetup Script. Those fields can then be checked by the buy template script, and the script can show or hide different controls based on their contents.
You can also use the "xactspecial" attribute on the table portal to set the "@special" symbol in the TransactSetup Script. This allows you to have the script behave differently when called from different tables. (Note that when a gizmo form is being shown, you can do the same by setting the "xactspecial" attribute of the thing.)
3. Add Buttons
A number of buttons can be shown here:
- Close: Always shown. Closes the form without adding anything.
- Select: Only shown for choosers. Add the current selection to the hero, replacing any previous selection.
- Add: Shown for tables, unless they specify ismultiadd="no" in their definition. Adds the current selection without closing the purchase form.
- Add & Close: Always shown for tables. Adds the current selection and closes the purchase form.
- Customize: Only shown if the component for the table specifies addbehavior="customize".
If the thing you select has a gizmo with a form specified, adding the thing opens the form for you to edit the gizmo. However, this does not happen if the component for the table specifies addbehavior="customize". In this case, the form is only opened if the "Customize" button is pressed. Pressing "Add" or "Add & Close" adds the thing without customizing it.