SRL Archive - First Scripts

[First]auto alcher - NEED HELP


steveinater

2007-10-08 14:49:36

Ok so i have always wanted to make a script but i suck at programming but now on the course i am on i am starting to learn the very basics of VB so i thought if i can follow those tuts i want to be able to script with scar.

Well the tuts i have read explain all the meanings of what is happening but i find it hard to put it into practice, so i have just come up with this realy basic script that i know does not work.

i know how it is set up at the moment only allows it to run though once so i need someone to teach me how to fix the script to start with and then how to set it up to repeat until there is nothing left to alch.

s1thslay3r0

2007-10-08 16:15:22

use repeat
until false

s1thslay3r0

2007-10-08 16:30:04

pm if u need more help ill try to help as much as possible

MasterKill

2007-10-08 16:32:58

program AutoAlcher;
{.include SRL/SRL.scar}

var
x,y, AlgedTimes: Integer;

const
TimesToAlg = 10;
AlchColor= 65536; //set Alch colour
Item= 11111; //Set Item colour

procedure OpenMagic;
begin
GameTab(7);
end;

procedure ClickAlch;
begin
if(FindColor(x,y,AlchColor,0,0,600,600))then
begin
MMouse(x,y,0,0);
wait(100+random(50));
Mouse(x,y,0,0,true);
end;
end;

procedure AlchItem;
begin
if(FindColor(x,y,Item,0,0,600,600))then
begin
MMouse(x,y,0,0);
wait(100+random(50));
Mouse(x,y,0,0,true);
AlgedTimes := AlgedTimes + 1;
end;
end;

// MAIN LOOP \\
begin
SetupSRL;
repeat
OpenMagic;
ClickAlch;
AlchItem;
Wait(5000 + random(2000));
Until(AlgedTimes > timestoalg)
Writeln('done.');
end.

hope it's usefull, gl learning!

Lokan

2007-10-08 17:47:00

Nice first attempt. It doesn't help if you think you suck. Be positive! ;)

steveinater

2007-10-09 10:50:07

thx MasterKill i will compare it to my own and see what differences are there and where i went wrong.

can i ask what does


AlgedTimes:

that part of the x, y integer mean? it isnt in any of the guides i read.

Dumpin

2007-10-09 11:18:21

those things are variables,
x, y, are the cordinates, if Mouse(x,y 0, 0, true); it will click on the spot where the mouse is… BUT if mouse(12, 45, 0, 0, true); it will click on 12-45.

as you can see algedtime is in the variables to.
now take a look at the lach procedure:
procedure AlchItem;
begin
if(FindColor(x,y,Item,0,0,600,600))then
begin
MMouse(x,y,0,0);
wait(100+random(50));
Mouse(x,y,0,0,true);
AlgedTimes := AlgedTimes + 1; // everything it did a alch algedtime gets +1
end;
end;

so, everytime you do a alch scar makes algedtime + 1.
aye?

now look at your const.. you see timestoalch there the number after it is for how many times you want to alch your script.
also, alching will be repeated by the:

repeat
until(…)
function.
// MAIN LOOP \\
begin
SetupSRL;
repeat
OpenMagic;
ClickAlch;
AlchItem;
Wait(5000 + random(2000));
Until(AlgedTimes > timestoalg) // when Algedtimes reaches timestoalg the script wil stop.
Writeln('done.');
end.

so when you fill in for timestoalg 10, it will alch until it did the alch procedure 10 times..
I can't explain it really better… I hope this helped you :)

steveinater

2007-10-09 12:44:27

thx Bumpin that helped a lot i think i understand what it does now.

can i ask can i call it anything i want as long as i use that name all though the script?

Dumpin

2007-10-09 12:56:25

ofcourse, if you change the var, AlgedTimes := AlgedTimes + 1; , Until(AlgedTimes > timestoalg) yes.

and the name is Dumpin :)

MasterKill

2007-10-09 16:41:05

sorry just added that, didn't want to confuze ya :p

dumpin explained it allready :) ( i thought your name was derk? :p)

keep on reading tuts and just keep it up :)

Dumpin

2007-10-10 02:22:23

awh you know to much >.< :P
my forum name is Dumpin :P

Good luck with your scriptsteveinater :)