Jump to content

Show Item IDs In Inventory & Equipment Source Code


TheAnswer

Recommended Posts

Why are you running 2 separate selectors?

if(currentTab() == Tab.INVENTORY)
{
	...
}
if(currentTab() == Tab.EQUIPMENT)
{
	...
}

Only one tab can be opened at any given time, so use else if for the 2nd selector, else if the first selector is true (inventory), you will also be redundantly checking to see if the equipment tab is open as well.

 

 

 

Also, the fuck is this?:

    if(currentTab() == Tab.INVENTORY)
    {
       ...
            if(currentTab() != Tab.INVENTORY)
                return;
       ...
    }
    if(currentTab() == Tab.EQUIPMENT)
    {
        ...
            if(currentTab() != Tab.EQUIPMENT)
                return;
        ...
    }

You don't need to check to see if we're not in the inventory tab once we've already checked to see if we're in the damn inventory tab.

Same for the equipment tab.

Edited by liverare
Link to comment
Share on other sites

Why are you running 2 separate selectors?

if(currentTab() == Tab.INVENTORY)
{
	...
}
if(currentTab() == Tab.EQUIPMENT)
{
	...
}

Only one tab can be opened at any given time, so use else if for the 2nd selector, else if the first selector is true (inventory), you will also be redundantly checking to see if the equipment tab is open as well.

 

 

 

Also, the fuck is this?:

    if(currentTab() == Tab.INVENTORY)
    {
       ...
            if(currentTab() != Tab.INVENTORY)
                return;
       ...
    }
    if(currentTab() == Tab.EQUIPMENT)
    {
        ...
            if(currentTab() != Tab.EQUIPMENT)
                return;
        ...
    }

You don't need to check to see if we're not in the inventory tab once we've already checked to see if we're in the damn inventory tab.

Same for the equipment tab.

 

Haha. Dam my bad on the if, else thing failed when doing the formatting. Thanks for pointing it out.

 

Anyway ,the "return" I added, is to break out of the for loop and exit the method so it can do other things, and not sit there going through the rest of the for loop painting the ID's when the tab has changed. I know the for loop is small and you wont notice the difference, but I added as practice for myself and is really useful with big for loops etc. You can also use a break if you just want to exit the for loop prematurely.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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