View Full Version : Help with my PC bot
fearlesskiller
01-20-2012, 08:57 PM
Hold on , ill post it soon, im using ACA v2 to make my attack way better
Edit1: never mind doesnt work properly for pest controls all colors look the same and when it doesnt find the color it just random click. Though with it i got the colors i needed and that only those monsters use so its perfect.
Edit2: Got an other problem, since the dragon scimi is red and the minions r red too , it keeps clicking on my scimitar... maybe i could work this out with uptext
Edit3: Nvm uptext wont work with that, could dtm work with this one ?
program new;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$i sps/sps.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';// Login name
Players[0].Pass := '';// Password
Players[0].Nick := '';// 3-4 letters of your name (Not the first one)
Players[0].Active:=True;
Players[0].Pin := '';// Bank pin
Players[0].BoxRewards := ['Xp'];// Random event reward
Smart_Server := 53;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end;
Function FindObjectFX(Colors: TIntegerArray; Uptext: TStringArray; X1, Y1, X2, Y2, Width, Height, tol: integer; Click: Boolean): Boolean;
var
X, Y, I: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
SetLength(TPA, Length(Colors));
For I:= 0 To High(Colors) do
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[i], X1, Y1, X2, Y2, tol);
ATPA:= TPAToATPAEx(TPA, Width, Height);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if(Length(ATPA) = 0) then
Exit;
MiddleTPAEx(ATPA[0], X, Y);
if Click then
MMouse(x, y, 5, 5);
Wait(randomrange(200, 500));
If(IsUpTextMultiCustom(UpText)) then
begin
if Click then
begin
ClickMouse2(False);
wait(500);
if ChooseOptionMulti(UpText) then
begin
Result := True;
Exit;
end;
end else
Result := True
end else
Result:= (((X <> 0) and (Y <> 0)) and (Click = False)) ;
end;
Function GetInTheBoat: Boolean;
var
Info: String;
x, y:integer;
begin
Repeat
FindNormalRandoms;
if FindObj(x, y, 'ross', 3958665, 5) then
Info:= GetTextAtExWrap(9, 20, 147, 91, 0, 5, 2, 13421772, 3, SmallChars);
Result:= (ExecRegExpr('ext', Info) or ExecRegExpr('eparture', Info));
if Result then
Mouse(x, y, 2, 2, true);
wait (500+random(25));
Mouse(x, y, 3, 3, true);
break;
Until(Result);
writeln('In Boat');
end;
procedure GetToNpc;
Var
myPath:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['6_15']);
while ((GetTextAtExWrap(6, 24, 75, 58, 0, 5, 2, 63488, 10, UpChars) <> '2000') or (ClickToContinue = False)) do
begin
wait(1);
if ((GetTextAtExWrap(6, 24, 75, 58, 0, 5, 2, 63488, 10, UpChars) = '2000') or (ClickToContinue = true)) then
break;
end;
writeln('In Pest Control');
myPath := [Point(2466, 6244), Point(2466, 6256), Point(2464, 6266),
Point(2462, 6277), Point(2461, 6289), Point(2463, 6298), Point(2462, 6312)];
SPS_WalkPath(myPath);
wait(3000+random(100));
MakeCompass('S')
SetAngle(SRL_ANGLE_HIGH)
end;
procedure FindAndClickColors;
var
colors: TIntegerArray;
b ,x, y: integer;
begin
colors := [1056265, 1195058, 924168, 1316673, 4083823, 1185084, 2898977]; // all colors you want
for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], MSX1, MSY1, MSX2, MSY2, 3)) then
begin
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
if isUpTextMultiCustom(['', '', '']) then
Break;
end;
end;
end;
begin
ClearDebug;
DeclarePlayers;
LoginPlayer;
GetInTheBoat;
GetToNpc;
FindAndClickColors;
end.
fearlesskiller
01-20-2012, 09:01 PM
Because my bot when it get to procedure findandclickcolors it just stops and does not attack any monsters
fearlesskiller
01-21-2012, 01:51 AM
Anybody able to help?
eXoTiK
01-21-2012, 02:06 AM
Your procedure is flawed, logic error. You have it search until MMY2. That is almost certainly one of the downfalls of your script. Also, you should clean up your standards a bit with indentation. You also missed a semicolon after the SetAngle method. And you have some improper capitalizations throughout the procedure.
Fixed:
procedure FindAndClickColors;
var
colors: TIntegerArray;
b, x, y: Integer;
begin
SetAngle(SRL_ANGLE_HIGH);
colors := [2770571, 1327672, 2899602, 1386252] ;
for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], MSX1, MSY1, MSX2, MSY2, 3)) then
begin
Mouse(x, y, 2, 2, True);
wait(3000 + Random(75));
break;
end;
end;
end;
fearlesskiller
01-21-2012, 02:47 AM
alright thanks , sorry for that normally i dont do that kind of error. And about capitalizations, im just not sure because some guides uses them after some stuff and some other doesnt so i was confused. Still like you're help. Does it loop ?
fearlesskiller
01-21-2012, 02:48 AM
and i copy pasted some part of code u did (fixed one)
fearlesskiller
01-21-2012, 02:54 AM
Still finds nothing and just skip the findcolors...
eXoTiK
01-21-2012, 03:36 AM
Try a structure as so:
if (FindObjTPAMulti(x, y [color1, color2, color3, etc], 1, -1, 10, 10, 1, ['ttack'])) then
begin
...
end;
fearlesskiller
01-21-2012, 04:45 AM
Keep saying "[Error] (70:30): Semicolon (';') expected at line 69" but i check them all and its all fine
fearlesskiller
01-21-2012, 03:07 PM
anyone?
Brandon
01-21-2012, 03:19 PM
Talk about double posting -_____- If you really wrote that code, you'd know why it doesn't work when you debug it.. debugging is important.. So is understanding your own code.. You need a loop that will keep searching for monsters until it finds the colours of the plank or water..
procedure FindAndClickColors;
var
colors: TIntegerArray;
b ,x, y: integer;
begin
SetAngle(SRL_ANGLE_HIGH)
colors := [2770571, 1327672, 2899602, 1386252] ; // all colors you want
for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], MSX1, MSY1, MSX2, MSY2, 3)) then
begin
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
if isUpTextMulti(['', '', '']) then
Break; //in ur original code u just broke out no matter what -__-
end;
end;
end;
procedure MoveAngle;
begin
MakeCompass('S');
wait(100+random(116));
SetAngle(SRL_ANGLE_LOW);
end;
procedure GetInTheBoat;
var x, y:integer;
begin
FindNormalRandoms;
if FindObj(x, y, 'ross', 3958665, 5) then
begin
Mouse(x, y, 2, 2, true);
wait (500+random(25));
ChooseOption('ross');
Writeln('Entered the boat');
repeat
wait(30+random(75));
until(FindColorTolerance(x, y, 4029835, MSX1, MSY1, MSX2, MSY2, 3));
Writeln('Succesfully started botting');
Mouse(x, y, 2, 2, True)
wait(3000+random(55));
end;
end;
fearlesskiller
01-21-2012, 03:44 PM
What does break anyway i didnt heard about it. I wrote everything but the find color thing. and this is where i get error. And i dont know how to make loops yet...
fearlesskiller
01-21-2012, 04:31 PM
I still get error. no matter what
Brandon
01-21-2012, 04:36 PM
break does exactly what it's name suggests.. it breaks out of a loop aka that "For Loop" above. Also if I were to help you I tend to write complex code that works and then simplify it later.. Not understanding loops will make it pointless for me to write anymore code. You need to read the tutorials or else what would be the point of me or anyone else writing anything? How do you plan on writing a Pest Control bot without loops or understanding the basics of colour?
AND you only need to post ONCE! If you need to add something else to the thread.. just edit the last post you made..
fearlesskiller
01-21-2012, 04:37 PM
Isnt it
isUpTextMultiCustom
fearlesskiller
01-21-2012, 04:38 PM
Yeah well i will search for some color tutorials, breaks and loops. Im sorry if im wasting ur time
Brandon
01-21-2012, 04:39 PM
Isnt it
That checks if it finds the text in the upper left corner of the screen.. go in game and hover over anything, you will notice text in the upper left corner of ur screen.. That can be used to identify if we found the right item..
It uses an array of strings. IsUptextMulti(['bank', 'ank', 'anker', 'banker', 'item', 'itemname', 'partial item name']);
etc.. Also your not wasting my time.. I choose to answer questions on my own.. Just suggesting that you read a tutorial before u tackle a pest control bot.
fearlesskiller
01-21-2012, 04:41 PM
Yeah i read many guides , but not on colors/break/loop :/
fearlesskiller
01-21-2012, 06:00 PM
I understand what are loops now, i just dont know how to make one in my bot.
begin
ClearDebug;
DeclarePlayers;
LoginPlayer;
GetInTheBoat;
GetToNpc;
FindAndClickColors;
end.
I want it to findandclickcolors until he sees the color in my getintheboat procedure
YoHoJo
01-22-2012, 03:27 AM
Help his guy some more/bump.
Brandon
01-22-2012, 03:30 AM
Help his guy some more/bump.
Haha :) we will but we need to see some code in-order to help on his problem. Like what he's tried so far. Then I'll go to PestControl and run it and see what it does then and only then can we help him further no?
fearlesskiller
01-22-2012, 03:35 AM
Haha :) we will but we need to see some code in-order to help on his problem. Like what he's tried so far. Then I'll go to PestControl and run it and see what it does then and only then can we help him further no?
Alright ill post it out. It does everything it needs , i just cant test atk on monsters cause the script end after searching for monsters (which needs loops) ill edit my thread now
Brandon
01-22-2012, 04:31 AM
Alright ill post it out. It does everything it needs , i just cant test atk on monsters cause the script end after searching for monsters (which needs loops) ill edit my thread now
The code below will loop perfectly.. I've used a custom text finding in combo with a RegExpression to find whether we are in game or in the boat or not.. All you have to do is write a function/procedure that will find and fight monsters.. and of course use your own function for finding the gangplank.. mine didn't work so well because I got lazy and want you to at least learn to do something on your own. I would use AutoColourAid for that gangplank or your old function which worked but the colours changed often so yeah.. Other than that, nice script.
Ignore the Find Object FX.. it's a function from my other scripts which I decided to use to find the gangplank quickly enough.. I suggest you use your own or whatever it was that you had before.. I used a repeat loop to constantly try and find the gangplank and if it successfully crosses it, it will find the text at the top left corner that says "Next Departure".. Once that is found, it will wait until it finds the text for the void knight's health at the top left.. once found, it will run to the middle of the arena and finally it will shut down because there is no fighting procedure.
You can write a fighting procedure I'm sure and after you write it, just repeat the text finding function to find whether the game has ended or not.. whala pest control script is complete.
program new;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$i sps/sps.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';// Login name
Players[0].Pass := '';// Password
Players[0].Nick := '';// 3-4 letters of your name (Not the first one)
Players[0].Active:=True;
Players[0].Pin := '';// Bank pin
Players[0].BoxRewards := ['Xp'];// Random event reward
Smart_Server := 72;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end;
Function FindObjectFX(Colors: TIntegerArray; Uptext: TStringArray; X1, Y1, X2, Y2, Width, Height, tol: integer; Click: Boolean): Boolean;
var
X, Y, I: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
SetLength(TPA, Length(Colors));
For I:= 0 To High(Colors) do
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[i], X1, Y1, X2, Y2, tol); //Find colours starting from the middle outwards..
ATPA:= TPAToATPAEx(TPA, Width, Height); //Group TPA into cirles by Distance..
SortATPAFrom(ATPA, Point(MSCX, MSCY)); //Sort the colours from the closest to the center..
if(Length(ATPA) = 0) then
Exit;
MiddleTPAEx(ATPA[0], X, Y); //In that 2D Array, Pick out the closest to the middle a.k.a. the first one..
if Click then
MMouse(x, y, 5, 5); //Move the mouse to the colours found..
Wait(randomrange(200, 500)); //Wait for the uptext to show..
If(IsUpTextMultiCustom(UpText)) then
begin
if Click then
begin
ClickMouse2(False); //If it finds it, click the object/item..
wait(500);
if ChooseOptionMulti(UpText) then
begin
Result := True; //If it clicks the object, return true..
Exit;
end;
end else
Result := True
end else
Result:= (((X <> 0) and (Y <> 0)) and (Click = False)) ;
end;
Function GetInTheBoat: Boolean;
var
Info: String;
begin
SetAngle(SRL_ANGLE_HIGH);
Repeat
FindNormalRandoms;
FindObjectFX([3760771, 3958665], ['ross', 'angplank'], MSX1, MSY1, MSX2, MSY2, 10, 10, 1, true);
Info:= GetTextAtExWrap(9, 20, 147, 91, 0, 5, 2, 13421772, 3, SmallChars);
Result:= (ExecRegExpr('ext', Info) or ExecRegExpr('eparture', Info)); //Executes a RegExpression on the string to see if it matches.
if Result then
break; //if we break out of the loop then we are in the boat else keep trying to enter.
Until(Result);
writeln('In Boat');
end;
procedure GetToNpc;
Var
myPath:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['6_15']);
while ((GetTextAtExWrap(6, 24, 75, 58, 0, 5, 2, 63488, 10, UpChars) <> '2000') or (ClickToContinue = False)) do //checks for the green text at the top left..
begin //aka the void knight's health..
wait(1);
if ((GetTextAtExWrap(6, 24, 75, 58, 0, 5, 2, 63488, 10, UpChars) = '2000') or (ClickToContinue = true)) then
break; //Breaks out of the loop if the text is found.. aka void knight's health.. or click to continue is found..
end;
writeln('In Pest Control');
myPath := [Point(2466, 6244), Point(2466, 6256), Point(2464, 6266),
Point(2462, 6277), Point(2461, 6289), Point(2463, 6298), Point(2462, 6312)];
SPS_WalkPath(myPath);
end;
procedure FindAndClickColors;
var
colors: TIntegerArray;
b ,x, y: integer;
begin
colors := [1327672, 2902160, 792070, 3935042] ; // all colors you want
for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], MSX1, MSY1, MSX2, MSY2, 3)) then
begin
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
if isUpTextMultiCustom(['', '', '']) then
Break;
end;
end;
end;
begin
ClearDebug;
DeclarePlayers;
LoginPlayer;
GetInTheBoat;
GetToNpc;
FindAndClickColors;
end.
http://i.imgur.com/smz8x.pnghttp://i.imgur.com/fDiHq.png The two images used for testing the GetTextAtExWrap.
fearlesskiller
01-22-2012, 02:15 PM
I see i see, but if i use novice boat i would need to get my own images? Isnt the findcolor procedure to attack monsters? because it should be.
Brandon
01-22-2012, 02:30 PM
I see i see, but if i use novice boat i would need to get my own images? Isnt the findcolor procedure to attack monsters? because it should be.
I did not test the attacking. Sometimes i found my character in a fight so I'm guessing it does attack but its just not efficient enough. does not matter if ur in the veterans boat or the novice.. all the gang planks look the same AND all the text is the same..
If u have the text in the novice boat that says "Next Departure In"... then the script above will work. The void knight's health always shows at the top left as well so it will still work.
fearlesskiller
01-22-2012, 02:45 PM
Yeah i added some stuff to the getintheboat, and it works perfectly it waits on right time. Only thing i would need to do is a attack monster but im not very sure how it would work, because i would need to do if there is no monster fighting, get in the boat, or something like if findobj (gangplank) then stop fighting and do get in the boat procedure
Brandon
01-22-2012, 02:49 PM
Yeah i added some stuff to the getintheboat, and it works perfectly it waits on right time. Only thing i would need to do is a attack monster but im not very sure how it would work, because i would need to do if there is no monster fighting, get in the boat, or something like if findobj (gangplank) then stop fighting and do get in the boat procedure
Did not understand any of the fighting ideas..
For fighting, I would do something like:
While (Not InFight) do
begin
//Find and attack Monsters.
//Check if clicktocontinue is on screen or NPC text..
//Check if VoidKnight's upper - left symbol exists OR void knight health red and green exists..
//Check our position on the map.
end;
While InFight do
begin
//wait a set amount of time..
//Check if clicktocontinue is on screen or NPC text..
//Check if VoidKnight's upper - left symbol exists OR void knight health red and green exists..
//Check our position on the map.
//Check if we're in the fight still or if the monster is dead..
end;
fearlesskiller
01-22-2012, 03:07 PM
Yeah sorry english isnt my first language so sometimes people dont rly understand. Some of the code i need to put i dont know what it is. Like check our position on the map
fearlesskiller
01-22-2012, 05:15 PM
What command would be the best to find/attack monsters?
Brandon
01-22-2012, 05:19 PM
What command would be the best to find/attack monsters?
You can use InFight together with Hitsplatt finding.. for your position on the map, u can use tpa walking, sps, OR my preferred option: Text finding.. As when your doing a pc bot, you don't have to worry about your position much.. just need to know when the game begins, when in game, when not in game..
fearlesskiller
01-22-2012, 05:34 PM
Hitsplatt finding? Would it find only mine. Yeah ill try something out and i hope it will work. Looks hard for me :/
Brandon
01-22-2012, 05:41 PM
Hitsplatt finding? Would it find only mine. Yeah ill try something out and i hope it will work. Looks hard for me :/
Its easy.. just take screenshots everytime your character does a hit.. and take screenshots everytime your character hits 0..
When you hit, your hitsplat is a lighter red than when other ppl hit (maroon).. When you miss, your hitsplat is a light blue colour.. when others miss, nothing shows..
This is one of the most effective way to find if your currently hitting/attacking a monster. In combination with InFight function, this will be super effective.
fearlesskiller
01-22-2012, 07:26 PM
Alright thanks, ill search for a InFight function guide and read it on !
fearlesskiller
01-22-2012, 09:41 PM
Didnt find any , post link here if u do
fearlesskiller
01-22-2012, 11:24 PM
I tried making a loop with my old findandclickcolors but it didnt worked out, can you help me ?
Brandon
01-22-2012, 11:45 PM
I continue this and I'd have written the entire script myself.. U need to post what u have done ontop of the code i've given u already.
fearlesskiller
01-23-2012, 12:34 AM
Hold on , ill post it soon, im using ACA v2 to make my attack way better
Edit: never mind doesnt work properly for pest controls all colors look the same and when it doesnt find the color it just random click. Though with it i got the colors i needed and that only those monsters use so its perfect.
Got an other problem, since the dragon scimi is red and the minions r red too , it keeps clicking on my scimitar... maybe i could work this out with uptext
program new;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$i sps/sps.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';// Login name
Players[0].Pass := '';// Password
Players[0].Nick := '';// 3-4 letters of your name (Not the first one)
Players[0].Active:=True;
Players[0].Pin := '';// Bank pin
Players[0].BoxRewards := ['Xp'];// Random event reward
Smart_Server := 53;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end;
Function FindObjectFX(Colors: TIntegerArray; Uptext: TStringArray; X1, Y1, X2, Y2, Width, Height, tol: integer; Click: Boolean): Boolean;
var
X, Y, I: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
SetLength(TPA, Length(Colors));
For I:= 0 To High(Colors) do
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[i], X1, Y1, X2, Y2, tol);
ATPA:= TPAToATPAEx(TPA, Width, Height);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if(Length(ATPA) = 0) then
Exit;
MiddleTPAEx(ATPA[0], X, Y);
if Click then
MMouse(x, y, 5, 5);
Wait(randomrange(200, 500));
If(IsUpTextMultiCustom(UpText)) then
begin
if Click then
begin
ClickMouse2(False);
wait(500);
if ChooseOptionMulti(UpText) then
begin
Result := True;
Exit;
end;
end else
Result := True
end else
Result:= (((X <> 0) and (Y <> 0)) and (Click = False)) ;
end;
Function GetInTheBoat: Boolean;
var
Info: String;
x, y:integer;
begin
Repeat
FindNormalRandoms;
if FindObj(x, y, 'ross', 3958665, 5) then
Info:= GetTextAtExWrap(9, 20, 147, 91, 0, 5, 2, 13421772, 3, SmallChars);
Result:= (ExecRegExpr('ext', Info) or ExecRegExpr('eparture', Info));
if Result then
Mouse(x, y, 2, 2, true);
wait (500+random(25));
Mouse(x, y, 3, 3, true);
break;
Until(Result);
writeln('In Boat');
end;
procedure GetToNpc;
Var
myPath:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['6_15']);
while ((GetTextAtExWrap(6, 24, 75, 58, 0, 5, 2, 63488, 10, UpChars) <> '2000') or (ClickToContinue = False)) do
begin
wait(1);
if ((GetTextAtExWrap(6, 24, 75, 58, 0, 5, 2, 63488, 10, UpChars) = '2000') or (ClickToContinue = true)) then
break;
end;
writeln('In Pest Control');
myPath := [Point(2466, 6244), Point(2466, 6256), Point(2464, 6266),
Point(2462, 6277), Point(2461, 6289), Point(2463, 6298), Point(2462, 6312)];
SPS_WalkPath(myPath);
wait(3000+random(100));
MakeCompass('S')
SetAngle(SRL_ANGLE_HIGH)
end;
procedure FindAndClickColors;
var
colors: TIntegerArray;
b ,x, y: integer;
begin
colors := [1056265, 1195058, 924168, 1316673, 4083823, 1185084, 2898977]; // all colors you want
for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], MSX1, MSY1, MSX2, MSY2, 3)) then
begin
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
if isUpTextMultiCustom(['', '', '']) then
Break;
end;
end;
end;
begin
ClearDebug;
DeclarePlayers;
LoginPlayer;
GetInTheBoat;
GetToNpc;
FindAndClickColors;
end.
fearlesskiller
01-23-2012, 10:19 PM
Nvm uptext wont work with that, could dtm work with this one ?
fearlesskiller
01-25-2012, 02:08 AM
Bump anyone
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.