@bobotron said in XP Log Code:
I'm currently storing it as Date_With_Underlines|Earn#|Spend#|Reason_with_Underlines.
While @Thenomain says "wing it", he himself has advised me numerous times in the correct way to store data in a MU. While I haven't done an XP system (I use Thenomain's), I have stored a lot of other data which is essentially the exact same thing. So...
Warning, this is all in MUX. I think Penn has the same stuff, or very similar, so please adjust accordingly!
- Make sure to use a relevant prefix in the attribute. For me, it was things like
d.repose.####
- Use secs() for a timestamp. Then use timefmt() to read it. You end up with something like
10928372|...
to start. No underscores, slashes, formatting issues. Timefmt() will handle the output.
- Using a pipe
|
is generally great, so that's good.
- Earn# and Spend # should be just fine, so now you got something like
120239837|14|null...
- Always run the free-form text through objeval(). Is that in Penn? I hope so. This will read the text as if it came from the submitter, which will strip out any funny code business.
- Always put your free-form text last. You already have it, but to make clear, if you put the free-form text last, it doesn't much matter what characters they use. You can grab the 4th element or the last element on the list, and if they use a million
|
s it doesn't much matter to you. The output might be screwy, but it won't affect your code. It will always just grab the 4th thing, or the last thing.
So, in conclusion... secs()|#|#|objeval( their reason here don't worry about underlines
And that'd get your data looking like: 12398382|14|null|Raising my strength