From: Blade bro4
[ATTACH]25064[/ATTACH]
Here's my progress at the moment. Pretty satisfied with how far I've come, coveting that best newcomer rank:P
It's not perfect, I'm having some issues at the moment and i'll get back to work on it tomorrow. Really appreciate all of the help.
I'm going to write my comments here as I go through, then I'll fix the comment in my copy, and then I'll post the "fixed" code:
- I notice you are indenting 2 tabs over in your first two procedures. 2 Spaces (or one tab) is all that's required. You seem to have it fixed in the rest of them though.
- ClickStone: You have an "end else" statement and then a few lines after that. You need to say "end else" and then have everything inside of a "begin/end" statement in order for everything to be performed. Simba by default only counts the line immediately below the "else" so if you have lines after that they'll be done regardless of what the else statement says. For example here you have "if findcolor then blah blah else writeln('didnt find stone'), logout, terminate script" The script will go "if I find the color, then click. If I don't find the color, writeln that I didnt. Then (regardless of the color finding) logout and terminate". If that didn't make sense, just refer to the correction I put below.
- ClickTree and ClickBars: The only problem I see here is the same as the ClickStone part.
- ClickSlope: You have the same "end else" problem as before, and I think this one confused you more. You have an additional begin/end statement that isn't actually needed. I think it's because you weren't sure how the "else" part worked entirely. It's hard to explain, so it's best to just look at the code I used to fix it. Basically the begin/end goes for the things you want "else" to do, and the rest of the stuff can just go after the "end" and it will be called regardless of the "else".
- ClickRope: The only problem I see here is the same as the ClickStone part.
- ClickDown: Here you've got the same thing as ClickSlope.
- Main loop: Perfect here, there's nothing wrong with what you've got.
So here's the fixed code:
program ApeAgility; //Begin two tiles east from stepping-stone (all grass tile)
procedure Logout;
var
x, y : integer;
begin
movemouse(754, 11);
wait(250);
ClickMouse(x, y, 1);
wait(500);
movemouse(643, 403);
wait(250);
ClickMouse(x, y, 1);
wait(500);
end;
procedure CompassNorth;
var
x, y : integer;
begin
movemouse(542, 22);
wait(250);
ClickMouse(x, y, 1);
wait(500);
end;
procedure ClickStone;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 2056815, 175, 171, 195, 190, 2) then
begin
movemouse(x, y);
wait(250);
ClickMouse(x, y, 1);
wait(5000);
end else
begin
writeln('didnt find the stone');
wait(1000);
Logout;
TerminateScript;
end;
end;
procedure ClickTree;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 5547729, 138, 138, 171, 165, 10) then
begin
//writeln('found tree!');
movemouse(x, y);
wait(250+random(200));
ClickMouse(x, y, 1);
wait(4000+random(500));
end else
begin
writeln('didnt find the tree');
wait(1000);
//Logout;
//TerminateScript;
end;
end;
procedure ClickBars;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 6265273, 258, 164, 269, 170, 5) then
begin
movemouse(x, y);
wait(250+random(200));
ClickMouse(x, y, 1);
wait(15000+random(500));
end else
begin
writeln('didnt find the bars');
wait(1000);
Logout;
TerminateScript;
end;
end;
procedure ClickSlope;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 2056044, 153, 113, 228, 202, 5) then
begin
movemouse(x, y);
wait(250+random(200));
ClickMouse(x, y, 1);
wait(3500+random(500));
end else
begin
writeln('didnt find the slope');
wait(1000);
Logout;
TerminateScript;
end;
movemouse(661, 132); //minimap
wait(250+random(200));
clickmouse(661, 132, 1);
wait(6000+random(500));
end;
procedure ClickRope;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 4886967, 310, 69, 321, 78, 5) then
begin
movemouse(x, y);
wait(250+random(200));
ClickMouse(x, y, 1);
wait(4000+random(500));
end else
begin
writeln('didnt find the rope');
wait(1000);
Logout;
TerminateScript;
end;
end;
procedure ClickDown;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 4292770, 298, 43, 322, 57, 5) then
begin
movemouse(x, y);
wait(250+random(200));
ClickMouse(x, y, 1);
wait(2000+random(500));
end else
begin
writeln('didnt find the downtree');
wait(1000);
Logout;
TerminateScript;
end;
movemouse(572, 115); //minimaptostart
wait(250+random(200));
clickmouse(572, 115, 1);
wait(8000+random(500));
end;
begin
repeat
CompassNorth;
ClickStone;
ClickTree;
ClickBars;
ClickSlope;
ClickRope;
ClickDown;
until(false)
end.
So I'll be honest with you, and I expect you know this as well. This script is relatively simple because it's made for a private server. The real fun comes when you try to script for RS3 (or OSRS, whichever you prefer) because there are a lot more anti-bot systems in place. The code you've used here, clickmouse and movemouse, is much more "bannable" than the SRL functions for mouse moving and clicking.
If you're interested in getting that sweet trophy, you'll need to show that you can use SRL to make some scripts. Obviously I can't guarantee anything because I have no power towards who gets what kind of trophies, but it's how I've seen other people get it.
Now that you know the basics of how Simba works and interacts with RS, you can read through a couple tutorials and make your first RS3 or OSRS scripts. There are two versions of SRL, one for RS3 and one for OSRS, so the tutorial I would recommend depends on which one you would prefer. If you're going the RS3 route I would suggest
this tutorial first and then
this tutorial second. If you're planning on OSRS, I would ask someone who knows a bit more about it, I don't use OSRS. I really don't know what the best tutorials are, and there are a few funky things going on with people updating new includes and stuff.
I'm glad that you're having fun so far with the learning progress. Keep that mindset and don't let frustrating things get you down, it happens to all of us. Feel free to keep posting here for other help, or to PM me if that works best for you. As always, if I explained something and it doesn't really make sense, feel free to ask.