roughnecks Posted January 22, 2019 Report Share Posted January 22, 2019 Say I want to create an offer but need to add just Trading Cards to it, how do I select them? I already know about appid, contextid and "item_class_2" but I need a working example after I loaded my Inventory, which has 4 [Object] inside "tags": CEconItem { appid: 753, contextid: '6', assetid: '10305554518', classid: '1496965455', instanceid: '0', amount: 1, pos: 30, id: '10305554518', background_color: '', icon_url: 'IzMF03bk9WpSBq-S-ekoE33L-iLqGFHVaU25ZzQNQcXdA3g5gMEPvUZZEaiHLrVJRsl8vGuCUY7Cjc9ehDNVzDMCeHqtjCQrcex4NM6b8wT1tePGP3j2fSSCJizYG1s1RLtXYTzc9zSjsL-QQj6dE-wkEggGfvQA8GFPPZzbNhM_1YcK_GPhwwp3DhFucMpUdAqp9X0eMLoglXVEd59RmXWjJpDc1F5hYUA8W-2yBLzHbdLzlSYhCxtiGvEYMYOXsXDyuMmmfLGLLIM8gGfI', icon_url_large: 'IzMF03bk9WpSBq-S-ekoE33L-iLqGFHVaU25ZzQNQcXdA3g5gMEPvUZZEaiHLrVJRsl8vGuCUY7Cjc9ehDNVzDMCeHqtjCQrcex4NM6b8wT1tePGP3j2fSSCJizYG1s1RLtXYTzc9zSjsL-QQj6dE-wkEggGfvQA8GFPPZzbNhM_1YcK_GPhwwp3DhFucMpUdAqp9X0eMLoglXVEd59RmXWjJpDc1F5hYUA8W-2yBLzHbdLzlSYhCxtiGvEYMYOXsXDyuMmmfLGLLIM8gGfI', descriptions: [ [Object] ], tradable: true, owner_actions: [ [Object], [Object] ], name: 'Santa Claus', type: 'Solitaire Christmas. Match 2 Cards Trading Card', market_name: 'Santa Claus', market_hash_name: '428510-Santa Claus', market_fee_app: 428510, commodity: true, market_tradable_restriction: 7, market_marketable_restriction: 7, marketable: true, tags: [ [Object], [Object], [Object], [Object] ], is_currency: false, fraudwarnings: [] }, CEconItem { Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted January 22, 2019 Report Share Posted January 22, 2019 CEconItem has a getTag method. Filter your inventory to only items with the tag you're looking for. roughnecks 1 Quote Link to comment Share on other sites More sharing options...
roughnecks Posted January 22, 2019 Author Report Share Posted January 22, 2019 Thanks Doc, didn't know about getTag, will check that out and let you know later. Quote Link to comment Share on other sites More sharing options...
roughnecks Posted January 23, 2019 Author Report Share Posted January 23, 2019 So, I get this for tags array (trading card): [17:07:04] [LOG] [ { internal_name: 'droprate_0', name: 'Common', category: 'droprate', category_name: 'Rarity', localized_tag_name: 'Common', color: '', localized_category_name: 'Rarity' }, { internal_name: 'app_388390', name: '"Glow Ball" - The billiard puzzle game', category: 'Game', category_name: 'Game', localized_tag_name: '"Glow Ball" - The billiard puzzle game', color: '', localized_category_name: 'Game' }, { internal_name: 'cardborder_0', name: 'Normal', category: 'cardborder', category_name: 'Card Border', localized_tag_name: 'Normal', color: '', localized_category_name: 'Card Border' }, { internal_name: 'item_class_2', name: 'Trading Card', category: 'item_class', category_name: 'Item Type', localized_tag_name: 'Trading Card', color: '', localized_category_name: 'Item Type' } ] And the getTag method is: getTag(category)category - A string containing the tag's category (the category property of the tag object) So, which category should I look for? I don't see any meaningful one on the array. Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted January 23, 2019 Report Share Posted January 23, 2019 item_class Quote Link to comment Share on other sites More sharing options...
roughnecks Posted January 24, 2019 Author Report Share Posted January 24, 2019 Sorry but every Item has that "item_class" category, so how do I separate Cards from everything else? [16:24:10] [LOG] [ { internal_name: 'droprate_1', name: 'Uncommon', category: 'droprate', category_name: 'Rarity', localized_tag_name: 'Uncommon', color: '', localized_category_name: 'Rarity' }, { internal_name: 'app_285840', name: 'Enemy Mind', category: 'Game', category_name: 'Game', localized_tag_name: 'Enemy Mind', color: '', localized_category_name: 'Game' }, { internal_name: 'item_class_3', name: 'Profile Background', category: 'item_class', category_name: 'Item Type', localized_tag_name: 'Profile Background', color: '', localized_category_name: 'Item Type' } ] Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted January 24, 2019 Report Share Posted January 24, 2019 let tag; if ((tag = item.getTag('item_class')) && tag.internal_name == 'item_class_2') { ... } Quote Link to comment Share on other sites More sharing options...
roughnecks Posted January 24, 2019 Author Report Share Posted January 24, 2019 I already used that tag.internal_name == 'item_class_2' in another place but now it's different because I'm not getting a tags array when loading my inventory, but 3 or 4 nested objects (like I first posted) and I don't know how to access them. Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted January 24, 2019 Report Share Posted January 24, 2019 You are still getting an array. tags: [ [Object], [Object], [Object], [Object] ] is just how console.log represents an array containing 4 objects. roughnecks 1 Quote Link to comment Share on other sites More sharing options...
roughnecks Posted January 25, 2019 Author Report Share Posted January 25, 2019 Got it to work with some "quirks", so thanks for helping me out so far. Onto the next quest! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.