Tutorial 8: Permanent daily visit counter

Let's say you want a permanent record of the amount of visits your Dream gets daily. This can be useful for giving you an idea of how popular your Dream is, and for scoping out good upload locations. (Because, let's face it, Dream owners have busy lives and can’t keep an eye on their Dream 24/7!) But the problem is, it'd be preferable to not have to reupload the Dream every day, or manually reset variables and strings just to keep track of daily values. The next tutorial will show you how to use PS in conjunction with DS parameters to automatically handle visit counts daily, and store those counts permanently.


So a permanent record of how many people have visited every day can be done with the help of PS entries in the Dream table, with the name of each entry following the format shown as follows:

Visits_YY-MM-DD

This can be accomplished with the help of the special text replacement string called [DATE] as well as the principle of partial text substitution to dynamically generate the names of the PhoenixSpeak entries for each day.

To accomplish this, we use the following triggers to not only generate new entries with names that all start with Visits_, but also have the Year, Month and Day appended at the end (that is, if they don't already exist). It will keep track of how many players visited the Dream during that specific day.

(0:9) When someone arrives in the Dream,

(1:626) and the PhoenixSpeak info {Visits_[DATE]} about this Dream does not exist,

(5:602) memorize that the PhoenixSpeak info {Visits_[DATE]} about this Dream will now be 1.

(0:9) When someone arrives in the Dream,

(1:625) and the PhoenixSpeak info {Visits_[DATE]} about this Dream exists,

(5:612) remember the PhoenixSpeak info {Visits_[DATE]} about this Dream, and put it in variable %VisitCounter.

(5:302) take variable %VisitCounter and add 1 to it.

(5:602) memorize that the PhoenixSpeak info {Visits_[DATE]} about this Dream will now be %VisitCounter.

As we know from the previous example, using $ automatically replaces the value, letting us to generate entries based on the exact date that it is currently, without requiring any more input.

For example, if today is October 16th, 2048, and the very first player to visit our Dream arrived, a PS entry named Visits_2048-10-16 would be created, with a value of 1.

If another player were to arrive sometime after while the day is still October 16th, 2048, the trigger would only remember (load) the value of the Visits_2048-10-16 entry, put it into a variable called %VisitCounter, raise the number that the variable is currently set to by 1, and then memorize (save) the value of the Visits_2048-10-16 entry to match the value of %VisitCounter, which is now 2.

Account E-Mail

Password