Purchase Form: Difference between revisions

From HLKitWiki
Jump to navigationJump to search
 
Line 16: Line 16:


The buy template is optional, chosen by the table's "buytemplate" attribute. Hero Lab finds a panel with the specified id, and displays it under the description text. Note that to save time, you can create a template with that 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 is optional, chosen by the table's "buytemplate" attribute. Hero Lab finds a panel with the specified id, and displays it under the description text. Note that to save time, you can create a template with that id and the istransaction="yes" flag, and Hero Lab will use that template instead (by automatically generating a panel / layout with the appropriate id).
(Note that when viewing a gizmo form, the buy template shown is specified by the thing's "buytemplate" attribute, not the table's.)


The buy template you specify should generally use the "Transact" compset to display the transaction pick, allowing the user to edit the amount of money paid for the item, whether to buy the item for free, etc. Other capabilities depend on the behavior of the transaction pick for your game system.
The buy template you specify should generally use the "Transact" compset to display the transaction pick, allowing the user to edit the amount of money paid for the item, whether to buy the item for free, etc. Other capabilities depend on the behavior of the transaction pick for your game system.

Latest revision as of 17:06, 8 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:

  1. The purchase form was NOT summoned from a chooser (choosers can only select one item at a time).
  2. The currently selected thing IS stackable.
  3. The currently selected thing is NOT info-only.
  4. A "buy panel" (see 2., below) IS being displayed.
  5. 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 optional, chosen by the table's "buytemplate" attribute. Hero Lab finds a panel with the specified id, and displays it under the description text. Note that to save time, you can create a template with that id and the istransaction="yes" flag, and Hero Lab will use that template instead (by automatically generating a panel / layout with the appropriate id).

(Note that when viewing a gizmo form, the buy template shown is specified by the thing's "buytemplate" attribute, not the table's.)

The buy template you specify should generally use the "Transact" compset to display the transaction pick, allowing the user to edit the amount of money paid for the item, whether to buy the item for free, etc. Other capabilities depend on the behavior of the transaction pick for your game system.

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.

Note that since the buy template can be displayed through several evaluations, fields set in the TransactSetup Script to affect it should be flagged as "persistent" if they aren't user fields. Otherwise they'll be reset whenever an evaluation happens.

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. (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.