PDA

View Full Version : Starting my first script



o0Matthius0o
07-24-2014, 10:12 PM
Hello everyone! Up til this point i have been a leecher. But its time to contribute. I have started learning java about 2 or 3 months ago and now i am learning to write scripts for simba. The project i am working on now is a log cutter. It will cut down regular trees and when the inventory is full it will cut them all into arrow shafts. It will do this until the specified amount is done.

I already have written some pseudo code for this and i made a flow chart on gliffy. I would like anyones assistance and opinions on my pseudo code and where to go next. Sorry for the formatting and any spelling errors. Just ask for clarification.


===============Start PseudoCode=================

start in tree area close to ge bank.
go to the nearest tree that isnt cut down. findTree
start cutting the tree. cutTree

if there are no trees to cut walk further west. --findTree

when you reach the location,

if there are no trees to cut in 15 secs.
go back to the start area.

wait until the tree is cut down.
when the tree is cut down check the backpack. checkInventory
if backpack is full fletch into arrow shafts. fletchLogs
keep fletching til backpack only has arrow shafts.
if backpack is not full keep chopping trees.
repeat from beginning.


Globals: Treefound, treeCut


-----------------------------------------------------------------------------------

login
if not logged in, repeat login.
check area map.
(findTree)[
repeat
check tree colors,
if none found
run east til certain point.
check tree colors again,
if none found in 15secs
run back to start point,
until (tree found)
]

do cutTree until treeCut = true or inventory is full (27)--
(cutTree)[
repeat right click the tree and select chop tree.
wait between 9 - 12 secs for the tree to finish
if tree not finish chopping after time
click again.
if tree is cut, then treeCut = true. and numlogscut +1
unitl treeCut = true.

====================END CODE==================================

Press Play
07-27-2014, 11:47 PM
Good work and good luck on learning to script! Pseudocode is looking good. Next step would be to start writing functions in Simba and testing each one. Example, start with:
program new;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}

begin
clearDebug();
setupSRL();
end.
Then add a function to test:
program new;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}

function findTree(): boolean;
begin
// Code for find the tree goes here
end;

begin
clearDebug();
setupSRL();

if findTree() then
writeln('Tree found!');
end.
Then you can piece the functions together to form a full script.

Just a tip, you can use:

Code tags for your pseudocode,
Code inside here
Simba tags when you want to post simba code, Simba code inside here
Report tags for debug text, Text inside here

theorange
07-29-2014, 04:59 PM
Excellent start, definitely listen to what Press Play stated.

When I develop programs, I tend to take one of two approaches, depending on how I feel.

Approach 1:
Top down: Start creating the code from the top down, and then breaking it up in the individtual functions that you will need, and the functions thsoe functions will need, Then I start on approach 2.

Approach 2:
Bottom up: You want to make a tree cutter/fletcher/banker, start small, don't bite off too much!
First start with making a program that can identify a tree.
Then start by making it right click the tree if it identifies it, then search for 'hop tree'.
Once you can do that, try to make it keep searching for trees until the bag is full.
Once the bag is full, have it click a slot in the inventory, and fletch them.
Then wait the time necessary to fletch + some leeway in case of lag.

And now do it all over gain!


Once you have that, you can start making things like a progress report, being able to log in, being able to switch worlds, randomization , banking, user input, etc.

Most important thing in programming: Don't code when angry/frustrated. If something is eluding you, don't feel stupid, post on the forum/search stackoverflow, and then take a break! Then come back to it with a fresh mind. It is a great life skill to know when you can be productive at something and when doing extra won't help and possibly hurt.


You're on the right track, i'm exicted to see your code updates! Feel free to update the thread as you progress from each little section, or do it however you see fit. (If you do it piece by piece you'll be able to get good feedback as you progress)

o0Matthius0o
07-30-2014, 08:45 AM
are there any tutorials updates for srl-6? one that includes the rafiki game manager?

theorange
07-30-2014, 12:00 PM
are there any tutorials updates for srl-6? one that includes the rafiki game manager?

Voila. Make sure you installed it right, then go to Mayor's simple guide, then the All inclusive guide, then a few other guides, then you're good to go! If you're fast, you'll be up and running in a few days once you run through documentation. If you are a complete newbie to programming, i'd recommend doing a javascript/python course on:
http://www.codecademy.com/en/tracks/python
http://www.codecademy.com/en/tracks/javascript

You'll be using simba/pascal for runescape, but the lessons on Codecademy will translate well, thinking like a computer scientist.
Another good website:
http://interactivepython.org/courselib/static/thinkcspy/index.html

From there, start making small programs like click and identify trees, then make a walking program, then make a program to chop trees, then make one that loops and chops trees and drops logs endlessly, then make it do it a number of time set by the user, then make ti walk to the bank and deposit, then add login screen, then add efficient and other nice things, and bam! you're a runescape scripter.

Installation Guide:
https://villavu.com/forum/showthread.php?t=47714

Attached are the Specs you need to update the RS screen to in order for the color bot to detect the screen.
https://villavu.com/forum/showthread.php?t=107365
--------------------------------------------------------------------
1. Beginner Guide:
https://villavu.com/forum/showthread.php?t=109161

2. Beginner Guide Part 2
https://villavu.com/forum/showthread.php?t=107757

3. Additional Walk Through
https://villavu.com/forum/showthread.php?t=106337

FAQ Simba:
https://villavu.com/forum/showthread.php?p=851555

Documentation:
http://docs.villavu.com/simba/

SRL Positioning System:
https://villavu.com/forum/forumdisplay.php?f=457

Code Snippets/Samples:
https://villavu.com/forum/forumdisplay.php?f=459

Common Scripting Errors:
https://villavu.com/forum/showthread.php?t=82793

Intermediate Guides:
https://villavu.com/forum/forumdisplay.php?f=649

Programming help:
Stackoverflow.

Large Guide Directory:
https://villavu.com/forum/showthread.php?t=101761

o0Matthius0o
08-08-2014, 08:47 AM
OK! i have an update. So you can run this code for yourself. The movements when it searches for a tree is a bit botlike. But it is something! Very very rough start. So be gentle.

to make it run: start the script so it will open a smart window, then go to the trees that are in varrock between the wall and the house(pic included), then chop 1 log and fletch it, after that it is good to go! It only will run for one load though.

Let me know what you think! i did this in one night. (not bragging, just saying so the judgement will be softer lol)
23775

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure antiban();
var
afkPlayer, playWithMouse, randNum, method : integer;
boxOne, boxTwo: TBox;
begin
boxOne := intToBox(35, 336, 269, 501);
boxTwo := intToBox(421, 55, 706, 227);
randNum := randomRange(1, 2);
method := randomRange(1, 2);

if method = 1 then
begin
writeLn('waiting for a sec to keep em off our trail');
wait(randomRange(1000, 5000))
end;

if method = 2 then
begin
writeLn('Screwin with the mouse');
if randNum = 1 then
begin
mouseBox(boxOne, MOUSE_MOVE);
end;
if randNum = 2 then
begin
mouseBox(boxTwo, Mouse_Move);
end;
end;

end;


procedure findTree();
var
x, y, rando, antiBanNum: integer;
begin
antiBanNum := randomRange(1, 5);
rando := randomRange(1, 5);
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
wait(randomRange(1000, 3000));
begin
if mainscreen.findObject(x, y, 3034199, 9, ['ree'], MOUSE_RIGHT) then
begin
writeLn('Tree Found!');
chooseOption.select(['hop down']);
tabBackPack.waitForShift(10000);
if rando = antiBanNum then
begin
writeLn('Its AntiBan Time!!!');
antiBan();
end;
end;
end
end;

procedure fletchLog();
var
x, y: integer;
fletchButton: TBox;
begin
tabBackPack.mouseSlot(2, MOUSE_LEFT);
wait(2000);
fletchButton := intToBox(287, 327, 509, 353);
mouseBox(fletchButton, MOUSE_LEFT);
wait(5000);


end;

function checkPack(): integer;
var
packCount: integer;
packFull: boolean;
begin

end;
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
begin
clearDebug();
setupSRL();
wait(3000);
repeat
findTree();

until tabBackPack.isFull();
fletchLog();
end.

o0Matthius0o
08-08-2014, 08:49 AM
Can you guys give me any advice on how to do random mouse movements instead of doing all the darting around looking for the tree colors? I know that looks super fishy to RS.

lanadekat
08-08-2014, 09:07 AM
Can you guys give me any advice on how to do random mouse movements instead of doing all the darting around looking for the tree colors? I know that looks super fishy to RS.

Get a better color using ACA.
Make sure it only detects tree's and nothing else, Then it stops hovering over everything before clicking the tree.
btw: in the picture is that a "test" account? we can see the username.

o0Matthius0o
08-08-2014, 09:09 AM
i did use the ACA. That was the color it gave me. But i will try getting some better colors tomorrow. Thanks for the advice!

o0Matthius0o
08-08-2014, 09:13 AM
yes it is lol. i use it for botting purposes. but im not attached to it. so if it goes out then i dont care.

edit: on second thought ill fix the image tomorrow.

The Mayor
08-08-2014, 10:35 AM
Trees are actually pretty hard to code in colour. The problem is only the trunk is clickable, and the trunk is the same colour as the stump. With your mainscreen.findObject you will most likely hover over the stumps of trees already cut.

To get around this you would have to use a custom TPA/ATPA function and because of this, it's probably really hard for a beginner. I wrote one and it worked like this:


Find the black base colour of the tree (the moss stuff).
Split that TPA to get individual trees
Look inside each of the TPA bounds for the light stump colour (the light circle)
If the light stump colour if found, then exclude that TPA from the ATPA


http://puu.sh/aGCUi/c7384a6024.png

o0Matthius0o
08-08-2014, 06:10 PM
Im a beginner to this language. But its data structures and usages are the same as java. So it should be do-able! Love the advice Mayor! When i get home from work tonight i will start work on that.

o0Matthius0o
08-11-2014, 01:37 AM
UPDATE!

I was having some trouble with the Tree Bot. And i have a need for a fighter bot right now. So that is what i am doing. This first script is just being tested at the stronghold of security, my final plan is to move it to the abyss out in the wilderness to fight fire giants or something and collect their drops.

For now here is what im playing around with. Lemme know what you think. As well as any suggestions. I would like to know how to use the actionbar so i can add that support into the script as well. Still going through the tutorial so i probably havent seen it yet if it is in there.

Oh and yes i am aware that this script will run forever. That is so i can watch and change things.

This is the start point.

23774

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure antiBan();
var
num1, num2, num3, method : integer;
boxOne, boxTwo, boxThree : TBox;

begin
boxOne := intToBox(35, 336, 269, 501); //The boxes on the screen that the mouse will
boxTwo := intToBox(421, 55, 706, 227); //randomly move to.
boxThree := intToBox(491, 461, 783, 589);
num1 := 1;
num2 := 2;
num3 := 3;
method := randomRange(1, 3); //chooses which antiban method will be run

if method = num1 then
begin
writeLn('Antiban Method 1');
mouseBox(boxOne, MOUSE_MOVE);
end;

if method = num2 then
begin
writeLn('Antiban Method 2');
mouseBox(boxTwo, MOUSE_MOVE);
end;

if method = num3 then
begin
writeLn('Antiban Method 3');
mouseBox(boxThree, MOUSE_MOVE);
end;

end;

procedure clickEnemy();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
findColorsSpiralTolerance(x, y, TPA, 3434850, mainScreen.getBounds(), 22, colorSetting(2, 0.07, 0.11));
if length (TPA) < 1 then //If there are no monsters found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ttack'], 500) then
begin
fastClick(MOUSE_LEFT); // attacks mob
smartImage.clear();
wait(randomRange(500, 800));
antiBan();
wait(randomRange(5000, 5800));
break;
end;

if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
begin
writeLn('Gate of War found');
break;
end;

end;

end;




begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
repeat
clickEnemy();
until tabBackPack.isFull();
end.

o0Matthius0o
08-11-2014, 01:51 AM
Can anyone help me out and let me know of a good antiban method. And do you think that this script, even though its in early development, would get banned? Aside from the fact that it doesnt take breaks.

Incurable
08-11-2014, 03:13 AM
I haven't yet started learning to script with Simba so I'm unable to help with your questions, but as a programmer, I would just like to point out that while you're learning to code, you also need to learn proper formatting and code standards. The code standards for Simba can be found here (https://villavu.com/forum/showthread.php?t=60288) (bookmark it for reference!).

Trust me, once you get into writing longer programs and scripts, you'll start pulling your hair out if you can't tell where one function starts and another ends. Clean code also helps with debugging, and helps other programmers to help you with any problems that you may have. Finally, make sure to comment your code! Again, not only does this help you to remember what does what, but it greatly reduces the amount of time it takes for another programmer to understand your program in order to help you! ;)

Good luck, and have fun!

PS: You still didn't update that image, so unless you want that account banned, I'd strongly suggest you black out the name. :p

The Spark
08-11-2014, 03:29 AM
PS: You still didn't update that image, so unless you want that account banned, I'd strongly suggest you black out the name. :p

Where does any image show anybodys name anywhere in this thread?

o0Matthius0o
08-11-2014, 03:48 AM
thanks for the advice! i changed the pic. The code should be alot more readable now

o0Matthius0o
08-11-2014, 03:50 AM
it did show my name sparky. i edited the pic

The Spark
08-11-2014, 04:31 AM
it did show my name sparky. i edited the pic

Oh ok, I guess I looked at it too late ^_^

o0Matthius0o
08-11-2014, 05:08 AM
anyone know how to get it to pick up the bones/ other items? having some trouble with that one.

Incurable
08-11-2014, 05:17 AM
Where does any image show anybodys name anywhere in this thread?

Not to sound like a dick, but clearly there was an image showing a name when I posted that. ;)

---

That code looks infinitely better now, get used to writing good clean code and your efficiency will triple. :D

bonsai
08-11-2014, 05:19 AM
bg5 posted a nice looting function (https://villavu.com/forum/showthread.php?t=76643)

The code isn't up to date but the ideas are free :)

The Spark
08-11-2014, 05:27 AM
Not to sound like a dick, but clearly there was an image showing a name when I posted that. ;)

---

That code looks infinitely better now, get used to writing good clean code and your efficiency will triple. :D

I looked for it like two minutes after he edited it xD

Incurable
08-11-2014, 05:50 AM
I looked for it like two minutes after he edited it xD

Fair enough, lol. :P

o0Matthius0o
08-11-2014, 08:55 AM
Alright. Last update for tonight.
Script works best fully zoomed out.

*Now sets the camera angle to highest position and North.
*Loots the bones dropped by the goblins.

Tomorrows updates -

*Waits until the backpack is full and buries the bones.
*Possibly some sort of breaking function so the script can be ran for longer.




program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure antiBan();
var
num1, num2, num3, method : integer;
boxOne, boxTwo, boxThree : TBox;

begin
boxOne := intToBox(35, 336, 269, 501); //The boxes on the screen that the mouse will
boxTwo := intToBox(421, 55, 706, 227); //randomly move to.
boxThree := intToBox(491, 461, 783, 589);
num1 := 1;
num2 := 2;
num3 := 3;
method := randomRange(1, 3); //chooses which antiban method will be run

if method = num1 then
begin
writeLn('Antiban Method 1');
mouseBox(boxOne, MOUSE_MOVE);
end;

if method = num2 then
begin
writeLn('Antiban Method 2');
mouseBox(boxTwo, MOUSE_MOVE);
end;

if method = num3 then
begin
writeLn('Antiban Method 3');
mouseBox(boxThree, MOUSE_MOVE);
end;

end;

procedure clickEnemy();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
findColorsSpiralTolerance(x, y, TPA, 3434850, mainScreen.getBounds(), 22, colorSetting(2, 0.07, 0.11));
if length (TPA) < 1 then //If there are no monsters found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ttack'], 500) then
begin
fastClick(MOUSE_LEFT); // attacks mob
smartImage.clear();
wait(randomRange(500, 800));
antiBan();
wait(randomRange(5000, 5800));
break;
end;

if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
begin
writeLn('Gate of War found');
break;
end;

end;

end;

procedure pickUpBones();
var
x, y, i : integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
findColorsSpiralTolerance(x, y, TPA, 9015205, mainScreen.getBounds(), 21, colorSetting(2, 0.08, 0.43));
if length (TPA) < 1 then //If there are no bones found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest drop to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
wait(1000);
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ake'], 500) then
begin
mouse(middleTPA(ATPA[i]), MOUSE_RIGHT); // picks up the bones at the closest point to you.
chooseOption.select(['ake Bones']);
tabBackPack.waitForShift(10000);
smartImage.clear();
break;
end;
end;

end;



begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
repeat
clickEnemy();
wait(3000);
pickUpBones();
until tabBackPack.isFull();
end.

The Mayor
08-11-2014, 10:40 AM
It looks like you're making progress :) You could however simpify your antiban quite a bit:


procedure antiBan();
var
num1, num2, num3, method : integer;
boxOne, boxTwo, boxThree : TBox;

begin
boxOne := intToBox(35, 336, 269, 501); //The boxes on the screen that the mouse will
boxTwo := intToBox(421, 55, 706, 227); //randomly move to.
boxThree := intToBox(491, 461, 783, 589);
num1 := 1;
num2 := 2;
num3 := 3;
method := randomRange(1, 3); //chooses which antiban method will be run

if method = num1 then
begin
writeLn('Antiban Method 1');
mouseBox(boxOne, MOUSE_MOVE);
end;

if method = num2 then
begin
writeLn('Antiban Method 2');
mouseBox(boxTwo, MOUSE_MOVE);
end;

if method = num3 then
begin
writeLn('Antiban Method 3');
mouseBox(boxThree, MOUSE_MOVE);
end;
end;


Could just be:

procedure antiBan();
begin
case random(3) + 1 of: //random(3) = 0, 1, 2.
1:begin
writeLn('Antiban Method 1');
mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
end;

2:begin
writeLn('Antiban Method 2');
mouseBox(ntToBox(421, 55, 706, 227);, MOUSE_MOVE);
end;

3:begin
writeLn('Antiban Method 3');
mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
end;
end;
end;

o0Matthius0o
08-12-2014, 08:18 AM
UPDATE
*The script now runs forever til you stop it.
*It will now wait til the backpack is full and bury all the bones.

FUTURE UPDATES
*Still working on the procedure for making the script run for specified time.
*Actionbar functionality.
*Moving the Script to a different area. I havent done this yet because i do not have a high

Still having some trouble with making the script run for a specified amount of time. So if you guys can drop any ideas on me for how to do that then let me know. I know it is in the tutorial but the way it is done is not quite the way i was looking for. I want it to where the user can specify the time by editing a global in the script. Then when the time running is equal to the time you want it to run it will stop.

I tried a few of simbas built in functions. But the script just kept running and it stopped burying the bones.




program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure antiBan();
var
antiBanNum : integer;
begin
antiBanNum := randomRange(0, 2);
case antiBanNum of //random(3) = 0, 1, 2.
0:begin
writeLn('Antiban Method 1');
mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
end;

1:begin
writeLn('Antiban Method 2');
mouseBox(intToBox(421, 55, 706, 227), MOUSE_MOVE);
end;

2:begin
writeLn('Antiban Method 3');
mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
end;
end;
end;

procedure clickEnemy();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
findColorsSpiralTolerance(x, y, TPA, 3434850, mainScreen.getBounds(), 22, colorSetting(2, 0.07, 0.11));
if length (TPA) < 1 then //If there are no monsters found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ttack'], 500) then
begin
fastClick(MOUSE_LEFT); // attacks mob
smartImage.clear();
wait(randomRange(500, 800));
antiBan();
wait(randomRange(5000, 5800));
break;
end;

if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
begin
writeLn('Gate of War found');
break;
end;

end;

end;

procedure pickUpBones();
var
x, y, i : integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
findColorsSpiralTolerance(x, y, TPA, 9015205, mainScreen.getBounds(), 21, colorSetting(2, 0.08, 0.43));
if length (TPA) < 1 then //If there are no bones found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest drop to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
wait(1000);
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ake'], 500) then
begin
mouse(middleTPA(ATPA[i]), MOUSE_RIGHT); // picks up the bones at the closest point to you.
chooseOption.select(['ake Bones']);
tabBackPack.waitForShift(10000);
smartImage.clear();
break;
end;
end;

end;

procedure buryBones();
var
slotNum, i : integer;
begin
slotNum := 28;
for i := 1 to slotNum do //for every time "i" is not equal to slotNum
begin //keep clicking the bones in the next box over.
tabBackPack.mouseSlot(i, MOUSE_LEFT);
wait(randomRange(1500, 2300)); //wait until the bones are out of the inventory
i + 1;
end;
end;


begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
repeat
repeat
clickEnemy();
wait(3000);
pickUpBones();
until tabBackPack.isFull();
buryBones();
until(false);
end.

o0Matthius0o
08-12-2014, 08:41 AM
It looks like you're making progress :) You could however simpify your antiban quite a bit:


procedure antiBan();
var
num1, num2, num3, method : integer;
boxOne, boxTwo, boxThree : TBox;

begin
boxOne := intToBox(35, 336, 269, 501); //The boxes on the screen that the mouse will
boxTwo := intToBox(421, 55, 706, 227); //randomly move to.
boxThree := intToBox(491, 461, 783, 589);
num1 := 1;
num2 := 2;
num3 := 3;
method := randomRange(1, 3); //chooses which antiban method will be run

if method = num1 then
begin
writeLn('Antiban Method 1');
mouseBox(boxOne, MOUSE_MOVE);
end;

if method = num2 then
begin
writeLn('Antiban Method 2');
mouseBox(boxTwo, MOUSE_MOVE);
end;

if method = num3 then
begin
writeLn('Antiban Method 3');
mouseBox(boxThree, MOUSE_MOVE);
end;
end;


Could just be:

procedure antiBan();
begin
case random(3) + 1 of: //random(3) = 0, 1, 2.
1:begin
writeLn('Antiban Method 1');
mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
end;

2:begin
writeLn('Antiban Method 2');
mouseBox(ntToBox(421, 55, 706, 227);, MOUSE_MOVE);
end;

3:begin
writeLn('Antiban Method 3');
mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
end;
end;
end;


I tried this mayor and i kept getting an access violation. Not sure why. The debug was exactly "access violation"

o0Matthius0o
08-12-2014, 08:45 AM
Scratch that. I had copied your text exactly but now looking back on it there was a mistype and a semicolon in the wrong spot. editing the script now. thanks mayor.

The Mayor
08-12-2014, 08:48 AM
Scratch that. I had copied your text exactly but now looking back on it there was a mistype and a semicolon in the wrong spot. editing the script now. thanks mayor.

Glad you solved my antileech ;)

o0Matthius0o
08-12-2014, 09:05 AM
Glad you solved my antileech ;)

lol actually i didnt. Changed that and a few more things. Still getting that same violation. Looked more into pascals case statements. Still havent figured it out. Im sure its simple and ill kick myself for it later. >.<

The Mayor
08-12-2014, 09:22 AM
lol actually i didnt. Changed that and a few more things. Still getting that same violation. Looked more into pascals case statements. Still havent figured it out. Im sure its simple and ill kick myself for it later. >.<

1) of: = of
2) mouseBox(ntToBox = mouseBox(intToBox
3) 706, 227);, = 706, 227),

o0Matthius0o
08-12-2014, 09:29 AM
1) of: = of
2) mouseBox(ntToBox = mouseBox(intToBox
3) 706, 227);, = 706, 227),

AWWWW! The only thing i forgot was the colon on the end of the "of".

Thanks for the lesson! lol it works great now.

o0Matthius0o
08-13-2014, 05:19 AM
Anyone know how to keep my bot within a certain bounds on the map? I should be able to figure out how to get him back in that area should he leave. But i want to see if i can prevent that all together. Doors like the gates of war in the stronghold all have the same color so it would be a bit difficult to guide him back.... Unless i had it check the camera angle. and if it is pointed north then click the southern most door. Which will work in this situation. Any tips and ideas would be great, but if no luck then its no big deal. This guy is going to the wilderness dungeons next. After i level this character a bit. :/

o0Matthius0o
08-13-2014, 11:20 PM
UPDATE
*Added a little bit of actionbar abilities.
*Added a DTM to find the "0" in the hp bar of a goblin to let the script know the fight is over.


Still need to change the DTM to a function so i can use it in a more modular manner. It will make the script a bit less bulky and easier to read. I am trying to figure out how to keep the script from clicking the action bar and use the keyboard instead. Havent seen a way to do that yet although i know one exists. I was looking through the bonsaiFighter to see how they did it but i cant decipher it yet.

FUTURE UPDATE
*Will add a login function so you can just start the script and forget about it.
*Still need to add some breaks into the antiban.






program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure antiBan(); //So far all it does is move the mouse into a random area of one of 3 TBoxes.
var
antiBanNum : integer;
begin
antiBanNum := randomRange(0, 4);
case antiBanNum of //random(3) = 0, 1, 2.
0:begin
writeLn('Antiban Method 1');
if randomRange(0, 2) = 1 then
begin
writeLn('Rotation of Method 1');
minimap.setAngle(randomRange(0, 275));
End
else
begin
mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
end;
end;

1:begin
writeLn('Antiban Method 2');
if randomRange(0, 2) = 1 then
begin
mouseBox(intToBox(421, 55, 706, 227), MOUSE_MOVE);
End
else
begin
writeLn('Rotation of Method 2');
minimap.setAngle(randomRange(0, 360));
end;
end;

2:begin
writeLn('Antiban Method 3');
if randomRange(0, 2) = 1 then
begin
mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
End
else
begin
writeLn('Rotation of Method 3');
minimap.setAngle(randomRange(100, 200));
end;
end;

3:begin
writeLn('No Antiban this round');
end;

4:begin
writeLn('Antiban Method 4');
mouseBox(intToBox(17, 12, 539, 260), MOUSE_MOVE);
end;
end;
end;

procedure clickEnemy();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
hpDTM: integer;

begin
hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3g wUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
findColorsSpiralTolerance(x, y, TPA, 3434850, mainScreen.getBounds(), 22, colorSetting(2, 0.07, 0.11));
if length (TPA) < 1 then //If there are no monsters found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ttack'], 500) then
begin
fastClick(MOUSE_LEFT); // attacks mob
smartImage.clear();
if findDTM(hpDTM, x, y, mainScreen.getBounds()) then //If the number "0" is found in the goblins hp bar the fight will end
begin
writeLn('DTM found!!!!!');
exit;
End
else if not findDTM(hpDTM, x, y, mainScreen.getBounds()) then // If it is not found then we will use the first ability.
begin
writeLn('Slicing');
actionBar.clickSlot(1);
End
else
begin
writeLn('Dicing');
actionBar.clickSlot(2);
end;
wait(randomRange(500, 800));
antiBan();
wait(randomRange(5000, 5800));
break;
end;

if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
begin
writeLn('Gate of War found');
break;
end;

end;

end;

procedure pickUpBones();
var
x, y, i : integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
findColorsSpiralTolerance(x, y, TPA, 9015205, mainScreen.getBounds(), 21, colorSetting(2, 0.08, 0.43));
if length (TPA) < 1 then //If there are no bones found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest drop to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
wait(1000);
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ake'], 500) then
begin
mouse(middleTPA(ATPA[i]), MOUSE_RIGHT); // picks up the bones at the closest point to you.
chooseOption.select(['ake Bones']);
tabBackPack.waitForShift(10000);
smartImage.clear();
break;
end;
end;

end;

procedure buryBones();
var
slotNum, i : integer;
begin
slotNum := 28;
for i := 1 to slotNum do //for every time "i" is not equal to slotNum
begin //keep clicking the bones in the next box over.
tabBackPack.mouseSlot(i, MOUSE_LEFT);
wait(randomRange(1500, 2300)); //wait until the bones are out of the inventory
i + 1;
end;
end;

procedure checkAngle();
var
angle : extended;

begin
angle := minimap.getAngleRadians();

if angle <> MM_DIRECTION_NORTH and MS_ANGLE_HIGH then // checks to see if the camera is in the correct position. If its not it will put it there.
begin
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;

end;

procedure monsterHealthDTM();
var
hpDTM: integer;
begin
hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3g wUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
end;


begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
repeat
repeat
//checkAngle();
clickEnemy();
//checkAngle();
wait(randomRange(3000, 3500));
pickUpBones();
until tabBackPack.isFull();
buryBones();
until(false);
end.

bonsai
08-14-2014, 02:11 AM
I am trying to figure out how to keep the script from clicking the action bar and use the keyboard instead. Havent seen a way to do that yet although i know one exists. I was looking through the bonsaiFighter to see how they did it but i cant decipher it yet.


At this point I prefer to use revolution and let the game do the work. Less things for them to notice :)

procedure doAbilities();

var
i: integer;
keyStr: string;

begin
for i := 9 downto 1 do // used 9 to match revolution
begin
if (actionBar.getAbilityCooldown(i) = 1) then
begin
case i of
0..9: keyStr := intToStr(i);
10: keyStr := '0';
11: keyStr := '-';
12: keyStr := '=';
end;

SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));

exit; // only do one ability
end;
end;
end;

o0Matthius0o
08-14-2014, 04:57 AM
At this point I prefer to use revolution and let the game do the work. Less things for them to notice :)

procedure doAbilities();

var
i: integer;
keyStr: string;

begin
for i := 9 downto 1 do // used 9 to match revolution
begin
if (actionBar.getAbilityCooldown(i) = 1) then
begin
case i of
0..9: keyStr := intToStr(i);
10: keyStr := '0';
11: keyStr := '-';
12: keyStr := '=';
end;

SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));

exit; // only do one ability
end;
end;
end;


So if i break this down. It will randomly cycle 1-9 and 0 - =. After that it will pick a slot from the action bar and then press that key on the keyboard?
i am still new to this so would you mind breaking down the code? like what does this line do "SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));"

and what is the purpose of getting the cooldowns to cycle through?

The Mayor
08-14-2014, 05:24 AM
SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));

sendKeys is a simba procedure which actually presses a key on your keyboard. The parameters are:

procedure SendKeys(const s: string; keywait, keymodwait: integer);

s is the key you want to press as a string. So to press number 1 you would go '1'. You can also send words e.g. 'Hello'.
keywait is the time in ms to hold down the key you press
keymodwait is the time to +/- from the keywait

SRL6 also has a procedure called typeSend:

procedure typeSend(text: string; pressEnter: boolean = true);

Text is your text, and you can optionally make it press enter after it's done typing.

typeSend('Hello there', true);

o0Matthius0o
08-15-2014, 07:18 AM
sendKeys is a simba procedure which actually presses a key on your keyboard. The parameters are:

procedure SendKeys(const s: string; keywait, keymodwait: integer);

s is the key you want to press as a string. So to press number 1 you would go '1'. You can also send words e.g. 'Hello'.
keywait is the time in ms to hold down the key you press
keymodwait is the time to +/- from the keywait

SRL6 also has a procedure called typeSend:

procedure typeSend(text: string; pressEnter: boolean = true);

Text is your text, and you can optionally make it press enter after it's done typing.

typeSend('Hello there', true);


Do you mind if i use your methods for logging in and breaking? I found them to be really easy to understand and very useful.

The Mayor
08-15-2014, 10:16 AM
Do you mind if i use your methods for logging in and breaking? I found them to be really easy to understand and very useful.

Use whatever

bonsai
08-15-2014, 04:35 PM
So if i break this down. It will randomly cycle 1-9 and 0 - =. After that it will pick a slot from the action bar and then press that key on the keyboard?
i am still new to this so would you mind breaking down the code? like what does this line do "SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));"

and what is the purpose of getting the cooldowns to cycle through?

getAbilityCooldown tells you if the ability is ready. I think the documentation says it returns 100 but it returns 1 when the ability is ready to use.

The cycling is not random. It loops backwards from 9 to 1 and checks that slot to see if it is ready. That way when people put their threshold skills to the right of the actionbar it will choose them before the basic skills (on the left).

So the for loop and the if test will choose the right-most skill that is ready.

The case statement decides which key to be press to activate the chosen ability. It has entries for 10/11/12 but they are not needed any more since I'm only looping from 9.

Then it calls sendkeys to actually push the key.

o0Matthius0o
08-16-2014, 12:14 AM
Thanks for the help guys. I now have login functionality. Tonight when I get home I'll add in some breaking and then clean it up a bit. Then add a proggy function. Once that's done I'll have almost a fully functional script ready for testing. You guys are awesome.

o0Matthius0o
08-16-2014, 09:39 AM
Ok, this is just to see if my signature works. But if you want to know i have gotten the break times in the script now. Probably going to move to a higher level area for the rest of the script til i think its ready for fire giants. This way im not one shotting goblins and can test out the action bar and eating.

o0Matthius0o
08-17-2014, 03:40 AM
getAbilityCooldown tells you if the ability is ready. I think the documentation says it returns 100 but it returns 1 when the ability is ready to use.

The cycling is not random. It loops backwards from 9 to 1 and checks that slot to see if it is ready. That way when people put their threshold skills to the right of the actionbar it will choose them before the basic skills (on the left).

So the for loop and the if test will choose the right-most skill that is ready.

The case statement decides which key to be press to activate the chosen ability. It has entries for 10/11/12 but they are not needed any more since I'm only looping from 9.

Then it calls sendkeys to actually push the key.

This was incredibly helpful! Now thanks to using that and a few of the functions from The Mayor i now have a functional script with breaks. Still want to clean up the debug window and add a proggy.

I have now moved the start location. Instead of goblins it now fights the minotaurs right next door. Or anywhere in that floor of the dungeon. I commented out the looting of the bones for now as it was pretty useless at this stage.

Ok so the biggest change i made was in the script finding the end of the fight. I used a DTM to find the monsters hp. When it sees the "0" it will stop the fight and move on to the next one. I did this because he kept aggroing all the minotaurs.

Please let me know your thoughts on this!


program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/LIB/SPS-RS3.simba}


const
//-------Login Settings-------//
PLAYER_FILE = 'Godlist';
NICKNAME = 'Miner2';
LOGIN_WORLD = 0;
//ENABLE_DEBUG = False;
//----------------------------//
//-------Break settings-------//
ENABLE_BREAKS = True;

MIN_PLAY_TIME = 45;
MAX_PLAY_TIME = 180;

MIN_BREAK_TIME = 5;
MAX_BREAK_TIME = 45;
//----------------------------//

var
//-------Global Variables-------//
TotalBreakTime, StatsTime : TTimeMarker; //Timers Here

BreakTimeTotal, BreakTime, Breaked, XpGained : integer; //Stats Here

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure resetBreakTimer();
begin
BreakTime := getSystemTime() + gaussRangeInt(MIN_PLAY_TIME * 60000, MAX_PLAY_TIME * 60000);
end;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure setup();

begin
smartEnableDrawing := true;
//disableSRLDebug := not ENABLE_DEBUG;
setupSRL();

players.Setup([NICKNAME], PLAYER_FILE);
currentPlayer := 0;
players[currentPlayer].world := LOGIN_WORLD;

exitTreasure();

resetBreakTimer();
TotalBreakTime.start();
TotalBreakTime.pause();
end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function antiBan(): boolean;
var
antiBanNum : integer;
begin
antiBanNum := random(1500);
if antiBanNum <= 100 then
begin
writeLn('Antiban Time!');

case antiBanNum of
1..10: boredHuman(false);
11..25: hoverRandomSkill();
26..31: hoverOnlineFriend();
32..52: mouseMovingObject();
53..69: mouseOffClient(4);
70..80: randomCameraAngle(MS_ANGLE_HIGH);
81..90: randomCompass(10, 40, True);
91..100: wait(randomRange(3000, 5000));

end;
end;
end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function timeUntilBreak() : string;
var
breakFromNow, H, M, S : integer;
begin
if ENABLE_BREAKS then
begin
breakFromNow := BreakTime - getSystemTime();
convertTime(breakFromNow, H, M, S);
result := (toStr(H) + 'h ' + toStr(M) + 'm ' + toStr(S) + 's');
end else
result := ('Breaking disabled');
end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure takeBreak();
var
H, M, S, HH, MM, SS, breakFor, timeLeft : integer;
breakStartTimer : TTimeMarker;

begin
if not ENABLE_BREAKS then
exit;

if (getSystemTime() >= BreakTime) then
begin
TotalBreakTime.start();
writeLn('Taking a break');

if random(2) = 0 then
players[currentPlayer].logout()
else
players[currentPlayer].exitToLobby();

breakFor := gaussRangeInt(MIN_BREAK_TIME * 60000, MAX_BREAK_TIME * 60000);
convertTime(breakFor, H, M, S);
writeLn('You are taking a break for: ' + toStr(H) + 'h ' + toStr(M) + 'm ' + toStr(S) + 's');

breakStartTimer.start();

repeat
timeLeft := breakFor - breakStartTimer.getTime();
convertTime(timeLeft, HH, MM, SS);
writeLn('Ending break in: ' + toStr(HH) + 'h ' + toStr(MM) + 'm ' + toStr(SS) + 's');
wait(25000 + random(4000));
until breakFor < breakStartTimer.getTime();

inc(Breaked);
resetBreakTimer();
TotalBreakTime.pause();
players[currentPlayer].login();
wait(gaussRangeInt(1500, 3500));
exitTreasure();
minimap.clickCompass();
end;
end;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure doAbilities();
var
i : integer;
keyStr : string;

begin
for i := 9 downto 1 do
begin
if (actionBar.getAbilityCooldown(i) = 1) then
begin
case i of
0..9: keyStr := intToStr(i);
10: keyStr := '0';
11: keyStr := '-';
12: keyStr := '=';
end;

SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));

exit;
end;
end;
end;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure clickEnemy();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
hpDTM: integer;
isMobDead : boolean;
begin
if isLoggedIn() then
begin

hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3g wUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
isMobDead := false;
findColorsSpiralTolerance(x, y, TPA, 2709450, mainScreen.getBounds(), 24, colorSetting(2, 0.09, 1.42));
if length (TPA) < 1 then //If there are no monsters found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(40, 40);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ttack'], 500) then
begin
if findDTM(hpDTM, x, y, mainScreen.getBounds()) then
begin
writeLn('DTM found, Moster hp 0');
isMobDead := True;
break;
end;
fastClick(MOUSE_LEFT); // attacks mob
repeat
if findDTM(hpDTM, x, y, mainScreen.getBounds()) then //Will keep fighting the monster til their health reaches 0
begin
writeLn('DTM found, Moster hp 0');
isMobDead := True;
break;
end;
doAbilities();
until isMobDead = True;
smartImage.clear();
antiBan();
wait(randomRange(5000, 8000));
break;
end;

if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
begin
writeLn('Gate of War found');
break;
end;

end;
End else
if not isLoggedIn() then
begin
writeLn('You are not logged in');
exit;
end;

end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure pickUpBones();
var
x, y, i : integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if IsLoggedIn() then
begin

findColorsSpiralTolerance(x, y, TPA, 9015205, mainScreen.getBounds(), 21, colorSetting(2, 0.08, 0.43));
if length (TPA) < 1 then //If there are no bones found it will terminate and rerun.
begin
exit;
end;
ATPA := TPA.toATPA(20, 20);
ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest drop to you.

smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
wait(1000);
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ake'], 500) then
begin
mouse(middleTPA(ATPA[i]), MOUSE_RIGHT); // picks up the bones at the closest point to you.
chooseOption.select(['ake Bones']);
tabBackPack.waitForShift(10000);
smartImage.clear();
break;
end;
end;
end;
end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure buryBones();
var
slotNum, i : integer;
begin
if isLoggedIn() then
begin

slotNum := 28;
for i := 1 to slotNum do //for every time "i" is not equal to slotNum
begin //keep clicking the bones in the next box over.
tabBackPack.mouseSlot(i, MOUSE_LEFT);
wait(randomRange(1500, 2300)); //wait until the bones are out of the inventory
i + 1;
end;
end;
end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure checkAngle();
var
angle : extended;

begin
angle := minimap.getAngleRadians();

if angle <> MM_DIRECTION_NORTH and MS_ANGLE_HIGH then // checks to see if the camera is in the correct position. If its not it will put it there.
begin
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;

end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure monsterHealthDTM();
var
hpDTM: integer;
begin
hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3g wUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



begin
setup();
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
end;
until isLoggedIn();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
repeat
//repeat
clickEnemy();
wait(randomRange(3000, 3500));
//pickUpBones();
//until tabBackPack.isFull();
//buryBones();
until(false);
end.

o0Matthius0o
08-17-2014, 03:55 AM
This is the new recommended starting point for anyone who is wondering.

23819

Edit: i condensed the other messages down into this one. Sorry about that mr. roboto.

I do realize there is a little problem with the script detecting any 0's in the monsters hp. I have a temp fix for that. If i extend the dtm a bit to find the corners of the hp bar as well as the points set on the 0 then that will atleast stop it from detecting any zeros that arent in the center.

As for making sure the hp is absolute 0 i have an idea. But first i need to know if its possible to do something like a dtm within a dtm.





I havent actually tested whether or not it actually takes breaks yet. So just a warning for anyone who might be using it (nobody)

I have also drastically improved the antiban using the method from The Mayor. I found the antiban folder in the simba core files and went nuts with them.

Mr. Roboto
08-17-2014, 04:34 AM
Hey, not to be mean, but I think there is a suggestion on the forums to avoid posting after yourself; you can edit the same post until someone replies. The only reason I am telling you is because my page is refreshing as I try to read your code.

For the important things:
I thought you changed the antiban to be a procedure and to not have the unnecessary if statement.

Another thing, what will happen if you call clickEnemy(); but your user is not actually logged in?

o0Matthius0o
08-17-2014, 04:52 AM
Hey, not to be mean, but I think there is a suggestion on the forums to avoid posting after yourself; you can edit the same post until someone replies. The only reason I am telling you is because my page is refreshing as I try to read your code.

For the important things:
I thought you changed the antiban to be a procedure and to not have the unnecessary if statement.

Another thing, what will happen if you call clickEnemy(); but your user is not actually logged in?

I cleaned them up. Sorry for all the unnecessary posts. Got excited lol.

As for your points. What if statements are you talking about in the antiban? I only have the one.

I corrected the problem with the clickEnemy procedure. It will now exit if you are not logged in. I have edited that in the code. Its at the very bottom of the procedure.

Mr. Roboto
08-17-2014, 05:10 AM
I cleaned them up. Sorry for all the unnecessary posts. Got excited lol.

As for your points. What if statements are you talking about in the antiban? I only have the one.

I corrected the problem with the clickEnemy procedure. It will now exit if you are not logged in. I have edited that in the code. Its at the very bottom of the procedure.

I would write the antiban like this:

procedure antiBan()
var
i: integer;
begin
i := random(1500);

case i of
1..4 : boredHuman(true);
end;
end;

You don't need the


if i < 20 then
begin

The reason you want a procedure instead of function is because function is going to create stack space for a return value. And you don't need the if because a switch case is technically an if already.