Forums » Community Projects
Player Kill/Death Recorder (WIP - Download Available)
What the plugin does: Display PK history with any player you meet in VO as well as keeping a total tally.
Okay there are some things missing and some bugs to this plugin I will develop but I lack of a lot of technical experience with Lua and i'll list them:
Currently being developed:
* Ratio displaying in a controlled and formatted way. (Get rid of #INF and make it 2d.p)
* Making sure Reading Transponder player names don't creep in, though generally they wont anyway.
* Display PK information on a character on demand, /pksearch NAME = Kills, Killed by, Ratio.
* Cleaning up the code.
* Extensive testing is ongoing.
But what's working:
* /PKD command works to total things up
* PK information regarding a player should pop-up when you enter a sector/they enter your sector. I.E How many times you killed them and vice versa.
* PK information is saved in sector notes and so follows you around on physical computer (and character, as every character has a different system notes store) only.
You can download the plugin and continue to use it as it develops because it is loading and saving the information from system notes fine and I doubt I will change that.
Please: Submit changes and suggestions, I am by no means a pro at these things. The basic framework for this plugin works and I'm willing to iron out the bugs, please post positive and negative feedback. All versions of the file will be listed below so people can view the plugin changing over time and we all have a record.
And a final note: You obviously can't use this as proof you killed someone or you're awesome at taking PK's as results are easy to forge, but for personal records I find it very interesting!
http://www.sendspace.com/file/8azejg (3kb) V- 1.0a
http://www.sendspace.com/file/t02jt0 (3kb) V- 1.0b || (Data wasn't loading on startup properly/at the right time, inserted a quick fix but a more robust solution should be found later)
http://www.sendspace.com/file/jcxsgl (3kb) V- 1.0c || Proper timing of loading sector notes identified by draugath, untested but very likely to be stable and more robust than 1.0b.
Okay there are some things missing and some bugs to this plugin I will develop but I lack of a lot of technical experience with Lua and i'll list them:
Currently being developed:
* Ratio displaying in a controlled and formatted way. (Get rid of #INF and make it 2d.p)
* Making sure Reading Transponder player names don't creep in, though generally they wont anyway.
* Display PK information on a character on demand, /pksearch NAME = Kills, Killed by, Ratio.
* Cleaning up the code.
* Extensive testing is ongoing.
But what's working:
* /PKD command works to total things up
* PK information regarding a player should pop-up when you enter a sector/they enter your sector. I.E How many times you killed them and vice versa.
* PK information is saved in sector notes and so follows you around on physical computer (and character, as every character has a different system notes store) only.
You can download the plugin and continue to use it as it develops because it is loading and saving the information from system notes fine and I doubt I will change that.
Please: Submit changes and suggestions, I am by no means a pro at these things. The basic framework for this plugin works and I'm willing to iron out the bugs, please post positive and negative feedback. All versions of the file will be listed below so people can view the plugin changing over time and we all have a record.
And a final note: You obviously can't use this as proof you killed someone or you're awesome at taking PK's as results are easy to forge, but for personal records I find it very interesting!
http://www.sendspace.com/file/8azejg (3kb) V- 1.0a
http://www.sendspace.com/file/t02jt0 (3kb) V- 1.0b || (Data wasn't loading on startup properly/at the right time, inserted a quick fix but a more robust solution should be found later)
http://www.sendspace.com/file/jcxsgl (3kb) V- 1.0c || Proper timing of loading sector notes identified by draugath, untested but very likely to be stable and more robust than 1.0b.
Since the PK stats are character based, you should probably do RegisterEvent(PKD.Load, "PLAYER_ENTERED_GAME") That will give you the proper timing for loading the system notes.
I'm not really sure why you're using custom split/implode functions for the storage of data. First, remember that tables in Lua are associative. So you could do something like.
PKD.stats = {}
PKD.stats.kills = {}
PKD.stats.killedby = {}
if (not PKD.stats.kills[name]) then
PKD.stats.kills[name] = 1
else.....
and then to store it all, just use the VO Lua API functions spickle() and unspickle()
SaveSystemNotes(spickle(PKD.stats), PKD.systemid1)
Also, you can use pairs() for iterating over the tables.
Hope that helps.
I'm not really sure why you're using custom split/implode functions for the storage of data. First, remember that tables in Lua are associative. So you could do something like.
PKD.stats = {}
PKD.stats.kills = {}
PKD.stats.killedby = {}
if (not PKD.stats.kills[name]) then
PKD.stats.kills[name] = 1
else.....
and then to store it all, just use the VO Lua API functions spickle() and unspickle()
SaveSystemNotes(spickle(PKD.stats), PKD.systemid1)
Also, you can use pairs() for iterating over the tables.
Hope that helps.
Thanks draugath, your post was very helpful. I don't think i will change the way the plugin stores data though, I kind of like it saving it as two readable strings in two different files and the plugin re-interpreting it, though you're quite right your method sounds more professional and if I develop any further plugins I will certainly use that method. Alternatively someone with a fantastic knowledge of Lua with someone else could design it with a similar data structure to the one you have described and simply have an /importpkd function to bring across data saved in my plugin and I would be happy for it to take the place of mine.
I'm really needing help with the /pkSearch function and the #INF ratio display thing, if you could shed any light on both of those i'd be very grateful.
I'm really needing help with the /pkSearch function and the #INF ratio display thing, if you could shed any light on both of those i'd be very grateful.