tarajunky
2006-05-25 12:19:57
I'm concerned that SetFightMode is not generic enough.
If you're weilding a Scimmy, then fightmode 3 is 'controlled'. If you're weilding a 2h then it's 'Aggressive'. If you're unarmed, then again there are only 3 buttons in different places, and the third button is 'Defensive'.
If you're training a pure character with a script, having it accidentally select the wrong button can ruin days or weeks of time and ruin a character.
The way I do it in my scripts is to base the clicking on the presence of the text for 'Accurate', 'Aggressive', or 'Defensive'. The bitmaps detect those words and if the button to the left of that word is not red, it will click it. The bitmaps aren't necessary if one could use a FindText type procedure to detect the text reliably.
Also, since SRL seems to have a problem properly selecting the button every time, I added a repeat loop to make sure that the button actually gets selected before moving on.
If you're weilding a Scimmy, then fightmode 3 is 'controlled'. If you're weilding a 2h then it's 'Aggressive'. If you're unarmed, then again there are only 3 buttons in different places, and the third button is 'Defensive'.
If you're training a pure character with a script, having it accidentally select the wrong button can ruin days or weeks of time and ruin a character.
The way I do it in my scripts is to base the clicking on the presence of the text for 'Accurate', 'Aggressive', or 'Defensive'. The bitmaps detect those words and if the button to the left of that word is not red, it will click it. The bitmaps aren't necessary if one could use a FindText type procedure to detect the text reliably.
Also, since SRL seems to have a problem properly selecting the button every time, I added a repeat loop to make sure that the button actually gets selected before moving on.
Gametab(1);
Wait(950);
Status('Selecting Combat Mode');
If (StatToTrain='Attack')And(getcolor(570, 294) = 4803916)Then
begin
Repeat
Mouse(random(30) + 570, random(5) + 280, 0, 0, true);
Wait(750+random(250));
i:=i+1;
Until (Not(getcolor(570, 294) = 4803916)) or (i>=4);
end else If (StatToTrain='Range')And(getcolor(570,324) = 5067346)Then
begin
Repeat
Mouse(random(30) + 570, random(5) + 324, 0, 0, true);
Wait(750+random(250));
i:=i+1;
Until (Not(getcolor(570,324) = 5067346)) or (i>=4);
end;
begin
If (StatToTrain='Strength')Then
begin
CombatBmp := BitmapFromString(25, 11, 'z78DA33300001372030C' +
'0027089D31A10E31EFABB0DD3C6C1106E94BB0A228EDFCDF8D560' +
'C60B2E57E12249F511F122F8D30CF16135B02243CB55B8629C543' +
'5B4CE5FC49843EBBC4CDDB8A085DB2829193001004D2D4C20');
If FindBitMapIn(CombatBmp,x,y,555,205,740,465) then
If Not(SimilarColors(1908611,GetColor(x-20,y+10),50)) then
begin
Repeat
Mouse(x-60+random(30), y+10+random(5), 0, 0, true);
Wait(750+random(250));
i:=i+1;
Until (SimilarColors(1908611,GetColor(x-20,y+10),50)) or (i>=4);
Freebitmap(CombatBmp);
end;
end else
If (StatToTrain='Defense')Then
begin
CombatBmp := BitmapFromString(20, 11, 'z78DA333000013720308' +
'002081B99A405C034991811FAD84B2DDB314395127B8989115CF1' +
'489EBD03AB17BF7F71A9A1AE9B294FBDC4E726E27D4D8BB44AAA7' +
'FE903E86F2F2E1B01BD8C0918');
If FindBitMapIn(CombatBmp,x,y,555,205,740,465) then
If Not(SimilarColors(1908611,GetColor(x-20,y+10),50)) then
begin
Repeat
Mouse(x-60+random(30), y+10+random(5), 0, 0, true);
Wait(750+random(250));
i:=i+1;
Until (SimilarColors(1908611,GetColor(x-20,y+10),50)) or (i>=4);
Freebitmap(CombatBmp);
end;
end;
end;
If (i>=4) Then
begin
Writeln('Unexpected Error');
begin
repeat
Wait(1000);
FindNormalRandoms;
until(not(LoggedIn));
NextPlayer(True);
end;
end;