AddCondition(0, cf_trigger, "Payment complete", "Payments", "On payment complete", "Triggered when the user has successfully bought a good", "Onpurchsuccess");
AddCondition(1, cf_trigger, "Payment failed", "Payments", "On payment failure", "Triggered when the user fails to buy a good", "Onpurchfail");
What we just did was added a trigger which will run when a user either completes a purchase or when something else happens(Facebook error, or user cancelled dialog). Let's pick apart the first line so you can understand better.
After the AddCondition( you see:
0 -- This is the numerical index for the condition and must be unique. You cannot have two lines of 1 for example without an error. Also I do not believe they need to be in order.
cf_trigger, -- This is the type of condition we want to use. This could be any number of choices listed in the examples above line 58. Ours means that it will happen everytime a certain action completes( the action is defined in a different file)
"Payment complete", -- When you are choosing which condition to use for an event, this is what will be displayed.
"Payments", -- the category that it appears when deciding which condition to use for our plugin.
"On payment complete", -- How it appears in our event sheet.
"Triggered ...", The description of the condition in case someone needs a little help choosing.
"Onpurchsuccess"); -- This option is the invisible name of the condition which we will be referencing in our next file.