Skip to content

Automatically refresh a GoatBots page on a set timer, check if any of the cards specified by name in the settings are in stock, and if so, add them to cart, play an audio alert, and (optionally) start delivery.

License

Notifications You must be signed in to change notification settings

aminomancer/GoatBots-Card-Watcher

Repository files navigation


GoatBots Card Watcher
Download

Automatically refresh a GoatBots page on a set timer, check if any of the cards specified in the settings are in stock, and if so, add them to cart, play an audio alert, and (optionally) start delivery. This is mainly useful if you're trying to buy new cards that are extremely rare and in high demand. Other players may beat you to the punch if you just manually check every few minutes. That's what motivated me to write this script. I was trying to buy the full-art promos from Double Masters 2022 and other people kept beating me to the draw. So, I made a script to watch the stock for me and give me a head start when a rare card comes into stock.

Configuration

This script lets you mark a particular GoatBots page and assign a cards list for that page. When you navigate to the page, the script will automatically reload it on a timer to check if any of the cards on your list are now in stock. When a card on your list is detected, an audio alert will (optionally) speak the names of the new cards, and the cards will be added to your cart. You can add as many pages as you want, and you can scan for as many cards per-page as you want. Each page in your watchlist has its own independent cards list stored in your user settings, so they can't get mixed up.

You can access the user settings through the Card Watcher menu at the top of the GoatBots window, or through your script manager. Violentmonkey and the latest Greasemonkey versions have a toolbar button that opens a popup showing script settings for the current page. However, these are the same settings as in the Card Watcher menu, so you might as well just use the Card Watcher menu. So if you go to www.goatbots.com, you can open the menu or the popup and use the buttons in there to configure your settings. If you're not sure, there are further instructions and details in the script itself.

When you first open a GoatBots page, open the Card Watcher menu popup and click Add page to watchlist to make a watchlist editor appear. The top text field is the path field. This is the path for the page you want to scan, such as https://www.goatbots.com/set/kaldheim. It defaults to the path of the current page, but you can edit it here. If you want to still be able to use the normal GoatBots page without it constantly reloading, add a + at the end of the page URL (e.g., https://www.goatbots.com/set/kaldheim+). You can navigate to the URL just fine with a + at the end, and the script will correctly recognize it as a different URL. Then, the script will only activate when you explicitly navigate to the + version of the URL, which you can bookmark.

Then proceed to the big text area — the cards list. You can manually input the card IDs in YAML or JSON format, but since this information is not visible on the page without using devtools, it will probably be easier to click the Select by Clicking button at the bottom. This will allow you to add cards to the watchlist just by clicking them. Clicking a card row will toggle it on or off. Then click the Confirm button to return to the watchlist editor — the cards list will now be filled with the cards you selected. Then, click the Save button and it will store this in your script settings. They will persist even after updating the script.

When you Select by Clicking, the script will automatically create an object to represent the card. Since each card is actually identified by a random string of characters (the id), you can change a card's name to anything you want by editing it in the list editor. The text-to-speech alert, if it's enabled, will speak the card's name aloud, along with some other identifying information depending on what page is being watched. On a card page, there's only one card name, so it only reads the card name once. But there may be multiple versions, so it says the set and frame type (e.g. Showcase or Foil). On a set page, there's no need to read the set, but the card name and frame type are spoken aloud. Here's an example of how the card list for a given page might look:

- name: Atraxa, Grand Unifier
  set: ONE
  frame: Showcase
  rarity: Mythic Rare
  notes: Borderless
  wanted: -1
  id: A4zDSnxvkUrgTA==
- name: Elesh Norn, Mother of Machines
  set: ONE
  frame: Phyrexian
  rarity: Mythic Rare
  wanted: -1
  id: A4zDSnxvnk3mQw==

The id property is the only one that can't be changed. It's the only way to identify a card, so changing it would make it impossible to find the card again. The name property is generated automatically, but can be changed to anything. It is read aloud by default. The other properties can be changed as well, or even removed. There are two optional properties that are not added automatically, and are provided to make tracking cards easier. The alert property accepts any string, and will be read aloud along with the card's name if it's provided. The notes property serves a similar purpose but will not be read aloud. It's only there for your own reference.

After adding a card to the watchlist, it will appear in the list with values automatically generated. It will also have a wanted property of -1 by default. This allows you to choose a maximum number of copies to order. If 4 are available but you've set the card's wanted property to 2, it will change the amount in cart to 2. However, GoatBots doesn't allow us to choose any quantity. It only allows you to cycle through predefined quantities, like 40, 20, 4, 3, 2, 1, etc. So, if you choose a wanted number that isn't allowed, it will reduce the amount in cart until it's less than or equal to the wanted number you've chosen. If you don't care about the quantity, and just want as many copies as are available, setting the wanted value to 0, a negative value, or no value at all (e.g. by deleting the wanted property) will result in no quantity limit.

By default, this will refresh the page every 10 seconds, provided the tab the page is loaded in is not active. It basically pauses refreshing while the tab is active, so that you can still use the page as normal. That way, it will only scan in the background, and alert you when it finds something. However, this pausing behavior can be disabled by setting Refresh while active to true in the Advanced Settings which can be accessed through the menu. You can set the values of any of the settings in this interface, except for the watchlist. If you need to make bulk changes to the watchlist, go to the script page in your script manager and click on the "Values" tab.

You can also pause the script globally to prevent it from reloading pages or alerting you. This can be toggled from the Card Watcher menu or your script manager's popup. You might also notice another setting — Automatic Delivery — which causes the script to begin delivery as soon as new cards are detected. This increases the chances that you'll get the cards, since there's no risk of fumbling around trying to find the tab and click the "start delivery" button yourself. The script will just handle it for you. But if you're going to use this, you have to make sure the script isn't operating when you're away from the computer, since it will be a major public nuisance if you're not actually present to conduct the delivery.

As with the aforementioned settings, you can toggle this setting from the menu, the script manager popup, or the script values page. The setting is useful since it takes a few minutes for GoatBots to actually send a trade request. So there's time for you to get ready. You just want to make sure you enter the delivery queue as soon as possible, so that someone else doesn't queue up first. If you're first in line, I think it's guaranteed you'll get the card. For additional efficiency, when the delivery is finished, the script will automatically go back to the page it was watching before it started delivery.

There are some settings concerning the alert audio as well. By default, the alert will play synthesized speech of the names of the new cards, as long as at least one text-to-speech voice is available in your computer operating system. Otherwise it will just play a predefined sound file that says "New cards in stock." There's a user setting to limit the number of card names spoken in the alert. If you're watching a large number of cards and many are available, the voice alert could end up being very long without a limit. By default, that limit is disabled. The sounds in this script are encoded directly in the script, so it doesn't need to download anything.

If you're using Firefox and you want the text-to-speech alerts, make sure the pref media.webspeech.synth.enabled is enabled in about:config. If you don't want or can't use text-to-speech, and the default sound file is not to your liking, you can replace it with your own base64-encoded audio file. You can convert any mp3 file to base64 by uploading it to this encoder. Then just copy the resulting string and replace the Voice audio file at the bottom of the script with your new string. The script will decode and play it at runtime. This audio file is not a user setting because that would slow the script down, so you have to edit the script directly.

Before the synthesized speech or voice audio plays, the script will also trigger a little alert sound. This is done so that the alert will be more noticeable in the event that you're listening to dialogue when the alert goes off. The synthesized speech may not be as noticeable if there are other voices playing in the background, so I added a little "ding" noise to play at the same time. It's the same sound that plays when you get a notification in MTGO. This sound can also be changed. Again, it's a base64-encoded audio file, so use the same encoder as above. Aside from that, there are a few other speech/audio settings.

I am not affiliated with Wizards of the Coast or GoatBots. Magic: The Gathering, MTGO, its corresponding symbols, and illustrations are trademarked by Wizards of the Coast. GoatBots and its corresponding symbols and illustrations are trademarked by GoatBots.

About

Automatically refresh a GoatBots page on a set timer, check if any of the cards specified by name in the settings are in stock, and if so, add them to cart, play an audio alert, and (optionally) start delivery.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published