Jump to content
McKay Development

[node-globaloffensive] Successive calls to GlobalOffensive.InspectItem not seeming to work


Recommended Posts

Hey there, I've currently spent today investigating and playing around with node-steam-user, and node-globaloffensive. I've have an array of inspect item links and I would like to check each of them using the InspectItem method, however my implementation seems to only send a protobuf message once, with successive calls not doing anything. It fires an 'inspectItemInfo' event once as it successfully displays the item details with.

csgo.on('inspectItemInfo', function (item) {
    console.log(`got item: paint index is ${item.paintindex} and paintwear is ${item.paintwear}`);

I am iterating over an items array containing the correct id, assetID and d value from the inspect link, I have validated each of these values work by manually inputting the values when calling InspectItem as they correctly give me the paint index and the wear float, however as previously mentioned it only seems to do this once, and then hangs.


Here is my implementation:

csgo.on('connectedToGC', function () {
    marketItemsObject.forEach(function (listing, index) {
            setTimeout(() => {
                csgo.inspectItem(listing.id, listing.assetID, listing.d);
            }, index * 3000);

Many thanks for any help you may be able to give as i've been stumped on this for a few hours now.

Link to comment
Share on other sites

I've changed the structure slightly as I don't think the requests were chaining properly, i.e all being sent after the setTimeout delay, so it now uses an async promise chaining structure to repeat the request n amount of times (I plan to iterate over the size of marketItemsObject.length, but testing with just 3 requests for now).


I've also changed the timeout delay to between 10 and 20 seconds, however it still seems only to be only returning the first item, and either failing or not attempting the rest. As you may say this probably might be rate limiting however so i'm going to leave it until tomorrow to see if there is any sort of reset on the limit, with a much larger interval.


Here's the re-done code for reference

getMarketFunctionIsHere().then(function (marketItemsObject) {
        async function asyncRepeat(f, n) {
            var i = 0;
            while (n-- > 0)
                i += await f(i);

        function itemFunction(i) {
            return new Promise(function (resolve, reject) {
                setTimeout(() => {
                    console.log('i is currently: %d', i);
                    csgo.inspectItem(marketItemsObject[i].id, marketItemsObject[i].assetID, marketItemsObject[i].d, () => {
                        console.log("Sent an inspect item request");
                    resolve(1); // resolve 1 to be added to index
                }, 50000);

        asyncRepeat(itemFunction, 3).then(() => {
            console.log("Completed Inspections");
Link to comment
Share on other sites

Update after leaving it for a day - you were correct with the rate limiting - i'm now waiting 30 seconds between each request just to be safe but it now iterates through my array and checks each item correctly, returning the pattern index and wear float :) Many thanks for your work on the node modules, it's greatly appreciated

Edited by TkrZ
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...