Raised This Month: $32 Target: $400
 8% 

A cookie system


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 05-12-2007 , 10:33   A cookie system
Reply With Quote #1

I was planning on writing an extension that would implement a 'cookie' system for SourceMod which would allow per-player (and per-plugin, where plugins can't access other plugins' cookies) long-term storage of basic data. But, I would like to know if scripters think if this would be useful or not... here's my current idea for implementation: http://www.ampaste.net/10980

Supports use of all the basic types (string, number (integer), float, and bool) while giving each cookie a lifetime, or expiration.

Anyways, just wanted to see if this kind of thing would be worth making. Suggestions are always welcome.
__________________
sslice is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 05-12-2007 , 10:42   Re: A cookie system
Reply With Quote #2

I don't see why not, like I said and bail said, I currently use keyvalues because it's the best, and as far as I know, only long term data storage system in sourcemod. An alternative would be great.
FlyingMongoose is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 05-12-2007 , 13:35   Re: A cookie system
Reply With Quote #3

I like the "autocleanup" based on the expiration.

L. Duke is offline
BAILOPAN
Join Date: Jan 2004
Old 05-12-2007 , 14:26   Re: A cookie system
Reply With Quote #4

AMX Mod X had a system like this for HL1 called "nVault" -- it was a bit more generic. You could create a vault where you could store arbitrary key/value pairs, and each pair was timestamped so you could expire them.

The only problem was that it was flat; your idea has different key/val pairs for each player, which is an interesting thought.

Note that if you just wanted to play around with the API, you could use KeyValues internally. Once sqlite support comes around, it may be easiest to move to that, unless you have something more efficient in mind.
__________________
egg
BAILOPAN is offline
sskillz
Member
Join Date: Apr 2005
Old 05-12-2007 , 15:30   Re: A cookie system
Reply With Quote #5

If their isn't any vault yet why not
And can I have a link explaning "keyvalues" ?
sskillz is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 05-12-2007 , 17:07   Re: A cookie system
Reply With Quote #6

http://wiki.alliedmods.net/KeyValues...d_Scripting%29
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 05-12-2007 , 23:38   Re: A cookie system
Reply With Quote #7

I planned on doing all of the storage manually (taking advantage of hash lookups, sorting based on usage, etc.) and storing to file on every level transition... I noticed nVault had a journaling system which is nice. The cookies system would probably have to have something similar.

Steam ID and IP lookup will be very fast since both are easy to make 32-bit keys out of (reversible, too).

Edit: One thing that I am not sure about is how the value of the cookie should be stored internally...should it always be stored as a string? Or, should it depend on what it was last set as, and make its type dynamic--similar to how KeyValues works I believe, with a union and whatnot.
__________________

Last edited by sslice; 05-12-2007 at 23:54.
sslice is offline
BAILOPAN
Join Date: Jan 2004
Old 05-13-2007 , 02:03   Re: A cookie system
Reply With Quote #8

Always a string is probably best, like a cvar, it's easier to go back and forth between types.
__________________
egg
BAILOPAN is offline
API
Veteran Member
Join Date: May 2006
Old 05-13-2007 , 12:34   Re: A cookie system
Reply With Quote #9

I would assume that a good syntax would be:
InitCookieSystem(maxplayers,TYPE_INT);
__________________
API is offline
Send a message via AIM to API
sskillz
Member
Join Date: Apr 2005
Old 05-13-2007 , 16:32   Re: A cookie system
Reply With Quote #10

Quote:
Originally Posted by teame06 View Post
Thanks, just as a ini file just with sub sections (Maybe more as a hash of hashes).
sskillz is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode