SRL Archive - SRL Suggestions

LevelUpEx Antiban


Flight

2011-07-21 21:20:53

Credits to Huthaifah for the idea, and credit to Awkwardsaw for cleaning it up. :)


{*******************************************************************************
function LevelUpEx : Boolean;
By: Flight
Description: Clicks Continue if you've leveled up, also clicks the given stat
*******************************************************************************}
function LevelUpEx : Boolean;
var
a, X, Y: Integer;
Skills: TStringArray;
begin

if (FindNPCChatText('gratu', Nothing) Or FindBlackChatMessage('just adva')) then
Result:= True;
if Result then
begin
ClickContinue(True, True);
Wait(RandomRange(50,110));

Skills := ['Attack', 'Defence', 'Strength', 'Constitution', 'Mining', 'Smithing',
'Woodcutting', 'Firemaking', 'Magic', 'Fletching', 'Hunting', 'Summoning',
'Fishing', 'Construction', 'Herblore', 'Agility', 'Thieving', 'Crafting',
'Ranged', 'Slayer', 'Farming', 'Prayer', 'Runecrafting', 'Cooking'];
for a:= 0 to High(Skills) do
if IsChatBoxTextBetween(Skills[a], clMessage, 1, 8) then
if IsChatBoxTextBetween('Constitution', clMessage, 1, 8) then
HoverSkill('HitPoints', True)
else
HoverSkill(Skills[a], True);

MMouse(450,50,10,10);
Wait(RandomRange(50,110));
if IsUpText('Close') then
begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,True);
end;

WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;

Just call "LevelUpEx" in your main loop (or wherever appropriate) so it's always being checked.

This will check if you've lleveled up recently through both the 'Level-up chat display' and the chat messages. It'll click continue if the display is present and then move to your Stats tab, click the skill that leveled up, and close out of that window.

If you're doing a repetitive task (Woodcuting, fishing, cooking, ect…) you'll continue to do that task after this has closed out the level up window. It is, however, a bit slow while on the level up window because it uses 'HoverSkill', which has a 5-14 second wait. :sleeping: Anyways, I tested it multiple times while cooking, it works just fine. :)

Huthaifah

2011-07-21 21:22:33

Nice job. Check my other idea on the same thread, maybe that's possible to do?

Flight

2011-07-21 21:24:33

Having just one response message to say when someone talks to you is a bit obvious. This is why auto-responders are so difficult. :(

Huthaifah

2011-07-21 21:26:19

It's not a response, you use quick chat so the people around you know that your muted so they won't talk, and even if they did talk, it would be about the skill that your training, and you could add a function that searches in the quick chat thingy majigger, saying My Ranged level is 213445. You don't speak, the quick chat does the speaking.

Awkwardsaw

2011-07-21 21:44:33


function LevelUpEx : Boolean;
var
X,Y: Integer;
levels : Array of String;
begin
if (FindNPCChatText('gratu', Nothing) Or FindBlackChatMessage('just adva')) then
Result:= True;
if Result then
begin
levels:= ['Attack', 'Defence', 'Strength', 'Constitution', 'Mining', 'Smithing',
'Woodcutting', 'Firemaking', 'Magic', 'Fletching', 'Hunting', 'Summoning',
'Fishing', 'Construction', 'Herblore', 'Agility', 'Thieving',
'Crafting', 'Ranged', 'Slayer', 'Prayer', 'Runecrafting', 'Cooking'];
ClickContinue(True, True);
Wait(RandomRange(50,110));
for i := 0 to high(levels) do
begin
if IsChatBoxTextBetween(levels[i], clMessage, 1, 8) then
begin
HoverSkill(levels[i],True);
MMouse(450,50,10,10);
Wait(RandomRange(50,110));
if IsUpText('Close') then
begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,True);
end;
WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;
end;

cleaner, in my opinion :)

KingKong

2011-07-21 21:46:38

From: Awkwardsaw

function LevelUpEx : Boolean;
var
X,Y: Integer;
levels : Array of String;
begin
if (FindNPCChatText('gratu', Nothing) Or FindBlackChatMessage('just adva')) then
Result:= True;
if Result then
begin
levels:= ['Attack', 'Defence', 'Strength', 'Constitution', 'Mining', 'Smithing',
'Woodcutting', 'Firemaking', 'Magic', 'Fletching', 'Hunting', 'Summoning',
'Fishing', 'Construction', 'Herblore', 'Agility', 'Thieving',
'Crafting', 'Ranged', 'Slayer', 'Prayer', 'Runecrafting', 'Cooking'];
ClickContinue(True, True);
Wait(RandomRange(50,110));
for i := 0 to high(levels) do
begin
if IsChatBoxTextBetween(levels[i], clMessage, 1, 8) then
begin
HoverSkill(levels[i],True);
MMouse(450,50,10,10);
Wait(RandomRange(50,110));
if IsUpText('Close') then
begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,True);
end;
WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;
end;

cleaner, in my opinion :)


It has a couple of flaws :P

Here is mine, which should be good:

{*******************************************************************************
function LevelUpEx : Boolean;
By: Flight
Description: Clicks Continue if you've leveled up, also clicks the given stat
*******************************************************************************}
function LevelUpEx : Boolean;
var
a, X, Y: Integer;
Skills: TStringArray;
begin

if (FindNPCChatText('gratu', Nothing) Or FindBlackChatMessage('just adva')) then
Result:= True;
if Result then
begin
ClickContinue(True, True);
Wait(RandomRange(50,110));

Skills := ['Attack', 'Defence', 'Strength', 'Constitution', 'Mining', 'Smithing',
'Woodcutting', 'Firemaking', 'Magic', 'Fletching', 'Hunting', 'Summoning',
'Fishing', 'Construction', 'Herblore', 'Agility', 'Thieving', 'Crafting',
'Ranged', 'Slayer', 'Farming', 'Prayer', 'Runecrafting', 'Cooking'];
for a:= 0 to High(Skills) do
if IsChatBoxTextBetween(Skills[a], clMessage, 1, 8) then
if IsChatBoxTextBetween('Constitution', clMessage, 1, 8) then
HoverSkill('HitPoints', True)
else
HoverSkill(Skills[a], True);

MMouse(450,50,10,10);
Wait(RandomRange(50,110));
if IsUpText('Close') then
begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,True);
end;

WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;

Awkwardsaw

2011-07-21 21:48:46

all you need to do is alter hoverskill for the health, :p

KingKong

2011-07-21 21:50:20

From: Awkwardsaw
all you need to do is alter hoverskill for the health, :p


but you forgot to specify i as an integer which means it would't compile :P

Awkwardsaw

2011-07-21 21:53:04

From: KingKong
but you forgot to specify i as an integer which means it would't compile :P


I usually dont add it until I try to compile, lol

Huthaifah

2011-07-21 22:00:05

Lol, I am just watching you guys argue about things I don't even understand lol.:redface:

Flight

2011-07-21 22:16:38

From: Huthaifah
Lol, I am just watching you guys argue about things I don't even understand lol.:redface:


Because it's an include file, it won't compile. You must simply save the file, then open up a script that has the file included and compile the script instead.

And thanks, Awkwardsaw, I'll add that to the OP with credits to you. :p I knew there was a cleaner way of doing it, I just didn't know how.

Yago

2011-07-22 00:12:26

From: KingKong

{*******************************************************************************
function LevelUpEx : Boolean;
By: Flight
Description: Clicks Continue if you've leveled up, also clicks the given stat
*******************************************************************************}
function LevelUpEx : Boolean;
var
a, X, Y: Integer;
Skills: TStringArray;
begin

if (FindNPCChatText('gratu', Nothing) Or FindBlackChatMessage('just adva')) then
Result:= True;
if Result then
begin
ClickContinue(True, True);
Wait(RandomRange(50,110));

Skills := ['Attack', 'Defence', 'Strength', 'Constitution', 'Mining', 'Smithing',
'Woodcutting', 'Firemaking', 'Magic', 'Fletching', 'Hunting', 'Summoning',
'Fishing', 'Construction', 'Herblore', 'Agility', 'Thieving', 'Crafting',
'Ranged', 'Slayer', 'Farming', 'Prayer', 'Runecrafting', 'Cooking'];
for a:= 0 to High(Skills) do
if IsChatBoxTextBetween(Skills[a], clMessage, 1, 8) then
if IsChatBoxTextBetween('Constitution', clMessage, 1, 8) then
HoverSkill('HitPoints', True)
else
HoverSkill(Skills[a], True);

MMouse(450,50,10,10);
Wait(RandomRange(50,110));
if IsUpText('Close') then
begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,True);
end;

WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;


Heres what I got…


{*******************************************************************************
function LevelUpEx : Boolean;
By: Flight
Description: Clicks Continue if you've leveled up, also clicks the given stat
*******************************************************************************}
function LevelUpEx : Boolean;
var
a: Integer;
Skills: TStringArray;
begin
Result:= FindNPCChatText('gratu', Nothing) Or FindBlackChatMessage('just adva') ;
if Result then
begin
ClickContinue(True, True);
Wait(RandomRange(50,110));

Skills := ['Attack', 'Defence', 'Strength', 'Constitution', 'Mining', 'Smithing',
'Woodcutting', 'Firemaking', 'Magic', 'Fletching', 'Hunting', 'Summoning',
'Fishing', 'Construction', 'Herblore', 'Agility', 'Thieving', 'Crafting',
'Ranged', 'Slayer', 'Farming', 'Prayer', 'Runecrafting', 'Cooking'];
for a:= 0 to High(Skills) do
if IsChatBoxTextBetween(Skills[a], clMessage, 1, 8) then
if IsChatBoxTextBetween('Constitution', clMessage, 1, 8) then
HoverSkill('HitPoints', True)
else
HoverSkill(Skills[a], True);

MMouse(450,50,10,10);
Wait(RandomRange(50,110));
if IsUpText('Close') then
ClickMouse2(true);

WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;

Saved you like ~3 lines and 2 variables :)

Coh3n

2011-07-22 00:48:25

HoverSkill shouldn't have a 5-14 second wait…

Also, you can use the skill constants rather than a string array:

{*******************************************************************************
function LevelUpEx : Boolean;
By: Flight
Description: Clicks Continue if you've leveled up, also clicks the given stat
*******************************************************************************}
function LevelUpEx : Boolean;
var
a, X, Y: Integer;
begin
if (FindNPCChatText('gratu', Nothing) or FindBlackChatMessage('just adva')) then
begin
ClickContinue(True, True);
Wait(RandomRange(50,110));

for a := 0 to (SKILL_COUNT - 1) do
if IsChatBoxTextBetween('just adva', clMessage, 1, 8) then
if IsChatBoxTextBetween('Constitution', clMessage, 1, 8) then
HoverSkill(SKILL_HP, True)
else
HoverSkill(a, True);

// here you should do a waitColor
MMouse(450,50,10,10);
Wait(RandomRange(50,110));
if IsUpText('Close') then // I recommend using waitUptext
begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,True);
end;

WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;
I think it should also have parameters (contClick and clickSkill) then we can use this for LevelUp as well.

Brandon

2011-07-22 00:53:53

From: Huthaifah
It's not a response, you use quick chat so the people around you know that your muted so they won't talk, and even if they did talk, it would be about the skill that your training, and you could add a function that searches in the quick chat thingy majigger, saying My Ranged level is 213445. You don't speak, the quick chat does the speaking.



Bahaha that won't work why? Because u'd have to determine if the person is talking to you or another person.. just searching for words on the screen will fail because it will respond to someone else talking to a friend..

Huthaifah

2011-07-22 00:56:28

No, if your nick turns up into the chat box.

TomTuff

2011-07-22 01:20:20

Errr…. LevelUp(True);

Edit: nevermind >.>

Edit2: Ahhh HoverSkill(Time, True) is what I was thinking of!

Coh3n

2011-12-09 20:08:28

I'd like to get this into SRL5, so if someone else could test these out that would be great. :) Want to make sure I didn't forget anything. Keep in mind that there will be a pretty long wait after it clicks the skill (this is an issue in HoverSkill and is fixed in the next version of SRL).

function LevelUpEx(ClickCont, ClickSkill: Boolean): Boolean;
var
i: Integer;
Skills: TStringArray;
begin
if (FindNPCChatText('gratu', Nothing) or FindBlackChatMessage('just adva')) then
begin
ClickContinue(ClickCont, True);

if (ClickSkill) then
begin
Wait(RandomRange(50, 110));

Skills := [
'Attack', 'Defence', 'Strength', 'Constitution', 'Mining', 'Smithing',
'Woodcutting', 'Firemaking', 'Magic', 'Fletching', 'Hunting', 'Summoning',
'Fishing', 'Construction', 'Herblore', 'Agility', 'Thieving', 'Crafting',
'Ranged', 'Slayer', 'Farming', 'Prayer', 'Runecrafting', 'Cooking',
'Dungeoneering'
];

for i := 0 to High(Skills) do
if IsChatBoxTextBetween(Skills[i], clMessage, 1, 8) then
if IsChatBoxTextBetween('Constitution', clMessage, 1, 8) then
HoverSkill('HitPoints', True)
else
HoverSkill(Skills[i], True);
end;

Result := True;
WriteLn(Players[CurrentPlayer].Name + ' leveled up!');
end;
end;

function LevelUp: Boolean;
begin
Result := LevelUpEx(True, False);
end;
E: I've added this to SRL5.