[Userscript] Bazaar Auto Price by tos - fixed! | Tools & Users…
[Userscript] Bazaar Auto Price by tos - fixed!
    • Lugburz [2386297]
    • Role: Civilian
    • Level: 77
    • Posts: 807
    • Karma: 1328
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 17:58:18 - 07/04/20 (2 years ago)
    |
    Last replied 21:50:25 - 05/07/22 (1 month ago)
    I have been asked to look into 'Bazaar Auto Price' script, originally by tos, that stopped working with the latest bazaar updates.

    The script auto sets prices when managing or adding items to bazaar.

    Version 0.7.2 resolves the problem with having to press space bar in order to update the price in the Manage items page.
    Version 0.7.3 adds auto fill item amount functionality in the Add items page.

    https://github.com/f2404/torn-userscripts/raw/master/tos_bazaar_auto_price.user.js
    Last edited by Lugburz on 01:10:25 - 19/05/20
    • LordofFire [2411517]
    • Role: Helper
    • Level: 84
    • Posts: 1440
    • Karma: 1769
    • Last Action: 14 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:50:27 - 07/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    What does the script do exactly?

    • Lugburz [2386297]
    • Role: Civilian
    • Level: 77
    • Posts: 807
    • Karma: 1328
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:53:46 - 07/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    It auto prices items in bazaar when you click the "Price" entry field.

    On line 60, where it says 'else return lowest_market_price - 5', you can adjust the price that will be auto set.
    Currently, it will be set to "lowest price minus $5", but you change it to be "lowest price plus $10", for example.
    • Lente [2412781]
    • Role: Civilian
    • Level: 23
    • Posts: 46
    • Karma: 436
    • Last Action: 11 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 10:54:59 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    Thank you so so so so much!!! a savior :D
    • w0xe [2438170]
    • Role: Civilian
    • Level: 55
    • Posts: 209
    • Karma: 68
    • Last Action: 8 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 13:44:05 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    It's a nice script, I tested it quickly. However I found that it takes the lowest price of online players only. So if there is somebody offline with an open Bazaar, which has the lowest price, it doesn't take this into consideration.
    • Lugburz [2386297]
    • Role: Civilian
    • Level: 77
    • Posts: 807
    • Karma: 1328
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 13:59:49 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    w0xe [2438170]

    It's a nice script, I tested it quickly. However I found that it takes the lowest price of online players only. So if there is somebody offline with an open Bazaar, which has the lowest price, it doesn't take this into consideration.
    Hmm, I don't think this is the case.

    The scripts uses whatever data the API request returns; the request is 'https://api.torn.com/market/ITEM_ID?selections=bazaar&key=API_KEY'.
    As far as I can tell, neither the script nor the API request take into account online/offline user status.

    The API itself, however, is known to have a delay worth of few minutes (up to 5 or 15 minutes? can't remember). This means that the API may not return some items that have been added just recently - I would guess this is exactly your case.
    • DeKleineKobini [2114440]
    • Role: Committee
    • Level: 98
    • Posts: 3089
    • Karma: 4296
    • Last Action: 5 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 14:29:28 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    w0xe [2438170]

    It's a nice script, I tested it quickly. However I found that it takes the lowest price of online players only. So if there is somebody offline with an open Bazaar, which has the lowest price, it doesn't take this into consideration.

    Lugburz [2386297]

    Hmm, I don't think this is the case.

    The scripts uses whatever data the API request returns; the request is 'https://api.torn.com/market/ITEM_ID?selections=bazaar&key=API_KEY'.
    As far as I can tell, neither the script nor the API request take into account online/offline user status.

    The API itself, however, is known to have a delay worth of few minutes (up to 5 or 15 minutes? can't remember). This means that the API may not return some items that have been added just recently - I would guess this is exactly your case.
    The delay seems to only be for certain actions and is 2 minutes. Along with the 30 seconds cache of course.
    • w0xe [2438170]
    • Role: Civilian
    • Level: 55
    • Posts: 209
    • Karma: 68
    • Last Action: 8 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:10:40 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    w0xe [2438170]

    It's a nice script, I tested it quickly. However I found that it takes the lowest price of online players only. So if there is somebody offline with an open Bazaar, which has the lowest price, it doesn't take this into consideration.

    Lugburz [2386297]

    Hmm, I don't think this is the case.

    The scripts uses whatever data the API request returns; the request is 'https://api.torn.com/market/ITEM_ID?selections=bazaar&key=API_KEY'.
    As far as I can tell, neither the script nor the API request take into account online/offline user status.

    The API itself, however, is known to have a delay worth of few minutes (up to 5 or 15 minutes? can't remember). This means that the API may not return some items that have been added just recently - I would guess this is exactly your case.
    I tried it with different 5 different articles this morning. But I will keep testing that script if I find out more I will let you know. But huge thanks for your work, thats really great
    • VladBull [2321305]
    • Role: Committee
    • Level: 94
    • Posts: 4448
    • Karma: 2803
    • Last Action: 46 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:12:39 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    I always get a "API key error" message and if I press space a "NaN"
     
    • Lugburz [2386297]
    • Role: Civilian
    • Level: 77
    • Posts: 807
    • Karma: 1328
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:16:25 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    VladBull [2321305]

    I always get a "API key error" message and if I press space a "NaN"
    Have you configured the script with your API key?
    • VladBull [2321305]
    • Role: Committee
    • Level: 94
    • Posts: 4448
    • Karma: 2803
    • Last Action: 46 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:40:51 - 08/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    VladBull [2321305]

    I always get a "API key error" message and if I press space a "NaN"

    Lugburz [2386297]

    Have you configured the script with your API key?
    My mistake! Thought that it being an update, will keep the API. 
    Thank fixed it!

    Thank you and have a great one! ;)
     
    • Phillip_J_Fry [2184575]
    • Role: Civilian
    • Level: 50
    • Posts: 257
    • Karma: 123
    • Last Action: 12 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:03:22 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    When managing items all I get is NAN but when adding an item the script works
    • Lugburz [2386297]
    • Role: Civilian
    • Level: 77
    • Posts: 807
    • Karma: 1328
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:07:19 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    Phillip_J_Fry [2184575]

    When managing items all I get is NAN but when adding an item the script works
    I just checked, it works for me in both cases.

    Do only specific items get a NAN? or all items? Can you give an example?
    • Phillip_J_Fry [2184575]
    • Role: Civilian
    • Level: 50
    • Posts: 257
    • Karma: 123
    • Last Action: 12 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:11:00 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    Let me double check I know I'm getting it on drug packs though
    • Phillip_J_Fry [2184575]
    • Role: Civilian
    • Level: 50
    • Posts: 257
    • Karma: 123
    • Last Action: 12 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:19:25 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    I tried these items and got NAN as the result for each 
    Drug packs
    camels
    kitten
    Banana Orchid
    Big Box of Chocolate Bars
    Gold Ring
    Audi TT Quattro

    And it won't let me erase the NAN either

    • PlatinumDevil [1920420]
    • Role: Civilian
    • Level: 98
    • Posts: 1565
    • Karma: 2275
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:34:16 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    Lugburz [2386297]

    I have been asked to look into 'Bazaar Auto Price' script, originally by tos, that stopped working with the latest bazaar updates.

    The script auto sets prices when managing or adding items to bazaar.

    Version 0.7.2 resolves the problem with having to press space bar in order to update the price in the Manage items page.
    Version 0.7.3 adds auto fill item amount functionality in the Add items page.

    https://github.com/f2404/torn-userscripts/raw/master/tos_bazaar_auto_price.user.js
    Why have you got certain items set to not fill the price?
    • Phillip_J_Fry [2184575]
    • Role: Civilian
    • Level: 50
    • Posts: 257
    • Karma: 123
    • Last Action: 12 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:35:43 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    I don't

    Edit: Oh ha ha ha ha
    Last edited by Phillip_J_Fry on 02:36:48 - 10/04/20
    • PlatinumDevil [1920420]
    • Role: Civilian
    • Level: 98
    • Posts: 1565
    • Karma: 2275
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:38:13 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    Phillip_J_Fry [2184575]

    I don't

    Edit: Oh ha ha ha ha
    The script, not you.
    • Lugburz [2386297]
    • Role: Civilian
    • Level: 77
    • Posts: 807
    • Karma: 1328
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:58:36 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link

    Phillip_J_Fry [2184575]

    I tried these items and got NAN as the result for each
    Drug packs
    camels
    kitten
    Banana Orchid
    Big Box of Chocolate Bars
    Gold Ring
    Audi TT Quattro

    And it won't let me erase the NAN either

    Okay, I think the problem only exists when managing items in phone mode.

    The script uses item pictures to get their ids (item id is required in order to get its price via the API).
    I think, with the latest update, they've removed item pictures when managing items in phone mode. When adding items, picture are still there, and the script works.

    Temporary workaround is to use desktop mode on phone (click the PC icon in the top bar).
    I will try to get item ids without using their pictures but not exactly sure how to do that at this point.
    • Phillip_J_Fry [2184575]
    • Role: Civilian
    • Level: 50
    • Posts: 257
    • Karma: 123
    • Last Action: 12 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:08:14 - 10/04/20 (2 years ago)
    Post link copied to clipboard Copy post link
    The workaround works, thank you
Reply
Thread Title: