Quantcast

Jump to content


Photo

Account Pricer


  • Please log in to reply
90 replies to this topic

#1 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 01:08 AM

Hey, guys. So, somebody asked if there were any tools available to calculate the estimated worth of one's inventory and SDB. Seeing as how there didn't seem to be one (not to mention that I was interested in the worth of my own account), I decided to make one. It takes into account NP on hand, in the bank, and in the user's till, but also the estimated value (via Codex's wonderful database) of the inventory (and, by extension, items in trades), SDB, and shop. Unfortunately, I haven't yet gotten around to making a clean interface for it or packaging it up for the different operating systems. It's just a plain Python file at the moment, but anybody who uses Neocodex programs already has Python installed, so that's one barrier down. : )

The first step is to grab the required files. You'll need this Python script and the prices.txt file that it references; just a heads-up: the prices file is almost 1MB. Make sure you save both of them to the same folder, preferably one that is easy for you to access. I realize it might seem shifty at first, but I assure you there is nothing malicious in the code: some proof of such.

So, now the hard part for the not-so-computer-savvy. You're going to have to access the command line! If you're on Windows, click Start -> Run; in the dialog, type "cmd" and hit Enter. Users of other OSes will likely know how to access their terminals. Once you're in the terminal, you'll likely be in your user directory. Type "ls" to "list" the contents of your current directory. From there, you need to use the "cd" command to change the directory you're in until it's the one where you saved the files. Enjoy a simple visual demonstration:

Posted Image

Yes, I named my computer after Ada Lovelace. Anyway, your setup will likely be a bit different but it's fairly simple. You probably won't have to move "up" into a higher directory, but if you find that you need to, you can just use "cd .."

Well, once you "ls" and see that you're in the directory containing the files, simply issue this command:

python account_pricer.py

and it will start running. It will ask you for your username and password. Don't worry, it obviously doesn't do anything harmful with the information or SL wouldn't have approved of it. Still, I didn't bother with not making it show up because of how annoying it can be to make that work correctly on all systems. Just make sure nobody's looking over your shoulder when you type it in. After that, it will go through and calculate the various pieces of data. Once it's done, it will open a file called "results.html" in your default browser and give you a nice big recap of the information it collected, to include showing you the items in your inventory, shop, and SDB sorted by value. Hopefully you'll find a gem or two tucked into the corners of your deposit box.

If there's enough interest, I'd be happy to give it an interface, but I was mostly interested in the data. Additionally, it seems the Codex team are working on an account pricer themselves which will likely be much more full-featured, so it seems counter-intuitive to go so far on what was meant to be a one-off. Either way, looking forward to your feedback.

#2 Strategist

Strategist
  • Sadmin


  • 9,491 posts


Users Awards

Posted 30 September 2011 - 01:44 AM

it may just be me, but i cant get past the issuing of the python account_pricer.py command. I can get it to come up with select program from the web or from a list to run it but I cant figure out which program to get it to run. Sorry for the noobish Q but im hopeless when it comes to this command line shit lol

#3 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 02:22 AM

it may just be me, but i cant get past the issuing of the python account_pricer.py command. I can get it to come up with select program from the web or from a list to run it but I cant figure out which program to get it to run. Sorry for the noobish Q but im hopeless when it comes to this command line shit lol


Hm, there shouldn't be any options like that if you're running from the command line. Do you think you could post a screenshot? It'd make it far easier to pinpoint exactly what's going wrong.

#4 Strategist

Strategist
  • Sadmin


  • 9,491 posts


Users Awards

Posted 30 September 2011 - 02:28 AM

yeah can do. Im running windows 7 too if that helps, just let me upload a screenie.

here we go:

Posted Image



im sure its just a simple fix with a mistake on my end lol

Edited by Strategist, 30 September 2011 - 02:33 AM.


#5 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 02:50 AM

So very close! You're only issuing the filename, but you need to tell it which program to use first.

You're doing this:

account_pricer.py

But you've got to do this:

python account_pricer.py

Thank you for being on board, Strat. Please feel free to offer any and all feedback and criticism once you've run it. : )

#6 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 02:51 AM

Okay, I've been able to get it working. It asks for my username/password then it navigates to the bank, till but then it suddenly closes. I can see that there is text, but it closes down too fast for me to read it.

#7 Strategist

Strategist
  • Sadmin


  • 9,491 posts


Users Awards

Posted 30 September 2011 - 02:54 AM

i tried the python account_pricer.py thing but it doesnt recognise the command 'python' :/ weird

any more tips?

#8 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 02:58 AM

Got it working. What i did was go to the .py file, then told it to open with CMD

It was able to calculate NP on hand, bank and shop till, but i think it got stuck (and shut down) when it found an item that wasn't in the ItemDB.

Posted Image

Edited by iomega, 30 September 2011 - 03:03 AM.


#9 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 03:05 AM

i tried the python account_pricer.py thing but it doesnt recognise the command 'python' :/ weird

any more tips?


Ah, sorry... I'm getting far too used to Linux. I think you'll need to use "python.exe" instead of just "python". Sorry for all the hassle. : /

#10 Strategist

Strategist
  • Sadmin


  • 9,491 posts


Users Awards

Posted 30 September 2011 - 03:11 AM

Ah, sorry... I'm getting far too used to Linux. I think you'll need to use "python.exe" instead of just "python". Sorry for all the hassle. : /


nah still no go. No hassle, trust me. It just keeps saying 'python.exe' is not a recognized as an internal or external command, operable program or batch file

#11 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 03:16 AM

Got it working. What i did was go to the .py file, then told it to open with CMD

It was able to calculate NP on hand, bank and shop till, but i think it got stuck (and shut down) when it found an item that wasn't in the ItemDB.


Ah, darn, I was banking on Codex having everything in there. It was a simple fix that I should have put in regardless. Re-download and it should work like a treat.

nah still no go. No hassle, trust me. It just keeps saying 'python.exe' is not a recognized as an internal or external command, operable program or batch file


Damn. The only thing I can think of is that you didn't have Python on your system before installing Neocodex, and the Program Manager doesn't update your PATH settings when it installs Python. I'm afraid the first step is searching your C: directory for "python.exe"; we've got to figure out where it is before we can go any further, as I'm not sure which version of Python is installed with the PM.

#12 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 03:20 AM

File "C:\Users\iomega\Desktop\pricer\account_pricer.py", line 53, in <module

>

	inv_items[items[i]] = 0

TypeError: list indices must be integers, not str

Edited by iomega, 30 September 2011 - 03:20 AM.


#13 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 03:24 AM

File "C:\Users\iomega\Desktop\pricer\account_pricer.py", line 53, in <module
>
	inv_items[items[i]] = 0
TypeError: list indices must be integers, not str


All right, it's either time for sleep or more coffee. Updated and fixed. Sorry about that, but thank you very much for being an unintentional bug tester. : )

Edited by Inkheart, 30 September 2011 - 03:24 AM.


#14 Strategist

Strategist
  • Sadmin


  • 9,491 posts


Users Awards

Posted 30 September 2011 - 03:26 AM

ill give up for now until i'm in the right frame of mind to try and work this out lol

Thanks for putting this together anyway. It looks promising. Just wish i could get it to work. Good luck with it anyway.

#15 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 03:28 AM

ill give up for now until i'm in the right frame of mind to try and work this out lol

Thanks for putting this together anyway. It looks promising. Just wish i could get it to work. Good luck with it anyway.


Really sorry, Strat. But whenever you're feeling up to it, find out where your python.exe file is and let me know. : )

#16 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 03:32 AM

All right, it's either time for sleep or more coffee. Updated and fixed. Sorry about that, but thank you very much for being an unintentional bug tester. : )


Haha no worries, happy to help ^_^
Okay, it was able to get past my inventory and my shop, but an error popped up during the SDB


Posted Image

#17 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 03:37 AM

Haha no worries, happy to help ^_^
Okay, it was able to get past my inventory and my shop, but an error popped up during the SDB


Huh. I'm guessing your interface isn't in English?

#18 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 03:42 AM

Huh. I'm guessing your interface isn't in English?


No.. It's English. I also tried with the basic theme, but I got the same error.

#19 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 03:49 AM

No.. It's English. I also tried with the basic theme, but I got the same error.


That is very strange. I thought it could be because you only have one page of SDB, but even then, the regular expression should still match. Um... are there any items in your SDB? : P

#20 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 04:00 AM

That is very strange. I thought it could be because you only have one page of SDB, but even then, the regular expression should still match. Um... are there any items in your SDB? : P


Haha I got the packrat avatar a few weeks ago, so there should be a little over 1000 items in there.

Huh. Well that's weird. I just ran it on a side account and it works :)

Spoiler




#21 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 04:02 AM

Very nice! Also, happy belated thousandth post! : ) Okay, well, I'm really glad it worked, but I'd also very much like to figure this out. Aha! Pretty sure I know what it is. I'm guessing on your main your "Items: " number has a comma in it, right?

Edited by Inkheart, 30 September 2011 - 04:07 AM.


#22 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 04:07 AM

Very nice! Also, happy belated thousand post! : ) Okay, well, I'm really glad it worked, but I'd also very much like to figure this out. Aha! Pretty sure I know what it is. I'm guessing on your main your "Items: " number has a comma in it, right?


Oh man, I didnt even notice! Cheers!

Yes, I do. "Items: 1,127 | Qty: 2,332"

Also, since you're trying to find total assets, would you be able to take stocks into account?

#23 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 04:25 AM

Oh man, I didnt even notice! Cheers!

Yes, I do. "Items: 1,127 | Qty: 2,332"

Also, since you're trying to find total assets, would you be able to take stocks into account?


Figures. I'm really bad (or good, I suppose) at only programming in the "works for me" mindset; really must remember to think about all the different contingencies. Well, I've sorted out the comma issue, as well as included your excellent suggestion of portfolio value, so here's the (hopefully) final version.

#24 iomega

iomega
  • 1,069 posts


Users Awards

Posted 30 September 2011 - 04:33 AM

Ahh dammit. I'm afraid not >_<

Posted Image

It's the same error we had earlier. On a happier note, the stock report is working correctly.

#25 Inkheart

Inkheart
  • 268 posts

Posted 30 September 2011 - 04:36 AM

Ahh dammit. I'm afraid not >_<

It's the same error we had earlier. On a happier note, the stock report is working correctly.


It's so time for me to catch some sleep. Fin!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users