View Single Post
12-03-12, 07:43 PM   #1
drojden
A Defias Bandit
Join Date: Dec 2012
Posts: 3
Mapping/optimize stuff in LUA to make it fit in a macro?

Hello i'm doing a macro that will put specific marks on specific classes in arena.

This is what i have done so far.

/script v="player";for p=0,GetNumGroupMembers() do if(p>0) then v="party"..p;end;q,x,c=UnitClass(v); m=1;if c==11 then m=2; elseif c==5 then m=8; elseif c==1 then m=5; elseif c==8 then m=5; elseif c==9 then m=3; end;SetRaidTarget(v, m);end

Same code but easier to read:
Code:
v="player";
for p=0,GetNumGroupMembers() do 
    if(p>0) then 
        v="party"..p;
     end;
     q,x,c=UnitClass(v); 
     m=1;
     if c==11 then 
          m=2; 
     elseif c==5 then 
          m=8; 
     elseif c==1 then 
          m=5; 
     elseif c==8 then 
          m=5; 
     elseif c==9 then 
          m=3; 
     end;
     SetRaidTarget(v, m);
end
Pretty basic, getting the class id for all party members including my self and mapping marks ID to the class ID. "c" is Class ID and "m" is Mark ID in the code above.

Only problem is that the macro is using 239/255 chars and so far i have only covered 5 of the 11 classes that are available in game. Is there anyway to minimize my code with mapping or in any other way?
  Reply With Quote