Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-02-20, 09:46 AM   #1
Believe82
A Murloc Raider
Join Date: Sep 2020
Posts: 9
Thumbs down Adding char names to addon via slash command

Hi so I have addon that helps me distribute mounts and loot in aq40 and I would like to create an exemption table using a slash command.

At the moment I call the slash command via:
Code:
SLASH_NLOOT1 = "/nl"

SlashCmdList.NLOOT = function(input)
	input = string.lower(input)
        if input == "log" then
		NL_LOGGING = not NL_LOGGING
		local word = "Disabled"
		if NL_LOGGING then
			word = "Enabled"
		end
		print("NLoot: Logging " .. word)
		return
	elseif input == "resetmount" then
		mountList = {}
		lootList = {}
		mountDistributed = 0
		print("NLoot: Mount list and all history have also been reset")
		return
	elseif input == "history" then
		local lootCount = 0
		for i,v in pairs(lootList) do
			print(i .. ": " .. v)
			lootCount = lootCount + 1
		end
		if lootCount == 0 then
			print("No items have been distributed yet")
		end
		return
	elseif input == "masteraq" then
		NL_Master = true
		local playerName = UnitName("player")
		SetLootMethod("Master",playerName,"1")
		return	
	elseif input == "master" then
		NL_Master = true
		local playerName = UnitName("player")
		SetLootMethod("Master",playerName,"2")
		return
	elseif input == "" then
	else
		print("NLoot: Invalid Command, Input '/nl help' to get a list of available commands")
		return
	end

	if NL_ENABLED then
		NL_ENABLED = false
		print("NLoot: Disabled")
	else
		NL_ENABLED = true
		print("NLoot: Enabled")
	end
end
I wonder if I can add a slash command "/nl hasmount Playername"
where the lua would handle the Player name and pass it to an array or table. this way I could then make the addon check if the player is on that list or not.

Thank you for your help.

Last edited by Believe82 : 09-02-20 at 09:54 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Adding char names to addon via slash command

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off