PackRat Helper (version 1.0-beta)
[This version of the script is OBSOLETE. For more informations and newer versions check the PackRat Helper category.]
A couple of days ago I started working on the ‘Market stalking’ feature. For this purpose I had to parse the information contained in the excellent PackRat Wiki and transform it into a format usable by the script.
We are now proud to present version 1.0-beta of the script.
Changelog:
- The highlighting module can now highlight either all the cards from selected collections or just the missing cards and the ingredients for missing cards from your Vault and Pack. In the previous versions only missing cards from your Vault where highlighted. So (unless there are errors in the card database) only the cards you really need are highlighted.
- There is a database of known cards, recipes and markets where you can purchase them. The database is downloaded daily, but if you want to force an update go to Tools > GreaseMonkey > Script Commands “Update collections database”
- A market stalking module was added. This means that the script can buy all the cards that you need in order to complete the collection automatically.
- Some pop-up recognition problems where solved.
- The grinding feature was improved.
- The script updates your pack’s content on many pages (Make, Steal, Your Pack and Purchase). Before it only did it on the ‘Your Pack’ page. Note that when you purchase a card you must still go to Your Pack in order to make it available for grinding: the ID number of the card you bought don’t appear on the Purchase page.
- There were some changes to stealing made by the PackRat developers. The script takes them into account (meaning that grinding will work again).
The script takes the names of the cards from the name of the image files (they are the only ones available on every page). The PackRat developers added some misspellings to the names of the images (either on purpose or probably by mistake), so some informations in the database may be wrong.
We need your help: to identify the misspelled cards in the database, please go to about:config and look for the key ‘packrat*missing’. It contains the names of the cards that are not in the database. Please go to your vault and then report the entries from the collections you have completed as comments (and check the other comments too in order not to duplicate the information).
If you appreciate this release and were hesitating about making a donation, don’t hesitate any more
. The database will need a daily update from now on, with the new collections coming and other corrections.
Download PackRat Helper: version 1.0-beta2
ATTENTION: for those who are upgrading you may consider forcing the update of the collections database (which was previously scheduled every week) with Tools > GreaseMonkey > Script Commands > Update collections database.
Also available at UserScripts.org, where you find a short manual.
For more informations about the installation process please check the FAQ.
[Update: Version 1.0-beta2 solves the problem with selecting multiple collections]

Awesome release! Kind of a bummer newer card collections aren’t listed first in the selection area (now sorted alpha)
Grinding is working awesome!
Comment by Brian E — 7/8/2008 @ 3:20 pm
How would you suggest to sort them? New collections first, then alphabetical order? Or new collections, current collections, expired collections?
Comment by Piotr P. Karwasz — 7/8/2008 @ 3:25 pm
id say the way u had em before was best
im also noticing some odd stuff today… maybe its on facebook… but im getting JS popups with DOM errors and then strange html/div code in the status window
Comment by Brian E — 7/8/2008 @ 6:46 pm
after making a card:
Error in module ‘card’ on line 167: Component is not available
While browsing between markets (JS POPUP)
Error in module ‘page’ on line 53: div is nullError in module ‘card’ on line 174: div is undefinedError in module ‘menu’ on line 564: button is nullError in module ‘browse’ on line 1400: error is null
and in the status window:
-Script status- Status:Resting… Notes: Script Preferences
Comment by Brian E — 7/8/2008 @ 6:51 pm
shoot.. wont let me post raw HTML… the status window doesnt render normally… it actually shows the html
Comment by Brian E — 7/8/2008 @ 6:51 pm
I’m getting several errors:
Error in module ‘collection’ on line 939: collections[col].cards[name] has no properties
Comment by Janey — 7/8/2008 @ 8:46 pm
Janey: You must update the collections database as written in the post (Tools > GreaseMonkey > Script Commands > Upgrade collections database.
Brian: Today the servers are really slow, so the script starts working before the page is loaded and since it can not display the errors on the menu panel, it shows a pop-up.
Comment by Piotr P. Karwasz — 7/8/2008 @ 8:50 pm
Follow up: I was not able to get the script to perform the “housekeeping” script command to update the database (and try and clear that error). Only after completely uninstalling the script, and re-installing clean did the error messages go away.
(BTW- the market stalking idea is fabulous)
Comment by Janey — 7/8/2008 @ 9:00 pm
And another followup: the error messages are back, even after a clean install.
Error in module ‘card’ on line 338: collections[card.collection].cards has no properties
Error in module ‘highlight’ on line 1055: pagecards has no properties
As before, running “update collections database” does not appear to do anything (do you get a confirmation message, like with the “Manual Update” command?) and doesn’t clear the errors.
Comment by Janey — 7/8/2008 @ 9:06 pm
Janey: Does the error appear on any page or just a particular one? You can try resetting the preferences in the script commands.
Comment by Piotr P. Karwasz — 7/8/2008 @ 10:02 pm
The command to reset the preferences also does not appear to work. The errors went away for a short time after I completely uninstalled the script, and did a fresh install– but returned again within 4 or 5 minutes…. so I’m not sure it’s the preferences, since the preferences were wiped clean with the fresh install.
I get the 939 error on every page - my pack, friends’ packs, the markets, my vault. The 1055 error is only occasional- and that only popped up on the market pages. I also one time (I believe while surfing friends’ packs) got a popup box containing a long string of similar errors to the 939 and 1055. Unfortunately, I didn’t get a print screen grab.
Comment by Janey — 7/8/2008 @ 10:12 pm
I’ve tried checking and unchecking various options, and the error seems to appear no matter what selections I make. Also, tried again to either “update collections database” or “reset PackRat preferences” — neither one appears to work (I don’t get a confirmation popup, like with manual update).
Comment by Janey — 7/8/2008 @ 10:17 pm
Janey: The error 939 appears because you selected more than one collection. I’ll post the fix in a few minutes.
Comment by Piotr P. Karwasz — 7/8/2008 @ 10:19 pm
Hooray! The update seems to have fixed all the errors- I’m not seeing the 939, or any other error, any longer. Thank you!
Comment by Janey — 7/8/2008 @ 11:40 pm
grind module is attempting to grind locked cards in my pack
Comment by Brian E — 7/8/2008 @ 11:57 pm
Brian: Sorry about that, I didn’t have the time to identify locked cards. It will be done in the next release. Anyway since the time you play PackRat shouldn’t you be level 25 or more? What is the use of grinding for high level characters?
Comment by Piotr P. Karwasz — 8/8/2008 @ 12:32 am
bragging rights
Comment by Brian E — 8/8/2008 @ 1:23 am
current standings:
Level: 105
Credits: 118,452
Score: 5,594,871
WOOT!
just need the last enchanted forest card… cmon stupid deer!
Comment by Brian E — 8/8/2008 @ 1:26 am
Can you explain what exactly it’s doing when it’s stalking the markets? I see the line “stalking market london in 3m 21s (counting down)” But once it reaches zero seconds nothing seems to happen. Is it only stalking london… I guess it’s not clearly communicating what it’s doing… I love amazing work you’ve done… a donation is coming for sure…
Comment by crazymodo — 8/8/2008 @ 2:34 am
crazymodo: It makes a list of cards that you need and markets where you can get there. Then it browses through markets cyclically and if it finds a card in the list it buys it. In your case it stalks only London because the cards you need for your current collection are only there.
Stalking stops at 13 cards in your pack, so that your pack don’t run out of space: you can always buy the two cards missing for any recipe.
You can check the list by looking at the messages in the Error Console (the Messages tab).
Comment by Piotr P. Karwasz — 8/8/2008 @ 2:44 am
hmm, strange, because I was still needing Ruins-Enchanted Forest (Sydney) and Mushrooms-Enchanted Forest (London). However ruins was for the Leprechaun recipe… I think I already had a Leprechaun (to make another recipe) in my pack at the time, but not vaulted… What is the countdown for then? And where is this Messages tab you speak… Sick of my questions yet? hehe
Comment by crazymodo — 8/8/2008 @ 3:03 am
hmmm, or is the countdown set to check the one market every 5 minutes?
Comment by crazymodo — 8/8/2008 @ 3:06 am
The following are listed as missing from my vault (under about:config) even though I have them vaulted:
“games-of-summer/basketball” — “tiki-island/volcano” — “oh-the-drama/gossiprag” — “tiki-island/pina-colada”
Comment by crazymodo — 8/8/2008 @ 3:16 am
I adjusted the delay, but now that I’m all caught up the stalking won’t run (which is cool by the way). At 20000 it was sitting at about 90 seconds… What’s the base unit of time? milliseconds?
action = new Timer(Math.floor(5 * 10000 / num), Math.floor(6 * 10000 / num));
I think 5 minutes might be too long… 30-90 seconds might work better, no?
Comment by crazymodo — 8/8/2008 @ 3:26 am
crazymodo: The countdown is for reloading the page. The pages are reloaded every 5-6 minutes. Since you are working on the new collections, it’s not surprising that the database does not contains all the recipes. You can run the ‘Update collections database’ command to retrieve the more recent version of the database, anyway it’s retrieved once a day.
Thanks for the corrections.
Comment by Piotr P. Karwasz — 8/8/2008 @ 3:26 am
crazymodo: How long does a card remain in the markets? From my experience it’s more like 10-15 minutes. We just need to reload the page somewhere in this time frame.
Yes the unit of time is milliseconds (divided by the number of markets we need to cycle).
Comment by Piotr P. Karwasz — 8/8/2008 @ 3:30 am
Yes, it’s true that a card CAN last in a market for 10-15 minutes… However it’s tough to gauge since a popular card will be bought in a matter of seconds, while another, older card might not get sold out for 10-15 minutes… I suppose one could refresh to force the stalking to reset at the 5 min interval as soon as a card gets sold since the expectation is that it might make it’s way back in to the mix after about 5 minutes…
that being said, i find people are keeping their eyes on the small blue bars under each card and refreshing the moment any of them look to be close to running out… the expectation is that a new card will show up in its place, and hopefully be the one they’re looking for…
if the cycle is set to be fairly short, and the user needs more than one card from that market, their odds are increased… I’m not sure there would be a set pattern for any cards recurrence within a market, so the length of 5 minutes might prove too long…
Just my two cents…
Comment by crazymodo — 8/8/2008 @ 4:21 am
Here’s what I’m getting while in market & while browsing friends -
Error in module ‘card’ on line 339: collections[card.collection].cards is undefined
Error in module ‘highlight’ on line 1060: pagecards is undefined
Here’s what I’m getting while in my pack -
Error in module ‘card’ on line 339: collections[card.collection].cards is undefined
Comment by Amy — 8/8/2008 @ 6:13 am
I am getting Error in module ‘card’ on line 167: Component is not available
Status:
Resting…
anytime i am in my pack. Otherwise the script is running great!
Comment by Adam — 8/8/2008 @ 1:45 pm
I’m getting an error:
Error in module ‘card’ on line 339: collections[card.collection].cards is undefined
Error in module ‘highlight’ on line 1060: pagecards is undefined
Comment by Janice — 8/8/2008 @ 8:55 pm
in the next release could we get a textual link the status window to pause the script? i often find that the spacebar just doesnt catch in time if i need to pause quick to steal or leave a message… and the downside to the spacebar is that is forces the whole page to scroll which for me sucks, b/c i have packrat and FF running on a fileserver and i remote into it and the screen lag is brutal…
if this can be done… you’ve got a $20 paypal donation in the bucket
Comment by Brian E — 8/8/2008 @ 9:33 pm
Error in module ‘card’ on line 174: div is undefined
Comment by Mordy — 8/8/2008 @ 10:43 pm
crazymodo: Changed the default to 2 minutes.
Adam: This error/exception is still a big mystery to me. It appears in Firefox built-in function that should never fail. It means that the scripts data couldn’t be saved properly…
Amy: If you upgraded the script from a version older than the 1.0-beta series you have to go to Tools > GreaseMonkey > Command Script > Update collections database.
Janice: The same identical error was reported by Amy two comments earlier, how did you miss it?
Mordy: The page probably didn’t load correctly (the scoreboard wasn’t there). If the Facebook application has problems, so does the script.
Brian: There is a lapse of time between the time when the browser begins to load a page and receives it. No user script can run during this period, so PAUSE don’t work. Anyway I’ll insert an additional button to pause the script in the next release and prevent the page from scrolling when PAUSE is pressed.
Comment by Piotr P. Karwasz — 9/8/2008 @ 2:46 am
Thanks so much, Piotr. Your devotion to our Packratting is commendable.
Comment by Mordy — 9/8/2008 @ 5:04 am
UPDATE: A experimental version with the ability to steal cards (not only grind) is running on my account. It will be released as soon as I have the time to put some preferences around. It mostly does two things: steals the cards that you need and exchange useless cards with cards with more points (so the real thefts are easier to perform).
Besides the market stalking needs more preferences and logic, like buying the components for most valuable cards first.
Comment by Piotr P. Karwasz — 10/8/2008 @ 1:39 pm
Piotr, is there any chance it will let us pick individual items to steal, not collections? (Like if you’re looking for a UH Controller, but don’t want anymore UH Butanes?)
Comment by Mordy — 10/8/2008 @ 5:23 pm
Mordy: I was thinking about a whole bunch of settings. The first is the list of missing cards that stalking is using at the moment: e.g. if you lack only a Patolli Game, the script will steal a Patolli Game or 3 Maizes.
The second is a user selected list of cards and the third would be all the cards.
Comment by Piotr P. Karwasz — 10/8/2008 @ 9:54 pm
Piotr,
A few ideas:
It would be great if coop players could set it to only steal said items from the rats and not our friends. I would be afraid to use any features that might alienate all my great friends.
The market stalking feature could be more configurable. I would like to be able to tell the script to only buy a certain number a particular item (like 2 table tennis) and to check that market at a specified interval (like every 30 seconds). And please allow us to stalk for items that are already in our vaults as coop players are working to help others. Although the concept of allowing the script to figure out what you need is enticing, full control over the behavior is more desirable in my opinion.
The same thing goes for popups. When I was collecting Luche Libra purple masks for my friends I had to dump all the lowriders and blue masks on a pretty regular basis and it became a nuance (and potentially suspicious as user based activity would not likely have mimicked the script). If we could specify exactly which popups to allow that would be grand.
As always, I am eternally grateful for all the hard work you have put into this project. I’m looking forward to what you do next!
Comment by HLM — 10/8/2008 @ 10:46 pm
Re comment #33 — I didn’t read the previous comments, for which I apologize. I had experienced an error and a friend asked me to let you know. I was in a rush and just posted.
Trust me, I won’t make that mistake again.
Comment by Janice — 11/8/2008 @ 11:42 pm
Janice: Don’t take it personal. I receive a lot of duplicate bug reports even in a row. I just picked on you to send a message to everybody.
HLM: My next release will have three types of shopping list for the stalk, steal and pop-up module: all cards from selected collections, the automatically generated shopping list and a personalized shopping list.
Comment by Piotr P. Karwasz — 12/8/2008 @ 11:49 am
FREQUENT ERROR:
Error in module ‘page’ on line 53: div is nullError in module ‘card’ on line 174: div is undefinedError in module ‘preferences’ on line 464: document.getElementsByTagName(”body”)[0] is undefinedError in module ‘menu’ on line 561: document.body is nullError in module ‘browse’ on line 1361: notes is null
Comment by http://dulcedosa.blogspot.com/ — 12/8/2008 @ 6:22 pm
I’m getting a similar error to the previous poster:
Error in module ‘page’ on line 53: div is nullError in module ‘card’ on line 174: div is undefinedError in module ‘preferences’ on line 1024: Component returned failure code: 0×80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]Error in module ‘menu’ on line 542: Component returned failure code: 0×80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]Error in module ‘browse’ on line 1361: notes is null
Comment by Helen — 12/8/2008 @ 8:30 pm
Those errors appear when the PackRat server returns a malformed page (or the connection fails). Since the servers seem to have plenty of problems you have just to endure those errors and reload the page again.
Comment by Piotr P. Karwasz — 12/8/2008 @ 9:34 pm
Piotr, is it possible the error that Helen reported only shows up when there’s a card popup (bearing in mind the recent Packrat server problems)? It’s pretty much incomprehensible to me, so I’m just wondering.
Error in module 'page' on line 53: div is null<br/>Error in module 'card' on line 174: div is undefined<br/>Error in module 'preferences' on line 1024: Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]<br/>Error in module 'menu' on line 542: Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]<br/>Error in module 'browse' on line 1361: notes is null<br/>
Comment by Packratter — 12/8/2008 @ 11:48 pm
I would like to update my collections, but my user script commands in my tools>grease monkey menu is not lit up, (not clickable). Any idea why this may be happening?
Comment by Lisa — 13/8/2008 @ 7:46 am
Lisa: The Tools > GreaseMonkey > Command Script menu is only available on a PackRat page (on a page where the script runs). Anyway you should also upgrade the script since 1.0-beta is obsolete and the newest one is 1.0-rc1.1.
Comment by Piotr P. Karwasz — 13/8/2008 @ 12:51 pm
Packratter: The error occurs when the script can not read your profile link (and all other modules fail one after the other). It means that the page loaded does not seem to be a Facebook page (or they are mixing new and old layout).
Comment by Piotr P. Karwasz — 13/8/2008 @ 1:04 pm