SRL Archive - First Scripts

First Script Please Rate!


503075000868

2007-07-19 17:13:41

Hi! This is my first script (well since I came back into the world of SCAR). It's not a RuneScape script, it's for a game called GunSlinger on Mousebreaker.com. Anyway, please rate it and tell me how I can improve on anything (standards, actual script, anything) so I have a better knowledge of where to go from here.

{Will's Gunslinger Script

Play the game at [url]www.mousebreaker.com/games/gunslinger/play.php[/url]

Make sure the screen is scrolled up to the top.

The High Score name you want is to be put in on line 20
and how many GunSlinger's you want to be killed is to be put on line 19
NOTE: You cannot kill more than 66 GunSlinger's, you will lose if you put
more than 66.

Thanks!

}

program GunSlinger;

const
HowManyToKill= 1;//How man GunSlinger's to kill
HighScoreName= ('Will');//High Score Name, must be 8 characters or less


var
HowManyKilled: integer;

procedure ProgressReport;
begin
ClearDebug;
Writeln(' This script was brought to you by: ');
Writeln(' __ __ ___ ___ ___ ');
Writeln(' \ \ _ / / | | | | | | ');
Writeln(' \ \ / \ / / | | | | | | ');
Writeln(' \ \_/ _ \_/ / | | | | | | ');
Writeln(' \ / \ / | | | |___ | |___ ');
Writeln(' \_/ \_/ |_| |_____| |_____| ');
Writeln(' ');
Writeln('[]============================[]');
Writeln(' ' + 'Killed ' + IntToStr(HowManyKilled) + ' GunSlingers' + ' ');
Writeln(' ' + 'Out of Pos ' + IntToStr(HowManyToKill) + ' Gunslingers' + ' ');
Writeln('[]============================[]');
end;

procedure HighScore;
begin
if (GetColor(248,361)= 52479) then
wait(100);
MoveMouseSmoothEx(248,361,1,3,20,1,1);
wait(200);
ClickMouse(248,361,true);
wait(1000);
if (GetColor(226,214)=16777215) then
wait(100);
MoveMouseSmoothEx(226,214,1,3,20,1,1);
wait(100);
ClickMouse(226,214,true);
wait(100);
SendKeys(HighScoreName);
wait(100);
MoveMouseSmoothEx(275,273,1,3,20,1,1);
wait(100);
ClickMouse(275,273,true);
wait(100);
end;

procedure Start;
begin
HowManyKilled:= 0
if (GetColor(505,344)=52479) then
ClickMouse(505,344,true);
end;


procedure FindHand;
begin
repeat
wait(1);
MoveMouse(230,252);
until (GetColor(230,252)=3757682);
end;

procedure shoot;
begin
wait(1);
SendKeys(' ');
wait(1);
HowManyKilled:= (HowManyKilled + 1);
if (HowManyKilled = HowManyToKill) then
begin
HighScore;
end else
begin
if(GetColor(517,361)=52479) then
wait(1000);
MoveMouseSmoothEx(517,361,1,3,20,1,1);
wait(500);
ClickMouse(517,361,true);
end;
end;

begin
Start;
repeat
FindHand;
Shoot;
ProgressReport;
until (HowManyKilled = HowManyToKill);
end.

Thanks!

[EDIT]
Sorry I forgot to add a poll and I don't know how to do it, so please, ratings are:

Very Good
Good
O.K.
Poor

3Garrett3

2007-07-19 17:22:53

After every if then statement, put a begin, and and end, like

if something then
begin
do stuff
more stuff
end;

503075000868

2007-07-20 11:41:24

I can't, otherwise the High Score part won't work, so I have to leave out a few begins and ends for it to work. Still a bit unsure whether my standards are correct though.

Diabloizzle

2007-08-01 15:37:43

It will still work, putting in begin's and end's are part of standards.

3Garrett3

2007-08-01 16:10:47

no if you do this:


if something then
this;
that;
again;

instead of this


if something then
begin
this;
that;
agian;
end;

The first one will only do that IF something is true. Then it will do that and again no matter what else happens.

The second one will only do all three of them IF something is true, which is what you are trying to do.

dvdcrayola

2007-08-02 01:00:28

the shooting part works as it is supposed to, nice job on that. not to shabby for a first script

drnewheart

2007-08-06 01:38:37

Very Nice I Like Having My Name In A HighScores In A Game

passiondrive

2007-08-06 04:39:22

Hey there, didn't test your script but I had a good look through it. Not bad for a first script put here are a few pointers on improving it. You have:
Wait(100);
This is very detectable as it always waits the same amount of time. You should try:
Wait(100 + Random(200));
Basically all this does is add a random of 200 milliseconds to your wait. For example. It could wait either 129 milliseconds of 265.

For RS scripts your should include SRL by doing this:
{.Include SRL\SRL.SCAR}
And have this at the top of your main loop.
SetUpSRL;
This basically allows use to use SRL in our scripts. For RS never use ClickMouse use Mouse(x,y,Coords,Coords,True); this moves the mouse to the specified coordinates and clicks.

Hope I helped you out a bit!
- Drive

Starblaster100

2007-08-06 05:02:09

Hi there, an excellent start to scripting!

Here are some suggestions for you, and things for you to note:

1) What everyone is trying to tell you about the begin and end tags.

[php]
If This_Is_True Then
Begin
Writeln('Hello');
Writeln('This is true!');
end;
[/php]

is very different to:

[php]
If This_Is_True Then
Writeln('Hello');
Writeln('This is true!');
[/php]

Although none of them will compile, I'll explain what they do. If you were to run the first one and the variable This_Is_True was true, then it will print out the words Hello and This is true. If you run the second one and the variable This_Is_True is true, it would also print out the words Hello and This is true.

It differs however, if the variable This_Is_True is not set to true. If you were to run the first one and the variable This_Is_True was false, it would print out nothing. If you are to run the second one and the variable This_Is_True is set to false, it will only print out "This is True"

This is all to do with the begin and end tags. Play around with them a bit and you'll see what i mean.

2) Your standards are excellent! The only thing you are doing wrong is increasing the indenting all the time after the If (Someting) then

If you are not going to use the begin and end tags then it should be:

[php]
if (GetColor(226,214)=16777215) then
wait(100);
MoveMouseSmoothEx(226,214,1,3,20,1,1);
wait(100);
ClickMouse(226,214,true);
wait(100);
SendKeys(HighScoreName);
wait(100);
MoveMouseSmoothEx(275,273,1,3,20,1,1);
wait(100);
ClickMouse(275,273,true);
wait(100);
[/php]

If you are going to use the begin and end tags, then it should be:

[php]
if (GetColor(226,214)=16777215) then
begin
wait(100);
MoveMouseSmoothEx(226,214,1,3,20,1,1);
wait(100);
ClickMouse(226,214,true);
wait(100);
SendKeys(HighScoreName);
wait(100);
MoveMouseSmoothEx(275,273,1,3,20,1,1);
wait(100);
ClickMouse(275,273,true);
wait(100);
end;
[/php]

3) You may want to think about breaking out of infinite loops however, such as the following:

[php]
procedure FindHand;
begin
repeat
wait(1);
MoveMouse(230,252);
until (GetColor(230,252)=3757682);
end;
[/php]

What happens if it never finds the color? It will be moving the mouse forever.

I would suggest something like:

[php]
procedure FindHand;
Var
Count: Integer;
begin
repeat
wait(1);
MoveMouse(230,252);
Count := Count + 1;
until (GetColor(230,252)=3757682) or (Count >= 10)
end;
[/php]

That way it will move the mouse there until it finds the color or "Count" is greater or equal to 10

Otherwise I can't find much more which is wrong with the script.

I added your poll for you.

Great job

Star

n3ss3s

2007-08-06 05:13:35

Very good, my first scar script was hello world lol :D

Santa_Clause

2007-08-06 05:19:27

From: passiondrive
Hey there, didn't test your script but I had a good look through it. Not bad for a first script put here are a few pointers on improving it. You have:
Wait(100);
This is very detectable as it always waits the same amount of time. You should try:
Wait(100 + Random(200));
Basically all this does is add a random of 200 milliseconds to your wait. For example. It could wait either 129 milliseconds of 265.

For RS scripts your should include SRL by doing this:
{.Include SRL\SRL.SCAR}
And have this at the top of your main loop.
SetUpSRL;
This basically allows use to use SRL in our scripts. For RS never use ClickMouse use Mouse(x,y,Coords,Coords,True); this moves the mouse to the specified coordinates and clicks.

Hope I helped you out a bit!
- Drive


It's not a Runescape script…

And since when did Starblaster post in these kinds of topics?

Starblaster100

2007-08-06 05:20:35

lol, am i banned from posting in these kind of topics then?
Should i delete my post and leave? :p

Hugolord

2007-08-06 05:23:11

yer your right hes really active at SRL nowadays

Santa_Clause

2007-08-06 05:38:08

From: Starblaster100
lol, am i banned from posting in these kind of topics then?
Should i delete my post and leave? :p


Ofcourse not, but it's rare seeing you post in a script thread that isn't yours…:p

Starblaster100

2007-08-06 05:41:17

This one caught my attention.

Nicely written, Seems willing to learn. If he puts in the effort, so will I :D

Santa_Clause

2007-08-06 06:11:21

From: n3ss3s
Very good, my first scar script was hello world lol :D


Congratulations :p

What was your first script Starblaster?

Starblaster100

2007-08-06 06:17:58

Going a bit offtopic here lol:

Was to do with the crafting guild. Mined 27 clay, turned it into soft clay using a bucket and the water from the sink, spun the soft clay into pots and so on, shoved them in the furnace and made them hard, dropped them and the repeated the process :p

Very ambitious for a first script but hey, thats me lol

503075000868

2007-08-06 06:41:18

Wow thanks people for all the help and supportive comments, I understand about the 'Begins and Ends' now, thanks for explaining it to me Star. Glad some liked the script, I'm touching it up and I'm gonna start on a new script :D

Not sure what to do though :rolleyes: