Difference between revisions of "Transactions"

From HLKitWiki
Jump to: navigation, search
(Buying an Item)
(Buying an Item)
Line 15: Line 15:
 
== Buying an Item ==
 
== Buying an Item ==
  
When you purchase an item, the [[TransactBuy Script]] runs. The script chosen is the one for the component on which the table is based. You can use this script to make changes to the hero, such as modifying the quantities of currency available in usage pools based on the buy price.
+
A [[TransactBuy Script]] is invoked at two points:
  
You can access the transaction pick from within the [[Creation Script]] for a component. This allows the user to modify fields on the transaction pick, which can then be checked from within the [[Creation Script]] as the pick is created. Using this method, you can configure fields on the new pick based on the settings on the transaction pick.
+
# When you add an item of gear that is not customized (i.e. it does not have a gizmo with a form associated with it, or the form is not shown because the "Customize" button was not pressed)
  
Note that when you buy something with an entity, and a "buy template" is specified for the gizmo form, the [[TransactBuy Script]] will not run until the user clicks "OK" on the gizmo form.
+
# When you click "OK" on the gizmo form of an item of gear that was just added.
 +
 
 +
At these points, the [[TransactBuy Script]] runs. The script chosen is the one for the component on which the table through which the item was added is based.
 +
 
 +
You can use this script to make changes to the hero, such as modifying the quantities of currency available in usage pools based on the buy price.
 +
 
 +
Also, you can access the transaction pick from within the [[Creation Script]] for a component. This allows the user to modify fields on the transaction pick, which can then be checked from within the [[Creation Script]] as the pick is created. Using this method, you can configure fields on the new pick based on the settings on the transaction pick.
  
 
== Selling an Item ==
 
== Selling an Item ==

Revision as of 17:23, 1 March 2011

A "transaction" takes place when the user adds certain game-system-dependent items of gear to the hero. It involves a TransactSetup Script, and either a TransactBuy Script or a TransactSell Script.

Setup

A TransactSetup Script is invoked at two points:

  1. When the user selects an item of gear on a choose form.
  1. When the user clicks the "delete" button for an item of gear.

Using this script, you can set up fields on the transaction pick. The transaction pick's fields hold information about the current transaction, before the transaction is executed.

For example, a common set of data for the transaction pick to hold is the buy or sell price of the current item. Before the user buys or sells the item, he can often change those values, which are then used in the TransactBuy Script or TransactSell Script.

Buying an Item

A TransactBuy Script is invoked at two points:

  1. When you add an item of gear that is not customized (i.e. it does not have a gizmo with a form associated with it, or the form is not shown because the "Customize" button was not pressed)
  1. When you click "OK" on the gizmo form of an item of gear that was just added.

At these points, the TransactBuy Script runs. The script chosen is the one for the component on which the table through which the item was added is based.

You can use this script to make changes to the hero, such as modifying the quantities of currency available in usage pools based on the buy price.

Also, you can access the transaction pick from within the Creation Script for a component. This allows the user to modify fields on the transaction pick, which can then be checked from within the Creation Script as the pick is created. Using this method, you can configure fields on the new pick based on the settings on the transaction pick.

Selling an Item

When the user clicks "OK" on the "Are you sure you want to sell this item?" form, the TransactSell Script runs. This script can make changes to the hero, such as modifying the quantities of currency available in usage pools based on the sell price.

After the script runs, the pick is deleted.