-
Posted by Delebrin on Thu, 27 Aug 2009 22:43:00
I'm working on a small quality of life addon for myself and my Officers. It basically involves adding a few /slash commands so we don't have to bring up the guild window to view/edit Public or Officer notes.
I have the slash commands working fairly well. The trouble I'm running into is figuring out the best method for obtaining the index of the guild member I need. I know that the GuildRosterSetOfficerNote() looks for index and note as arguments. I can't find an API call to find it just by name.
What's the best way of finding the index of a member by name so I can pass the info into the function? Any help or advice is most appreciated!
-
Posted by jnwhiteh on Fri, 28 Aug 2009 06:53:12
The only way to get the index is to query the guild roster and then find the name in the list.
-
Posted by Delebrin on Sat, 29 Aug 2009 07:45:05
Thanks for the help so far.
I've got it working so I can look a member up by index now. The next question I have is involving slash commands. I have the basic commands working, so it recognizes the first two commands e.g. /identified command.
I'm still a little confused about getting it to recognize commands after that (I tried looking at the Tokenizing example in Chapter 18, but I'm still slightly confused). In my case, I'd need it to recognize a character name, followed by a public/officer note(string) or simply a name, followed by a name.
So for one function it would be: /identifier command Name This is my new public note.
The other would look like: /identifier command Name Name2
Sorry to be asking so many easy questions. Just trying to get a firm grasp on the simple concepts. Any further help is much appreciated!
And on another note.. is there a search function for the forum posts here? I can't seem to find one anywhere unless I'm just blind. :)
-
Posted by jnwhiteh on Sun, 30 Aug 2009 00:02:26
Thanks for the help so far.
I've got it working so I can look a member up by index now. The next question I have is involving slash commands. I have the basic commands working, so it recognizes the first two commands e.g. /identified command.
I'm still a little confused about getting it to recognize commands after that (I tried looking at the Tokenizing example in Chapter 18, but I'm still slightly confused). In my case, I'd need it to recognize a character name, followed by a public/officer note(string) or simply a name, followed by a name.
So for one function it would be: /identifier command Name This is my new public note.
The other would look like: /identifier command Name Name2
Sorry to be asking so many easy questions. Just trying to get a firm grasp on the simple concepts. Any further help is much appreciated!
And on another note.. is there a search function for the forum posts here? I can't seem to find one anywhere unless I'm just blind. :)
As for the slash command, you can just use pattern matching to match whatever you need. For example. instead of using the tokenization example you could do something like this:
local function slashHandler(msg, editbox) local command, args = msg:match("^(%w+)(.+)$") if command == "firstCommand" then local name, note = args:match("^(%w+)(.+)$") -- Do something with the guild name and the note elseif command == "secondCommand" then for name in rest:gmatch("%w+") do -- Do something with this name end end end
As for searching through the forum posts, the best bet is to use google. I haven't had a chance to implement a search function on the site yet, but I would just use google's search. For example: http://www.google.co.uk/search?hl=en&source=hp&q=site%3Awowprogramming.com+forums+identifier&btnG=Google+Search&meta=&aq=f&oq=