Setting variables to the number of weapons, armor in your inventory.

I've looked through the forum and I haven't seen anything on this. So here's the issue I have a Dialog box to report what item was just found. I can't figure out how to put my screen shot on here so I'll just type it.

set startingvar = number of item in inventory(we'll say this is 0 for the example)

change item + 1 

Set newtotalvar = number of item in inventory(this should be 1 )

if startingvar not equal to 0

                 newtotalvar =  newtotalvar -startingvar

end

Text:

            \v[ newtotalvarnumbe] item was found ! (this works and reports a 1 as the var value)

So what's the issue?

If I use the number of a armor or weapon I get a value of 0 every time. It's not setting the value to anything.  
Please provide screenshots of the event code you're using. That is a lot better and your description is unclear in several points, we need to see your event code itself to find the errors.

That said, from what you wrote it's clear why you get a zero - you're setting the newtotal to the starting value, and if the starting value is not zero you substract the starting value from newtotal. That will always result in zero as you substract the starting value from a variable that is set to the same value.
It only fires the if if the starting var is NOT 0 if the starting value is 0 it will not substract anything. The starting value is only set once at the begin.

easy example:

 You have 2 apples

I store you have 2 apples(var1)

 I give you 1 apple

You now have 3 apples

I store you have 3 apples(var2)

I then report var 2 - var 1 

in this case it would be 1. 
Then please give screenshots of your events - because somewhere in the line you're using a wrong command, and we need to see what you really placed in the event, not what you believe to have placed there.
[IMG]http://i.imgur.com/N9rqK5M.gif[/IMG]

http://imgur.com/N9rqK5M (Doesn't work)

[IMG]http://i.imgur.com/3mtzqLS.gif[/IMG]

http://imgur.com/3mtzqLS (Works)

(Items I had) should be (Items I found) It doesn't effect the out come it still won't work.  
What plugins do you have?
I assume "Items I Had" is the name of a variable - but you don't define that variable in these events, so it depends on where it is defined.

And it is different from what you wrote in the texts above - there you wrote that the conditional branch would check the first variable, but in reality you're checking a completely unconnected third variable if that is not zero.

Please post screenshots where that variable is defined as well as the events or skills that are calling those two common events.

Additionally, please don't crop screenshots - for determing which event is called where the ID of the event may become important.
YEP_CoreEngine

YEP_BattleEngineCore

YEP_AutoPassiveStates

Yep_BattleAICore

Yep_SkillCore

Yep_MessageCore

Yep_EquipCore

Yep_itemCore

Yep_EventChasePlayer

Yep_X_SkillCooldowns

in that order.
Here they are again

 Works

Spoiler
[IMG]http://i.imgur.com/JbkaTko.png[/IMG] 
Doesn't Work

Spoiler
[IMG]http://i.imgur.com/KJVPLyt.png[/IMG]  
Rumble82, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

If you want to add something and your own post is the last one, please edit it.

1) Check if you have the latest versions of Yanfly's scripts, especially the itemcore as that script had a bug that was solved weeks ago.

2) please add show text commands with \V for the variable after each control variable command to check which value is in which variable at which step.

3) you still didn't explain where and how you call those common events, because by themselves they do nothing at the moment and can't even be tested without a call from somewhere.
Updating the script fixed it. Thank you for your help

Original thread: https://forums.rpgmakerweb.com/threads/setting-variables-to-the-number-of-weapons-armor-in-your-inventory.51743/