Jump to content
McKay Development

Recommended Posts

Posted (edited)

Hi,

 

I have 2 things I'm not quite sure about:

 

1) Currently I use getUserInventoryContents(appid,contextid...etc) to load user's inventory as well as mine. Is it possible to select items from 2 different games in the same trade offer? For example: Their items in trade window will have both CSGO + Steam inventory items

 

2) How do I go about adding a certain amount of Steam Gems from user's / bot's inventory? I read this article: https://dev.doctormckay.com/topic/332-identifying-steam-items/ and know what asseid,contextid stands for, but I just can't figure out how to find a specific item in an inventory and  select Steam gems for example

 

Any help is appreciated!

Edited by Go Fast
Posted

  1. Sure, just load two inventories and add two items from different games.
  2. Change the amount property on the item. For example:

manager.getUserInventoryContents(steamID, 753, 6, true, (err, inv) => {
if (err) {
throw err;
}

let gems = inv.filter(item => item.market_hash_name == "Gems");
let item = gems[0];
item.amount = 300;
offer.addMyItem(item);
});
Posted (edited)

 

  1. Sure, just load two inventories and add two items from different games.
  2. Change the amount property on the item. For example:
manager.getUserInventoryContents(steamID, 753, 6, true, (err, inv) => {
	if (err) {
		throw err;
	}
	
	let gems = inv.filter(item => item.market_hash_name == "Gems");
	let item = gems[0];
	item.amount = 300;
	offer.addMyItem(item);
});

 

That was extremely helpful! Thanks!

I wasn't aware of the built in inv.filter command, so I made my own. At least now I know of a more efficient way

Edited by Dr. McKay
Fixed quote
Posted (edited)

 

  1. Sure, just load two inventories and add two items from different games.
  2. Change the amount property on the item. For example:
manager.getUserInventoryContents(steamID, 753, 6, true, (err, theirInv) => {
	if (err) {
		throw err;
	}
	
	let gems = inv.filter(item => item.market_hash_name == "Gems");
	let item = gems[0];
	item.amount = 300;
	offer.addMyItem(item);
});

Just realized filter() is a javascript method. I solved it 

Edited by Go Fast

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.

Guest
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.

Loading...
×
×
  • Create New...