Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI - Label Width and displaying Label + Figure. item.count function
#1
Have played around with the Wiki sample and using the post here http://www.mmominion.com/Thread-Problem-...3#pid35673 I was able to get it going.

Trying to create a module for practice to List out fish I select and how many I have in my inventory.

Displays to console correctly. However it does not seem to count a full stack + X instead it only counts the number in an uncompleted stack. for example I have 100 Fullmoon Sardines yet it only counts it as 1.

Also I'm having trouble getting it to generate the label + Number field like in the sample. I can only get it to display both if I concatenate them together and then I can't see it all because the field size is limited in the display. Any Way to increase the field size?

Help would be appreciated.

Code:
-- Create a new table for our code:
fishmanager= { }
-- Some local variables we use in our module:
fishmanager.running = false
fishmanager.lastticks = 0
fishmanager.fishCount = "0"



-- Whitelist fish // to convert to inbuilt whitelist / blacklist system
fishmanager.Whitelist = {
["Silver Shark"] = 4903,
["Fullmoon Sardine"] = 4898,
["HammerHead Shark"] = 4893
}

-- Initializing function, we create a new Window for our module that has 1 button and 1 field to display data:
function fishmanager.ModuleInit()
    GUI_NewWindow("fishmanager",50,50,100,10);
    GUI_NewButton("fishmanager","Turn On or Off","fishmanager.TOGGLE");
   -- GUI_NewField("fishmanager","Fish Name","My Fish :","FishList"); -- In order to display the value of this field, it must be a part of a group ("HitPoints").
    GUI_SizeWindow("fishmanager",550,450) -- This line currently required in order to properly resize and display the window. GUI_NewWindow is a little broken right now.
end

-- The function that gets called when the button is pressed:
function fishmanager.ToggleRun()
    fishmanager.running = not fishmanager.running
end

--Function to locatefish in inventory eg local item= Inventory:Get(4903)  == Silver Shark here uses Whitelist
function fishmanager.invsearch(fishName , fishID)
    local item= Inventory:Get(fishID)
        if ( item and item.count~= 0 ) then
            d("ItemID. " ..tostring(item.id))
            d("ItemName. "..item.name )
            d("ItemCount. " ..item.count)
        --    d("Shits and Giggles")

            fishmanager.fishNamelabel = tostring(item.name)
            fishmanager.fishCount = tostring(item.count)
            GUI_NewField("fishmanager", fishmanager.fishNamelabel .. " " .. fishmanager.fishCount , "Fish List")

        end

end

-- Function to udate gui list
-- If fish is whitelisted and no longer <=0 then add to fishlist in GUI
-- function fishmanager.fishlist(fishName , fishcount)
--     GUI_NewField("fishmanager",fishname,fishcount,"FishList");

-- end


-- The Mainloop function, gets called all the time by FFXIVMinion:
function fishmanager.OnUpdateHandler( Event, ticks )
-- checks if module is running and updates every approx 10 sec.
    if ( fishmanager.running and ticks - fishmanager.lastticks > 10000 ) then
        fishmanager.lastticks = ticks

-- display current inventory items of type X in console Window:
        --     fishmanager.invsearch(4903)
--            for fishName, fishID in pairs(fishmanager.Whitelist) do
--                fishmanager.invsearch(fishName , fishID)
--            end
--    end
--end

-- display current inventory items of type X in console Window:
        --     fishmanager.invsearch(4903)
            for fishName, fishID in pairs(fishmanager.Whitelist) do
                fishmanager.invsearch(fishName , fishID)
            end
    end
end




-- Registering the Event RegisterEventHandler("GUI.Update",MyModule.GUIVariableChanged)

RegisterEventHandler("Gameloop.Update",fishmanager.OnUpdateHandler) -- the normal pulse from the gameloop
RegisterEventHandler("fishmanager.TOGGLE", fishmanager.ToggleRun) -- the function that gets called when our button is pressed
RegisterEventHandler("Module.Initalize",fishmanager.ModuleInit) -- the initialization function, gets called only once at startup of the game
Reply
 


Messages In This Thread
GUI - Label Width and displaying Label + Figure. item.count function - by Digitalrecline - 01-14-2015, 05:22 AM
RE: GUI - Some Progress made. - by Digitalrecline - 01-14-2015, 10:58 AM
Cheers - by Digitalrecline - 01-20-2015, 12:10 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products