Page 1 of 1

mudlet curing table

Posted: Tue Sep 30, 2014 6:23 am
by patrick1
hello everyone I'm having trouble working out how to send multiple affliction names from my curing table so far i can get the script to send sip unravel guilt if i'm afflicted with that but not for multiple afflictions such as if i'm afflicted with guilt and mindhaze i can't seem to figure out how to get it to send sip unravel guilt mindhaze here is the script i have any help would be appreciated and hopefully that's enough info

function cure()
for _,v in pairs(afflictionlist) do
if afflictQueue[v.name] and elixbal == 1 then
send(v.cure .. v.name);elixbal = 0.5
end
end
end

afflictionlist = {

{name = "mindhaze", cure = "sip unravel "},
{name = "guilt", cure = "sip unravel "},
{name = "aethercage", cure = "sip unravel "},
{name = "aetherwave", cure = "sip unravel "},
{name = "aurora", cure = "sip unravel "},
{name = "bafflement", cure = "sip unravel "},

}

Re: mudlet curing table

Posted: Tue Sep 30, 2014 2:59 pm
by icesteruk
is ' afflictQueue ' the table you track if you have an affliction or not?

If thats the case I use something like this
Code: [show] | [select all] lua
function cure()


		for i,v in pairsByKeys(afflictionlist) do

if afflictQueue[v.name] and elixir == 1 then
send(v.cure)
elixbal = 0.5
				break
			end
		end
	end

or something like that . I've not tested it so, have fun :P

Re: mudlet curing table

Posted: Tue Sep 30, 2014 11:36 pm
by Akaya
You'll want to create a local table to store the names. Then concatenate the table with a space at the end of your send function.
Code: [show] | [select all] lua
function cure()
  local names = {}
  for _,v in pairs(afflictionlist) do
    if afflictQueue[v.name] and elixbal == 1 then
      table.insert(names, v.name)
    end
  end
  send(v.cure..table.concat(names, " ") )
end
Written from my phone fyi