dcsFlashGames Trigger Overview:
With the 2.0 Release of dcsFlashGames we will be introducing the Trigger system. Triggers are used to integrate dcsFlashGames arcade with any module that depends on the database.
This should cover almost every and all module/component in existence.
The basic idea of the trigger is to allow developers to write their own code to integrate the features they want and not be dependent on dcsFlashGames release cycles to cover integration features. It became obvious that as other components and modules evolve, we had to constantly modify and release fixes/updates....or no longer support an integration.
With the introduction of the Trigger we now have an easy way to separate the core of dcsFlashGames from the integration features. Things such as CB will most likely stay at the core since it's such a large integration and their release cycles are predictable and stable.
Another key target of the Trigger is to allow for rapid development of 3rd party triggers that can easily be shared, modified and distributed.
At the heart of the trigger is a specially marked up SQL statement that can be 'triggered' after a certain event with a game. Currently, the only supported entry point for a trigger is when a score is beaten by another member.
So that's enough on what a trigger is...here is how it works.
Your triggers are entered in the admin side of the component..using the 'dcsFlashGames->Triggers' menu.
In this list you can choose to
1 grab them from our site
2 add your own
3 publish/unpublish/delete triggers.
When creating your own triggers, or modifying some you already have, there are several markups that can be replaced runtime. So when a trigger is called, these markups get replaced with the runtime evaluation of the data.
They include:
{loser} {winner} {score} {game} {url}
To cover these more in depth:
{loser} is replaced with the username of the losing member
{winner} is replaced with the wining member name
{score} is replace with the wining score
{game} is replaced with the name of the game
{url} is replaced with a sef'ed url that includes "index.php?option=com_dcs_flashgames&task=view&id=GAMEID". This can of course be appended with whatever you'd like. You can even opt not to use the url and write your own url if you want!
All of this is as FREE FORM and SQL COMPLIANT as reasonably possible. Utilizing these few markups will help you in making your triggers easier to write and share!
Here is an example trigger. This one will use the Private Messenger "JIM" to send a pm from the winner to the loser. It includes a subject, message with a link to the game and a small signature from our arcade.
INSERT INTO #__jim (username, whofrom, outbox, date, readstate, subject, message) VALUES ('{loser}','{winner}',1, now(), 0, 'You just lost your rank on {game}', 'You just got smoked by {winner} with a score of {score}!
You had better redeem your good name on {game}
Just a little note from the eKith Arcade
')
You can see how beautifully simple the design is meant to be. So now if you need to extend the arcade to meet the latest message board...no problem. NO need to wait on dcsFlashGames developers to get an update to you!
We will be building a repository of submitted triggers for everyone to use. You will be able to access this directly from the Triggers page of your site's admin backend.
This document may be revised as the concept evolves during the dcsFlashGames development cycle.
Thanks, and we always appreciate feedback and ideas to help our product evolve.
eKith.com