hi, i work on a little function that sorts my raid from a string that i give...
Code:
function doRaid()
local msg = URLFrameEditBox:GetText();
URLFrameEditBox:SetText("")
URLFrame:Hide();
rs = {}
gr = {}
cg = {}
local num = GetRealNumRaidMembers();
for i = 1, 40 do
local u = "raid"..i;
name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML, combatRole = GetRaidRosterInfo(i);
if UnitExists(u) then
rs[UnitName(u)] = { index = i, subgroup = subgroup };
if cg[subgroup] then
grpc = cg[subgroup];
else
grpc = 0;
end
cg[subgroup] = tonumber(grpc)+1;
end
end
local positions = { strsplit("&", msg) }
if msg ~= "" then
for i,ine in ipairs(positions) do
local ois = { strsplit(":", ine) }
local name = ois[1];
local group = ois[2];
if rs[name] then
if tonumber(rs[name]['subgroup']) ~= tonumber(group) then
if cg[group] == 5 then
for i, irs in pairs(rs) do
if tonumber(irs.subgroup) == tonumber(group) then
if rs[i].subgroup ~= group then
SwapRaidSubgroup(rs[name]['index'],irs.index);
return true
end
end
end
else
SetRaidSubgroup(rs[name]['index'],group);
end
end
end
end
end
end
the string is like that: Ikuria:4&Achot:2
it came from this page:
http://absence-gilde.com/?p=raidposi&b=1&s=1&g=1&u=0&e
to swap Ikuria in Group 4 and Achot to 2, but now the problem - if the group is full, it doesnt work - so i test it to count the group and if full then use swap, but... hmmm i have not the skill to do it right... can someone help?