Jump to content

Need help getting item count from inventory on start


Recommended Posts

Posted
5 hours ago, Alakazizam said:

I'm trying to set a variable on start from my inventory but it sets it to 0. I'm assuming because it's triggering before the character is actually loaded in. How can I go about this?
 

onStart should always run after being logged in, very rarely it could happen earlier.
You sure your code is correct? I use this in a lot of my scripts and never heard of an issues with this

  • Like 1
Posted
7 hours ago, Alakazizam said:

I'm trying to set a variable on start from my inventory but it sets it to 0. I'm assuming because it's triggering before the character is actually loaded in. How can I go about this?
 

how about setting the default value to null and make it get the count in the onloop if the var is still null 

  • Like 1
Posted
4 hours ago, Khaleesi said:

onStart should always run after being logged in, very rarely it could happen earlier.
You sure your code is correct? I use this in a lot of my scripts and never heard of an issues with this

I'll have to try again. Was burnt out this morning and may have messed up some maths lol

 

 

2 hours ago, xcx said:

how about setting the default value to null and make it get the count in the onloop if the var is still null 

Going to try to get the onStart method working again, but if that doesn't work out this is probably a good work around.

Posted
1 hour ago, Alakazizam said:

I'll have to try again. Was burnt out this morning and may have messed up some maths lol

 

 

Going to try to get the onStart method working again, but if that doesn't work out this is probably a good work around.

I mean if it really won't load the inventory, could do a conditionalSleep until 

myPlayer().exists(); or getInventory() !=null
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...