Ulysses Stuff > Ulysses Release Archives

UTimeM - UTime for MySQL

<< < (2/10) > >>

Ploo:
Looks like something I might use instead of the original UTime. I'm gonna see if I can learn some lua by modifying it to have another table called 'servers' which holds all the servers by id, ip and name. Then each SteamID will have one entry for each server they visit. Total time will be the amount of time they spent on all servers but I will also be able to see how much they spent on individual servers.

Consider this a suggestion too. Don't think I'll succeed.

NaRyan:
Nice version of Utime :D
I always had problems with the original Utime (after a few months the on-join crashes got realy bad, but deleting the sv.db file sorted it)

I do have one small problem though.
This version seems to have problems with some clan tags, and some unicode based names.
i.e my steam name is =ASY=Na'Ryan.

If I leave it set to that then it does not create/update the entry in the MySQL database.
When I change my name to NaRyan, it creates the info in the database just fine.
However if I change back to my clan tag name, it reads the info fine (total time), however it will not update the database.

Is there any way to have this version of Utime to ignore a players name, and just use their steamID?
Since player names can change 1001 times, but their steamID is always the same.

Thanks. :)

Edit.
Meh just realised it's because of the ' in my name.
Removing that fixes the problem.
No great loss removing that... Silly me should have realised that by looking at other player names in MySQL database...

ACProdigy:

--- Quote from: Ploo on January 07, 2010, 05:38:18 AM ---Looks like something I might use instead of the original UTime. I'm gonna see if I can learn some lua by modifying it to have another table called 'servers' which holds all the servers by id, ip and name. Then each SteamID will have one entry for each server they visit. Total time will be the amount of time they spent on all servers but I will also be able to see how much they spent on individual servers.

Consider this a suggestion too. Don't think I'll succeed.

--- End quote ---
There may be a better way to go about this. If you change the name of the table per server (i.e. "utime_s1", "utime_s2"), and keep it all in the same database "joes_utime" or some such, you could just use some more complicated MySQL queries to join them together when needed. Making a server table, in this case, seems a little out of the way. I'll look at implementing this (or just forking the development), if you're interested.


--- Quote from: NaRyan on January 07, 2010, 09:44:32 AM ---This version seems to have problems with some clan tags, and some unicode based names.


Edit.
Meh just realised it's because of the ' in my name.

--- End quote ---
Ah, I see. I'm glad you were able to resolve it, but it does show a mistake I made in the code. Thanks for pointing this out! I'll re-release it asap with a fix.
Edit: The above is fixed as of Version 4.

Ploo:

--- Quote from: ACProdigy on January 07, 2010, 10:03:41 AM ---There may be a better way to go about this. If you change the name of the table per server (i.e. "utime_s1", "utime_s2"), and keep it all in the same database "joes_utime" or some such, you could just use some more complicated MySQL queries to join them together when needed. Making a server table, in this case, seems a little out of the way. I'll look at implementing this (or just forking the development), if you're interested.

--- End quote ---

I still belive my method would be simpler. UTime checks if it has its own entry in the servers table (by simple checking if there's an entry with it's IP), if not, it enters an entry with its ip, hostname and an id (incase the server IP changes and you wanna keep the utime, this would obviously require the user to change the ip in the entry manually).

The utime table would contain entires with an additional column of server_id.

When counting the total UTime, simple query the utime table for a certain UID. Add up the results.

I think having utime_s1, utime_s2 wouldn't be a good option for several reasons. a) You would have to edit the luas for each server to tell it if its s1, s2 or whatever. b) You would have edit each lua to tell how many servers there are (and tables). c) If my concept executed correctly, it would require no involvment from the installer at all. Obviously this would all be in the same database.

I hope you understand. :P

ACProdigy:

--- Quote from: Ploo on January 07, 2010, 12:36:54 PM ---I think having utime_s1, utime_s2 wouldn't be a good option for several reasons. a) You would have to edit the luas for each server to tell it if its s1, s2 or whatever. b) You would have edit each lua to tell how many servers there are (and tables). c) If my concept executed correctly, it would require no involvment from the installer at all. Obviously this would all be in the same database.

I hope you understand. :P

--- End quote ---
I believe I understand now. I misunderstood your original comment. This would still require each separate server instance to have a unique identifier hard-coded into the lua configuration. Something like:

--- Code: -------- Database connection details -----

local dbhost = "0.0.0.0" -- Your MySQL IP / Hostname
local dbuser = "USER" -- MySQL Username
local dbpass = "PASSWORD" -- MySQL Password
local dbport = "3306" -- MySQL Server Port
local dbname = "DATABASE" -- Database name
local unique = "1" -- Unique gameserver identifier.

--=== DO NOT EDIT BELOW THIS POINT ====

--- End code ---

Then the rest could be handled by whatever parses the rows, in order to add them up. That wouldn't be difficult at all really. I suggest a unique ID is manually specified in the header variables like so, as it would make it much easier to automatically update the IP/Servername later on.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version