Jump to content

help


Leo Messi

Recommended Posts

You can do it like this:

function getGridListItemsWithColor(gridlist, r, g, b)
	if isElement(gridlist) then
	local items = {} -- create a table 
		if tonumber(r) and tonumber(g) and tonumber(b) then -- RGB values are numbers
			for i=0, guiGridListGetRowCount(gridlist)-1 do -- get gridlist count
				local r, g, b = guiGridListGetItemColor(gridlist, i, 1) -- loop through all item colors
				if tr == r and tg == g and tb == b then -- if the color matches the specified RGB
					table.insert(items, i) -- insert the item number to the table
				end
			end
		end
	end
	return #items
end

If you're trying to get items with pure red color, use getGridListItemsWithColor(gridlist, 255, 0, 0). It will return the item number btw.

Link to comment

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...