SRL Archive - First Scripts

BaYBeeZ Goblin Grinder


BaYBeeZ

2012-02-01 00:02:59

Hello everyone, below you will find my first ever ATTEMPT at making a script.

THIS SCRIPT DOES NOT WORK YET

I decided to make a goblin killer because I want to learn how to make an autofighter on my own. I really enjoyed using Naracle's fast fighter and wanted to try my hand at making a script that fights a specific monster. I chose goblins because they will be easy to test on new accounts. I would recommend starting at the campfire where all the goblins are near Lumbridge.

I know there is still a lot to add into this script. Believe me, I know.

All I want it to do right now is click on the goblins and fight them after finding the colors. I have selected the correct colors because the mouse will jump around from place to place and the writeln will read, "We found a goblin." which is what I want it to do. However, now I am stuck and would really appreciate some assistance and feedback on how to actually click on the monsters. I'm not sure if the fix is simple or if it will be very complicated. Either way, I'm up for the challenge.

Thank you for taking the time to read this and help me. I will appreciate all respectful and coherent responses as well as criticisms. Please keep in mind this is my first ever attempt at making a script of any kind.

laakerules

2012-02-01 00:10:18

Looks simple and nice. Im guessing your going to add a breaking function inside of it. Just saw from breaking const.

One good thing that could be usefull would be adding the ability for the bot to see if someone else is attacking the monster you are attacking. By adding a simple FindBlackChatMessage('omeone else is fighting') then have it move on. :) just a tip. Message me if you have any questions or would like an in client proggy! :) liek the ones in my scripts! :P

Edit: 1st

also if you want fighting procedures already completed inside simba you can call
{$i SRL/SRL/skill/fighting.simba}
at the top of your script. For is infight and suchnot

BaYBeeZ

2012-02-01 00:44:03

From: laakerules
Looks simple and nice. Im guessing your going to add a breaking function inside of it. Just saw from breaking const.

One good thing that could be usefull would be adding the ability for the bot to see if someone else is attacking the monster you are attacking. By adding a simple FindBlackChatMessage('omeone else is fighting') then have it move on. :) just a tip. Message me if you have any questions or would like an in client proggy! :) liek the ones in my scripts! :P

Edit: 1st

also if you want fighting procedures already completed inside simba you can call
{$i SRL/SRL/skill/fighting.simba}
at the top of your script. For is infight and suchnot


Thank you, very simple for the time being indeed. :)

I was planning on adding breaking, antiban, food, bury bones, looting, and banking but for the time being just being able to click and fight the darn thing would make me happy!

I figured started out on a very small NPC and adding features one by one would help me develop the skills and techniques of actually UNDERSTANDING what I was scripting instead of just copying and pasting bits of codes and saying, "Yippee it works!" but having no idea what each part does.

I do like the Find if someone else is fighting suggestion, I will definitely add that into the script.

Thank you for the {$i SRL/SRL/skill/fighting.simba} at the top of my script as well. I had no idea what all to put up there so I only added the one thing and left off SMART among other things. Thanks for being the first to help me! I will take a look your scripts as well so you might have a bunch of questions coming your way. :p

Drax

2012-02-01 02:40:00

to keep it simple as i see you like it like that you can do

function FightGoblin:Boolean;
var
x, y: Integer;
begin
repeat
if FindObjCustom(x, y, ['att', 'ack'], [3901051, 8365713, 4958626], 4) then
Writeln('We found a goblin.');
MMouse(x, y, 0, 0);
ChooseOption('ttack');
end;

Also it doesn't need to be a function. Functions need to have results. You can just do it like this.

procedure FightGoblin;
var
x, y: Integer;
begin
repeat
if FindObjCustom(x, y, ['att', 'ack'], [3901051, 8365713, 4958626], 4) then
Writeln('We found a goblin.');
MMouse(x, y, 0, 0); // This Moves the mouse to the goblin.
ChooseOption('ttack'); // This right clicks the goblin and chooses attack.
// In here i would put something to check if goblin is dead or easier just put in a wait.
Wait(5000); // this makes it wait for 5 seconds.
end;

laakerules

2012-02-01 11:05:50

procedure FightGoblin;
var
x, y: Integer;
begin
repeat
if FindObjCustom(x, y, ['att', 'ack'], [3901051, 8365713, 4958626], 4) then
Writeln('We found a goblin.');
MMouse(x, y, 0, 0); // This Moves the mouse to the goblin.
ChooseOption('ttack'); // This right clicks the goblin and chooses attack.
// In here i would put something to check if goblin is dead or easier just put in a wait.
Wait(5000); // this makes it wait for 5 seconds.
end;


procedure FightGoblin;
var
x, y: Integer;
begin
repeat
if FindObjCustom(x, y, ['att', 'ack'], [3901051, 8365713, 4958626], 4) then
Writeln('We found a goblin.');MMouse(x, y, 10, 10);
Wait(randomrange(100,150));
If IsUpText('ttack') then
begin
ClickMouse2(False);
WaitOption('oblin', 110);
end;

Thats how i would have done it so you can have the wait instead of just having it do it super fast! :P Cause then you have the wait inside waiting for the option instead of after clicking! :P

BaYBeeZ

2012-02-02 02:06:02

Thanks for the help! What is the difference between having:

MMouse(x, y, 0, 0); and MMouse(x, y, 10, 10);

What's the difference between:
ChooseOption('ttack');

and

If IsUpText('ttack') then
begin
ClickMouse2(False);
WaitOption('oblin', 110);

begginer

2012-02-05 15:28:22

From: BaYBeeZ
Thanks for the help! What is the difference between having:

MMouse(x, y, 0, 0); and MMouse(x, y, 10, 10);

What's the difference between:
ChooseOption('ttack');

and

If IsUpText('ttack') then
begin
ClickMouse2(False);
WaitOption('oblin', 110);


As I know
MMouse(x, y, 0, 0); and MMouse(x, y, 10, 10);
needs color to find the NPC and then puts mouse over there and clicks it.

If IsUpText('ttack') then
begin
ClickMouse2(False);
WaitOption('oblin', 110);
and this can attack goblin just via text, Example right click it and if it;s goblin this will attack, if it's something else will not attack it.

I might not be right cause I am a beginner too. :)

laakerules

2012-02-05 16:24:42

Ya, i jsut pmed him back since im home and explained just what you did! :P