Author Topic: Python item counter, for backpack  (Read 6361 times)

0 Members and 1 Guest are viewing this topic.

Offline JlMTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • JlM has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Python item counter, for backpack
« on: December 19, 2018, 05:44:59 AM »
0
I have a def that will work if I reach a certain weight. I'm needing one for item count in my backpack. Can someone shoot me in the direction of a example or some documentation. Any help would be appreciated.

Offline ZeroDX

  • Stealth Developer
  • Jr. Member
  • **
  • Posts: 34
  • Activity:
    0%
  • Reputation Power: 1
  • ZeroDX has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Python item counter, for backpack
« Reply #1 on: December 19, 2018, 08:05:06 AM »
0
here you are
CountEx
Count

Offline JlMTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • JlM has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Python item counter, for backpack
« Reply #2 on: December 19, 2018, 09:20:34 AM »
0
Thank you for the response.

To be more descriptive. I need to know when I'm close to over item count ie 120 items in my backpack. I have the ability to do it based on weight, but with certain items I will not be over weight but reach the item limit.

Post Merge: December 19, 2018, 09:25:56 AM
For instance a bod book. Full of bods
« Last Edit: December 19, 2018, 09:25:56 AM by JlM »

Offline ZeroDX

  • Stealth Developer
  • Jr. Member
  • **
  • Posts: 34
  • Activity:
    0%
  • Reputation Power: 1
  • ZeroDX has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Python item counter, for backpack
« Reply #3 on: December 19, 2018, 11:31:18 AM »
0
Code: Python
  1. LIMIT = 120
  2.  
  3. if Count(-1) > LIMIT:
  4.     pass  # items quantity in a backpack more than 120
  5.  

Offline JlMTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • JlM has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Python item counter, for backpack
« Reply #4 on: December 19, 2018, 04:11:08 PM »
0
LIMIT = 100

if Count(-1) > LIMIT:
  pass
  print("Overweight")


It prints a blank with no words when i hit play and have more or less than 100 items in bag.

Offline ZeroDX

  • Stealth Developer
  • Jr. Member
  • **
  • Posts: 34
  • Activity:
    0%
  • Reputation Power: 1
  • ZeroDX has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Python item counter, for backpack
« Reply #5 on: December 19, 2018, 08:25:28 PM »
0
Code: Python
  1. LIMIT = 100
  2.  
  3. def get_count(type=-1, color=-1, container=Backpack(), recurse=False):
  4.     FindTypeEx(type, color, container, recurse)
  5.     return FindCount()
  6.  
  7. total = Count(-1)  # total items quantiry (if you have only 100gp in your pack, this will return 100)
  8. if total > LIMIT:
  9.     AddToSystemJournal("total quantity: " + str(total) + " greater than LIMIT: " + str(LIMIT))
  10. count = get_count()
  11. if count > LIMIT:
  12.     AddToSystemJournal("quantity: " + str(count) + " greater than LIMIT: " + str(LIMIT))
  13.  

Offline JlMTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • JlM has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Python item counter, for backpack
« Reply #6 on: December 20, 2018, 12:38:15 AM »
0
Thank you for all the help!

Tags: