C_GossipInfo.SelectOption

From Warcraft Wiki
Jump to navigation Jump to search

Selects a gossip (conversation) option.

C_GossipInfo.SelectOption(optionID [, text, confirmed])

Arguments

optionID
number - gossipOptionID from C_GossipInfo.GetOptions()
text
string?
confirmed
boolean?

Example

Prints gossip options and automatically selects the vendor gossip when e.g. at an innkeeper.

local function OnEvent(self, event)
	local info = C_GossipInfo.GetOptions()
	for i, v in pairs(info) do
		print(i, v.icon, v.name, v.gossipOptionID)
		if v.icon == 132060 then -- interface/gossipframe/vendorgossipicon.blp
			print("Selecting vendor gossip option.")
			C_GossipInfo.SelectOption(v.gossipOptionID)
		end
	end
end

local f = CreateFrame("Frame")
f:RegisterEvent("GOSSIP_SHOW")
f:SetScript("OnEvent", OnEvent)

Patch changes

Dragonflight Patch 10.0.0 (2022-10-25): Changed index param to optionID.
Shadowlands Patch 9.0.1 (2020-10-13): Moved to C_GossipInfo.SelectOption()
WoW Icon update.png Patch 1.0.0 (2004-10-08): Added as SelectGossipOption()

See also

  • UI SelectGossipOption - This is an API for players and addon authors to continue to be able to select by index rather than ID