Jump to content


Photo
Question

Tf2-node Checking if item is tradable and marketable



  • Please log in to reply
4 replies to this topic

#1 Preport

Preport

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 30 September 2018 - 05:30 AM

Hi I'm having some problems to get it to work I currently have 3 quackenbirds(947) one of them which is not tradable and not marketable but when I run this code return is 3.

 

for (var i = 0;i <tf2.backpack.length; i++){
   if (tf2.backpack[i].defIndex ==  947 && !tf2.backpack[i].flag_cannot_trade && !tf2.backpack[i].flag_cannot_craft){
   quack++;
   }
}


#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,208 posts

Posted 30 September 2018 - 09:14 PM

Determining from node-tf2 if an item is tradable is a task. There are like 4 different ways something can be untradable. There could be a flag, there could be one of several attributes, there could be a specific origin (achievement item).

 

You're probably better off just getting your inventory from Community.



#3 Jyn

Jyn

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 01 July 2019 - 02:12 PM

Determining from node-tf2 if an item is tradable is a task. There are like 4 different ways something can be untradable. There could be a flag, there could be one of several attributes, there could be a specific origin (achievement item).

 

You're probably better off just getting your inventory from Community.

 

Do you know how you would go about using each of these? I plan to make a bot that crafts hats with non tradable metal and rebuilding non tradable headgear, so I would prefer to do it with the tf2 backpack. That is unless you already have a easy section of code that takes the item id and checks it against the steam inventory. Otherwise for my project I would rather check the different ways it can be non tradable



#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,208 posts

Posted 01 July 2019 - 02:48 PM

It'll be a lot easier to retrieve your community inventory and just find the item with the matching ID.



#5 Jyn

Jyn

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 01 July 2019 - 05:41 PM

It'll be a lot easier to retrieve your community inventory and just find the item with the matching ID.

Okay so I'm doing that now but I have an issue with the steamcommunity.getUserInventoryContents it seems to be getting skipped in the code and ran at the end so at the time of where it is used it just puts out undefined.







Also tagged with one or more of these keywords: Question

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users