ArrayIndexer
About
ArrayIndexer is a WOTgreal macro that updates indexes of selected defaultproperties array items. It's handy when you reorder array items and dont want to upddate the index numbers manually.
Before
defaultproperties { DeathSounds(0)=Sound'NewDeath.fn_death01' DeathSounds(3)=Sound'NewDeath.fn_death04' DeathSounds(4)=Sound'NewDeath.fn_death05' DeathSounds(1)=Sound'NewDeath.fn_death02' DeathSounds(2)=Sound'NewDeath.fn_death03' }
After
defaultproperties { DeathSounds(0)=Sound'NewDeath.fn_death01' DeathSounds(1)=Sound'NewDeath.fn_death04' DeathSounds(2)=Sound'NewDeath.fn_death05' DeathSounds(3)=Sound'NewDeath.fn_death02' DeathSounds(4)=Sound'NewDeath.fn_death03' }
Code
program ArrayIndexer begin // ======================================================================== // UnrealScript ArrayIndexer // // Copyright 2005 Roman Switch` Dzieciol, neai o2.pl // http://wiki.beyondunreal.com/wiki/Switch // ======================================================================== cpos := 0; // ======================================================================== BlockBeginX, BlockBeginY := BlockBegin(); BlockEndX, BlockEndY := BlockEnd(); for line:=BlockBeginY to BlockEndY step 1 do begin SetCursorXY(0,line); sline := CurrentLine(); lpos := Pos('(',sline); if (lpos <> 0) then begin sleft := Copy(sline,0,lpos); rpos := Pos(')',sline); if (rpos <> 0) then begin sright := Copy(sline,rpos,Length(sline)-rpos+1); sline := sleft + IntToStr(cpos) + sright; cpos := cpos + 1; SetCurrentLine(sline); end; end; end; end;