View Single Post
06/29/23, 11:24 PM   #16
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 660
- What is there seems to function OK for 1 or 2 words but if there a 3rd its gets wonky
- What i cant find any info on is the S in %S. But based on that example it seemed it was doing the separate words.
- "^(%S*)%s*(%S*)%s*(%S*)%s*(%S*)$"

So I explained what the S was and showed a way to handle 1 or more words. For some reason you are frustrated with the fact the link didn't have an S on it, which is concerning.

I get you are asking but it's concerning when people ask questions and then when someone answers they put it on the person providing the answer that they did or said something wrong. Usually some rhetoric follows at some point like, "I can ask because it's the help section! Geez I'm just asking." which is just an excuse for their reaction. It's like damed if I do, damed if I don't and I'm the jerk either way. When that's not the case because I answered the question, politely, the first time. They were the ones whining about it and saying they can't figure it out.

Code:
function HandleSlashCommands(allArgs)
  local argument1 = ""
  local argument2 = ""
  local argument3 = ""

  local argNum = 0
  for word in zo_strgmatch(allArgs, "%S+") do
    argNum = argNum + 1
    if argNum == 1 then argument1 = word end
    if argNum == 2 then argument2 = word end -- which could have an @ in it
    if argNum == 3 then argument3 = word end -- use tomunber() if it's an integer
  end
  argument1 = string.lower(argument1) -- to make sure you find what you want in the string
  -- lower the 2nd or 3rd argument if needed

  if argument1 == "help" then
    <<do stuff>>
  end

  local someBooleanVar = <<your code>> -- to detect if the argument has an @
  -- use argument2 ~= "" or argNum == 2, or argNum >= 2
  if argument1 == "travel" and (argument2 ~= "" and someBooleanVar) then -- like when the 2nd argument has an @ in it
    <<do stuff to travel to house>>
  end

<< and so on>>

Last edited by Sharlikran : 06/29/23 at 11:31 PM.
  Reply With Quote