PDA

View Full Version : Is This Even Possible?


11-07-2000, 05:24 PM
Ok, this is a suggestion a member came up with about this during the last few days. I help out on a vB, but have no idea if this could be implemented. For reference, what we're wanting to do is get an experience system that is based on post number and how long they've been registered.

Anyway, the EXP could be calculated like this:

[(posts³)×(days)]^0.5

And from this I got a simple but very efficient way to calculate the Level:

[(posts³)×(days)]^(1/7) = EXP^(1 / 3.5)

And then the post count would almost make sense as Hit Points!

Here's how it would look with a few of the users here (copied from that post I did yesterday evening):

Acmlm
Moderator
Super Knight
Level: 29
HP: 821
EXP: 137168
Registered: Oct 2000

Drex
Bard
Level: 7
HP: 40
EXP: 1102
Registered: Oct 2000

Doctor Q5
Master Surgeon
Level: 13
HP: 125
EXP: 8149
Registered: Oct 2000

cloud120122
Moogle
Level: 4
HP: 16
EXP: 181
Registered: Oct 2000

Coach
Moderator
Level: 27
HP: 697
EXP: 108863
Registered: Oct 2000

Phoenix
Moderator
Level: 32
HP: 1028
EXP: 192189
Registered: Oct 2000

It would take just 1 EXP to get to LV 1, about 11 EXP to go up to LV 2, 46 EXP for LV 3, 3162 EXP for LV 10, 147885 EXP for LV 30, 883883 EXP for LV 50 and exactly 10000000 EXP for LV 100 ... so that pretty much makes a lot of sense, no?

Yeah, it's a bit confusing, but is it possible?

11-07-2000, 05:55 PM
Why not (i suppose you'll get more descriptive answer from more experienced members :D) but i'm afraid of mysql queries and overall performance.

11-07-2000, 06:03 PM
Yes it is possible and rather easy to implement if you know PHP.

11-08-2000, 11:46 AM
That member was me by the way :D

11-08-2000, 11:49 AM
have to wonder if "days registered" is a good indication of experience though.... more like number of forum visits or pages viewed would be better (and possible although it might be a performance issue on the server).

11-09-2000, 12:00 AM
Okay, that's good to know, but since I know of no one that is experienced in PHP, where would I get my start at? Any help in any direction would be appreciated. :)

11-09-2000, 10:57 AM
hm... this is a very interesting idea indeed :)
As sonn as I finish up my backend script I'll try it.

Anybody else wanna do it in the meantime? ;)

11-09-2000, 03:21 PM
In Showthread.php

Look for:
$userpostcount=$userinfo[posts];

After this put:
$days = unixtojd() - unixtojd($userinfo[joindate])
$userexp = round(pow(((pow($userpostcount,3))*($days)),0.5));
$userlevel = round(pow($userexp,(1 / 3.5)));

To show it in the templates open up the postbit template and put $userexp, $userlevel where you want them to show up at.

p.s. I think I got parentheses happy.

11-10-2000, 12:59 PM
talk about a fast hack! :)
nice work wluke

11-10-2000, 02:01 PM
This line looks better.
$days = unixtojd() - unixtojd($userinfo[joindate]);
:D

[Edited by PeF on 11-10-2000 at 12:48 PM]

11-10-2000, 08:38 PM
You guys are great! I'll see about getting something like this in place. :)

11-10-2000, 09:09 PM
Cool! I see you're doing a roleplay thing huh? ;) I'm sort of on the same boat

11-10-2000, 10:07 PM
Something to that effect...

This is the error I'm getting though...

Fatal error: Call to unsupported or undefined function unixtojd() in /home/sites/site114/web/forums/showthread.php on line 235

I get the same thing with the original code posted and with the line that said looks better...

11-11-2000, 07:13 AM
There must be something with your PHP version

11-11-2000, 01:32 PM
Coach - if you're running PHP3, then you won't be able to use unixtojd(). It may not even work if you're running PHP4 - you must have the Calendar extensions compiled into your PHP installation.

11-11-2000, 03:26 PM
Try this then. Slightly adapted from Wayne's code:

Look for:
$userpostcount=$userinfo[posts];

After this put:
$days = (time()-$userinfo[joindate])/86400;
$userexp = round(pow(((pow($userpostcount,3))*($days)),0.5));
$userlevel = round(pow($userexp,(1 / 3.5)));

11-11-2000, 08:57 PM
Thanks Ed.

That is what I came up with last night after playing with it for a while.

Sorry about the function. I downloaded the indexed manual so I know which versions different functions are introduced in.

11-13-2000, 10:02 PM
Yep, it's working perfectly now!

By the way, I've been working on some other hack, and it involves saving two new Yes/No values on the user profile. How can this be done? (just adding the "valuename=$valuename" thing on the "$DB_site->query("UPDATE user SET") line resulted in a database error)

12-08-2000, 04:48 AM
I have tried using Ed's code and added it into my vB. everything works fine. but somehow when i registered a new member and started posting with that one, the $userlevel and $userexp only showed 0 ... even after 4 posts. Any ideas?

Ohhh, Is it because in the code for EXP , it takes into account of the number of days you have been registered? and since the new member only just registered, the exp rises slowly? If thats the case ! Great! amazing ! This 'kinda' prevents posters to keep posting nonsense just to get exp ...!

[Edited by ryany on 12-08-2000 at 02:12 AM]

02-04-2001, 12:37 PM
this seems to be what i need as well.. does it work with 1.1.5 ?