View Single Post
06/29/23, 04:19 PM   #7
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 247
so far its working perfectly and havent been able to break what I have running..

I do have some questions regarding:

Code:
SLASH_COMMANDS["/rd"] = function (option)--<< /RD TELEPORT TO ZONE OR SPECIFIC PLAYER HOUSE
	if option == "" then df(RidinDirty.logo .. "  /rd partialzonename => overland zones") df(RidinDirty.logo .. "  /rd exact@name partialhousename => player houses") return end
	local options = {}
    local searchResult = { string.match(option,"^(%S*)%s*(.-)$") }--<<<<< THESE SYMBOLS
	for i,v in pairs(searchResult) do
        if (v ~= nil and v ~= " ") then
            --options[i] = string.lower(v)
			options[i] = v
		end
    end
	if (options[3] ~= nil and options[3] ~= "") then df(RidinDirty.logo .. "  /rd partialzonename => overland zones") df(RidinDirty.logo .. "  /rd exact@name partialhousename => player houses") return end
	if (options[2] ~= nil and options[2] ~= "") then
		RidinDirty.Teleport(options[1], options[2])
	else
		RidinDirty.Teleport(options[1])
	end
end
im weak on those symbols i got from a sample someplace for string finding and matching.. What is there seems to function OK for 1 or 2 words but if theres a 3rd its gets wonky...

-What im trying to do with them is if theres no "options" then display a help text..
-if theres options[1] and options[2] then if it contains an "@" do my code for teleport to specific player house which its currently doing fine if there 2 words but not checking for "@"
-if theres options[1] options[2] options[3]++++ then display help text

I google like mad to find the meaning of thes symbols but theres some wild explanations what make it hard to make sense of.

id like it todo as follows if a user or myself type these:

/rd => display df("blah blah") help text
/rd word => find player in zone"word" and go there
/rd word word => goto specific player house if @symbol in word1 and find a house matching word2 or if no @symbol in word1 then => display df("blah blah") help text
/rd word word word or more words => display df("blah blah") help text

Last edited by sinnereso : 06/29/23 at 04:31 PM.
  Reply With Quote