Welcome Guest ( Log In | Register )

Furcadia - The Second Dreaming!!
 
Reply to this topicStart new topic
> Dream Statistics, More advanced version. Uses DS and PS
Aakanaar
post Jan 15 2008, 05:02 PM
Post #1
Group: Furres

Aakanaar

Ok, after some thought into it, and seeing recent attempts at re-doing the dream statistics code. I decided to write a much more robust system that utilizes some of the more recent changes in DS, including but not limited to PS.

This code is untested as of yet. When I get a chance to test it, i'll fix any bugs i find. Meantime, please feel free to post any bug reports, comments, or questions.

Thank you.

[ds]* Dream Statistics By Rafkin
* This code is copyrighted by Rafkin. Any code based off of this code, or direct copying of this code must contain this comment giving credit to Rafkin.
* Credit for the "Average Visitors Per Day" addition goes to Calite.

** INITIALIZATION **
* First we setup some variables
(0:0) When everything is starting up,
(5:300) set variable %up_minute to the value 0.
(5:300) set variable %up_hour to the value 0.
(5:300) set variable %up_day to the value 0.

* This checks if dream has been initialized for first time, and if not, initializes the PS
(0:0) When everything is starting up,
(1:621) and the PhoenixSpeak info {initialized} about this dream is not equal to 99,
(5:602) memorize that the PhoenixSpeak info {initialized} about this dream will now be 99.
(5:602) memorize that the PhoenixSpeak info {UpMinutes} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {UpHours} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {UpDays} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {TotalVisitors} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {TotalToday} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {MaxTotal} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {MaxToday} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {MaxMax} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {MaxDays} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {Incompletes} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {IncompletesToday} about this dream will now be 0.

** UPDATE UPTIME **
* Update the uptime. We'll go every minute instead of every second, for less stress on the server.
(0:101) When the time is 99:99 FST
(5:612) remember the PhoenixSpeak info {UpMinutes} about this dream, and put it in variable %upminutes.
(5:302) take variable %upminutes and add 1 to it.
(5:302) take variable %up_minute and add 1 to it.
(5:602) memorize that the PhoenixSpeak info {UpMinutes} about this dream will now be %upminutes.

(0:101) When the time is 99:99 FST
(1:620) and the PhoenixSpeak info {UpMinutes} about this dream is equal to 60,
(5:612) remember the PhoenixSpeak info {UpHours} about this dream, and put it in variable %uphours.
(5:302) take variable %uphours and add 1 to it.
(5:302) take variable %up_hour and add 1 to it.
(5:602) memorize that the PhoenixSpeak info {UpHours} about this dream will now be %uphours.
(5:602) memorize that the PhoenixSpeak info {UpMinutes} about this dream will now be 0.

(0:101) When the time is 99:99 FST
(1:620) and the PhoenixSpeak info {UpHours} about this dream is equal to 24,
(5:612) remember the PhoenixSpeak info {UpDays} about this dream, and put it in variable %updays.
(5:302) take variable %updays and add 1 to it.
(5:302) take variable %up_day and add 1 to it.
(5:602) memorize that the PhoenixSpeak info {UpDays} about this dream will now be %updays.
(5:602) memorize that the PhoenixSpeak info {UpHours} about this dream will now be 0.

** VISTOR COUNT
* This section simply updates the total number of visitors to the dream.
(0:9) When a furre arrives in the dream,
(5:612) remember the PhoenixSpeak info {TotalVisitors} about this dream, and put it in variable %totalvisitors.
(5:612) remember the PhoenixSpeak info {TotalToday} about this dream, and put it in variable %totaltoday.
(5:302) take variable %totalvisitors and add 1 to it.
(5:302) take variable %totaltoday and add 1 to it.
(5:602) memorize that the PhoenixSpeak info {TotalVisitors} about this dream will now be %totalvisitors.
(5:602) memorize that the PhoenixSpeak info {TotalToday} about this dream will now be %totaltoday.
** This line sets up the following trigger.
(5:612) remember the PhoenixSpeak info {MaxTotal} about this dream, and put it in variable %maxtotal.
** This line just sets up the Max Furres section below.
(5:318) set variable %current to the number of furres in the dream.

(0:9) When a furre arrives in the dream,
(1:204) and variable %totaltoday is greater than variable %maxtotal,
(5:602) memorize that the PhoenixSpeak info {MaxTotal} about this dream will now be %totaltoday.

** MAX FURRES
* This section keeps track of max number of visitors to the dream at the same time.
(0:9) When a furre arrives in the dream,
(1:623) and the PhoenixSpeak info {MaxToday} about this dream is less than %current,
(5:602) memorize that the PhoenixSpeak info {MaxToday} about this dream will now be %current.

(0:9) When a furre arrives in the dream,
(1:623) and the PhoenixSpeak info {MaxMax} about this dream is less than %current,
(5:602) memorize that the PhoenixSpeak info {MaxMax} about this dream will now be %current.

(0:9) When a furre arrives in the dream,
(1:620) and the PhoenixSpeak info {MaxMax} about this dream is equal to %current,
(5:602) memorize that the PhoenixSpeak info {MaxDays} about this dream will now be 0.

** INCOMPLETES
* This section keeps track of the number of furres who enter the dream but leave without finishing downloading
(0:10) When a furre leaves the dream,
(1:19) and the triggering furre (moved from/is standing at) position (0,0),
(5:612) remember the PhoenixSpeak info {Incompletes} about this dream, and put it in variable %incompletes.
(5:612) remember the PhoenixSpeak info {IncompletesToday} about this dream, and put it in variable %incompletestoday.
(5:302) take variable %incompletes and add 1 to it.
(5:302) take variable %incompletestoday and add 1 to it.
(5:602) memorize that the PhoenixSpeak info {Incompletes} about this dream will now be %incompletes.
(5:602) memorize that the PhoenixSpeak info {IncompletesToday} about this dream will now be %incompletestoday.

** NEW DAY
* This section resets the values for the new day
(0:101) When the time is 00:00 FST
(5:612) remember the PhoenixSpeak info {MaxDays} about this dream, and put it in variable %maxdays.
(5:318) set variable %current to the number of furres in the dream.
(5:302) take variable %maxdays and add 1 to it.
(5:602) memorize that the PhoenixSpeak info {TotalToday} about this dream will now be %current.
(5:602) memorize that the PhoenixSpeak info {MaxToday} about this dream will now be %current.
(5:602) memorize that the PhoenixSpeak info {IncompletesToday} about this dream will now be 0.
(5:602) memorize that the PhoenixSpeak info {MaxDays} about this dream will now be %maxdays.

** STATISTICS REPORT
* Finally, give the information to the requesting furre.
(0:31) When a furre says {!Stats},
(5:318) set variable %current to the number of furres in the dream.
(5:612) remember the PhoenixSpeak info {UpDays} about this dream, and put it in variable %updays.
(5:612) remember the PhoenixSpeak info {UpHours} about this dream, and put it in variable %uphours.
(5:612) remember the PhoenixSpeak info {UpMinutes} about this dream, and put it in variable %upminutes.
(5:612) remember the PhoenixSpeak info {TotalToday} about this dream, and put it in variable %totaltoday.
(5:612) remember the PhoenixSpeak info {MaxToday} about this dream, and put it in variable %maxtoday.
(5:612) remember the PhoenixSpeak info {IncompletesToday} about this dream, and put it in variable %incompletestoday.
(5:200) emit message {## Dream Statistics: Overview ##} to the triggering furre.
(5:200) emit message {Dream Uptime: %updays days, %uphours hours, %upminutes minutes.} to the triggering furre.
(5:200) emit message {**********************} to the triggering furre.
(5:200) emit message {Current Visitor Count: %current } to the triggering furre.
(5:200) emit message {Total Visitors Today: %totaltoday } to the triggering furre.
(5:200) emit message {Maximum Visitor Count Today: %maxtoday } to the triggering furre.
(5:200) emit message {%incompletestoday furres left before finishing dream download today.} to the triggering furre.
(5:200) emit message {**********************} to the triggering furre.
(5:200) emit message {Use '!Stats Uptime', '!Stats Total', '!Stats Max', or '!Stats Incompletes' for a more comprehensive report.} to the triggering furre.
(5:200) emit message {## End Dream Statistics Report ##} to the triggering furre.

(0:31) When a furre says {!Stats Uptime},
(5:612) remember the PhoenixSpeak info {UpDays} about this dream, and put it in variable %updays.
(5:612) remember the PhoenixSpeak info {UpHours} about this dream, and put it in variable %uphours.
(5:612) remember the PhoenixSpeak info {UpMinutes} about this dream, and put it in variable %upminutes.
(5:200) emit message {## Dream Statistics: Dream Uptime ##} to the triggering furre.
(5:200) emit message {Dream Uptime: %updays days, %uphours hours, %upminutes minutes.} to the triggering furre.
(5:200) emit message {%up_day days, %up_hour hours, %up_minute minutes since last upload/restart.} to the triggering furre.
(5:200) emit message {## End Dream Statistics Report ##} to the triggering furre.

(0:31) When a furre says {!Stats Total},
(5:612) remember the PhoenixSpeak info {TotalVisitors} about this dream, and put it in variable %totalvisitors.
(5:612) remember the PhoenixSpeak info {TotalToday} about this dream, and put it in variable %totaltoday.
(5:612) remember the PhoenixSpeak info {MaxTotal} about this dream, and put it in variable %maxtotal.
(5:612) remember the PhoenixSpeak info {UpDays} about this dream, and put it in variable %updays.
(5:200) emit message {## Dream Statistics: Total Visitors ##} to the triggering furre.
(5:200) emit message {This dream has seen %totalvisitors visitors total.} to the triggering furre.
(5:200) emit message {%totaltoday visitors have arrived today.} to the triggering furre.
(5:200) emit message {This dream has had a maximum of %maxtotal visitors in one day.} to the triggering furre.
(5:302) take variable %updays and add 1 to it.
(5:309) divide variable %totalvisitors by variable %updays and put the remainder in variable %unused.
(5:200) emit message {And an average visitor total of %totalvisitors per day.} to the triggering furre.
(5:200) emit message {## End Dream Statistics Report ##} to the triggering furre.

(0:31) When a furre says {!Stats Max},
(5:612) remember the PhoenixSpeak info {MaxToday} about this dream, and put it in variable %maxtoday.
(5:612) remember the PhoenixSpeak info {MaxMax} about this dream, and put it in variable %maxmax.
(5:612) remember the PhoenixSpeak info {MaxDays} about this dream, and put it in variable %maxdays.
(5:200) emit message {## Dream Statistics: Maximum Visitor Count ##} to the triggering furre.
(5:200) emit message {This dream has had %maxtoday simultaneous visitors today.} to the triggering furre.
(5:200) emit message {The record for number of simultaneous visitors is %maxmax } to the triggering furre.
(5:200) emit message {Which occured %maxdays days ago.} to the triggering furre.
(5:200) emit message {## End Dream Statistics Report ##} to the triggering furre.

(0:31) When a furre says {!Stats Incompletes},
(5:612) remember the PhoenixSpeak info {Incompletes} about this dream, and put it in variable %incompletes.
(5:612) remember the PhoenixSpeak info {IncompletesToday} about this dream, and put it in variable %incompletestoday.
(5:200) emit message {## Dream Statistics: Incomplete Downloads ##} to the triggering furre.
(5:200) emit message {%incompletestoday furres have left before finishing the dream download, today.} to the triggering furre.
(5:200) emit message {This makes for a total of %incompletes prospective visitors who changed their minds.} to the triggering furre.
(5:200) emit message {## End Dream Statistics Report ##} to the triggering furre.[/ds]


Edited to add average furres and days since MaxMax was reached.
Edited to fix average furres section. Also added credit for average furres suggestion to Calite.
Edited to fix a bug. unused variable

Go to the top of the page
 
+Quote Post
Calite
post Jan 15 2008, 07:40 PM
Post #2
Group: Furres

Calite

This may be the most detailed dream stats PS/DS I have ever seen, good job.

May I suggest adding an average visitors/day?

[ds]
**Average Visitors/Day. Works With Aakanaar's Dream Info Script**

(0:0) When everything is starting up,
(5:612) remember the PhoenixSpeak info {AverageFurres} about this dream, and put it in variable %average.
(5:612) remember the PhoenixSpeak info {TotalToday} about this dream, and put it in variable %totaltoday.
(5:303) take variable %average and add variable %totaltoday to it.
(5:308) divide variable %average by 2 and put the remainder in variable %notgonnausethis.
(5:602) memorize that the PhoenixSpeak info {AverageFurres} about this dream will now be %average.

**This Should Be Combined with Aakanaar's !info block**
(0:31) When a furre says {!info},
(5:612) remember the PhoenixSpeak info {AverageFurres} about this dream, and put it in variable %average.
(5:200) emit message {The average amount of furres a day is %average.} to the triggering furre.
[/ds]
Go to the top of the page
 
+Quote Post
Aakanaar
post Jan 15 2008, 10:09 PM
Post #3
Group: Furres

Aakanaar

Not bad. I did a quick experiment using notepad and a calculator, where I jotted down 6 numbers, and averaged them out by adding all six then deviding by six. Then I averaged them out with your method, adding the first two, devide by two, add the next, devide by two, and so on.

They wern't exactly the same. First came out to 12.67 and the second to 12.71. Close enough that they would end up being the same since the DS would only record the 12 part.

I may add that. I was also considering adding something else, which would simply count the days since MaxMax was reached, resetting to 0 if MaxMax was equalled or surpassed, so that I could change that one emit to include how many days had passed since MaxMax was reached.

Also, that averaging would probably be best done during the 00:00 FST trigger, rather than when the dream starts up.
Go to the top of the page
 
+Quote Post
Aakanaar
post Jan 15 2008, 10:43 PM
Post #4
Group: Furres

Aakanaar

Ok, both added.

Wish i could keep the ds box above from word wrapping. Would rather have it side scroll than word wrap.

As is, I'm going to add a link to a txt file with the code, as soon as I upload said file to a web site.

Edit: It just occured to me. I could do average without the added ps storage, by simply deviding the TotalVisitors by the UpDays
I'll make that change tomorrow morning.

Ok, that change has been made. Also added credit to Calite for suggesting the average furres per day, even if i went with different code to achive it. I wouldn't have thought to add it if it wern't for his suggestion. Thanks Calite.
Go to the top of the page
 
+Quote Post
Aakanaar
post Jan 17 2008, 10:12 AM
Post #5
Group: Furres

Aakanaar

Bah.. found a small bug. I set the %current when someone says !stats, but never use it. Gotta add that to the overview section.

Fixed.
Go to the top of the page
 
+Quote Post
Targath
post Feb 17 2008, 01:38 PM
Post #6
Group: Furres

Targath

I like this DS and am currently using it in one of my dreams. Sure makes it easier than writing up your own. smile.gif I would like to suggest a couple small additions. Perhaps add in a command for the dream owner to reset the database so that they do not have to use the actual PS commands to do so. Also, for dreams who wish to track unique visits vs. number of total visits, it might help to save something to each character and check to see if they have been there before, if not increase the unique visitor count. Other than that, I love how thorough this stats DS is. (I am capable of doing both myself, but just suggesting these for others who might not know how.) Thanks for sharing it.
Go to the top of the page
 
+Quote Post
Khindle
post Mar 12 2008, 01:05 AM
Post #7
Group: Furres

Khindle

This deserves to be stickied! Great job!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



Lo-Fi Version Time is now: 8th June 2026 - 08:46 PM