SRL Archive - SRL Archives

MusicFunction


Akriam

2006-12-10 21:56:39

This is my first function, don't be too harsh:wink:

What it does:
Changes the music that is being played, and sometimes switches the music options to loop etc.

The Script:


I have NOT had a chance to test it as I am in a hurry, so it might not work. Here it is:


Program new;
{.include SRL/SRL.scar}


Procedure Music;

var
RM, RO, x1,x2,y1,y2 :Integer;
begin
RM :=Random(3)
Case random(40) of
0: Mmouse(857, 693,3+RM,3+RM)
Mouse(857, 693,3,3,true)
1: Mmouse(865, 692,3+RM,3+RM)
Mouse(865, 692,3+RM,3+RM,true)
2: Mmouse(855, 698,3+RM,3+RM)
Mouse(855, 698,3+RM,3+RM,true)
end;

begin
x1 :=680;
x2 :=841;
y1 :=661;
y2 :=469;
If findcolorspiral(x,y,65280,3,3,x1,x2,y1,y2) then
Mmouse(x,y,3+RM,3+RM)
Mouse(x,y,3+RM,3+RM)
end;

begin
Case Random(60) of
0:Mmouse(754, 435,3+RM,3+RM)
Mouse(754, 435,3+RM,3+RM,true) end;

1:Mmouse(794, 432,3+RM,3+RM)
Mouse(794, 432,3+RM,3+RM,true) end;

2:Mmouse(837, 431,3+RM,3+RM)
Mouse(837, 431,3+RM,3+RM,true) end;

Procedure A;
begin
music;
end;

begin
A;
wait(1000)
end.

Why did I make this? To thank all the kind people who have contributed to SCAR. :)

EDIT: Still one error ':' expected in script, I can't figure it out…

c0de

2006-12-11 09:39:21

From: Akriam
This is my first function, don't be too harsh:wink:

What it does:
Changes the music that is being played, and sometimes switches the music options to loop etc.

The Script:


I have NOT had a chance to test it as I am in a hurry, so it might not work. Here it is:


Program new;
{.include SRL/SRL.scar}


Procedure Music;

var
RM, RO, x1,x2,y1,y2 :Integer;
begin
RM :=Random(3)
Case random(40) of
0: Mmouse(857, 693,3+RM,3+RM)
Mouse(857, 693,3,3,true)
1: Mmouse(865, 692,3+RM,3+RM)
Mouse(865, 692,3+RM,3+RM,true)
2: Mmouse(855, 698,3+RM,3+RM)
Mouse(855, 698,3+RM,3+RM,true)
end;

begin
x1 :=680;
x2 :=841;
y1 :=661;
y2 :=469;
If findcolorspiral(x,y,65280,3,3,x1,x2,y1,y2) then
Mmouse(x,y,3+RM,3+RM)
Mouse(x,y,3+RM,3+RM)
end;

begin
Case Random(60) of
0:Mmouse(754, 435,3+RM,3+RM)
Mouse(754, 435,3+RM,3+RM,true) end;

1:Mmouse(794, 432,3+RM,3+RM)
Mouse(794, 432,3+RM,3+RM,true) end;

2:Mmouse(837, 431,3+RM,3+RM)
Mouse(837, 431,3+RM,3+RM,true) end;

Procedure A;
begin
music;
end;

begin
A;
wait(1000)
end.

Why did I make this? To thank all the kind people who have contributed to SCAR. :)

EDIT: Still one error ':' expected in script, I can't figure it out…




Alot procedure names are missing :S Let me fix it =\


EDIT:
Here now it compiles, I saw loads of improper use of MMouse…
[PHP]
Program new;
{.include SRL/SRL.scar}

Procedure Music;
var
RM, RO, x1,x2,y1,y2 :Integer;
begin
RM :=Random(3)

Case random(2) of // Not sure what this function does but why put 40 if you only have 3 options? 0,1,2
0: Mouse(857, 693,3,3,true);
1: Mouse(865, 692,3+RM,3+RM,true);
2: Mouse(855, 698,3+RM,3+RM,true);
end;

x1 :=680;
x2 :=841;
y1 :=661;
y2 :=469;

If findcolorSpiral(x,y,65280,x1,y1,x2,y2) then
begin
Mouse(x,y,3+RM,3+RM,True);
end;

Case Random(2) of // Not sure what this function does but why put 60 if you only have 3 options? 0,1,2
0: Mouse(754, 435,3+RM,3+RM,true);
1: Mouse(794, 432,3+RM,3+RM,true);
2: Mouse(837, 431,3+RM,3+RM,true);
end;
end;

begin
Music;
wait(1000);
end.
[/php]

Akriam

2006-12-11 17:09:20

I put (40) and (60) so it won't happen that often. And thanks for fixing it, I just wanted to try and help the community :) I will put your name in credits for your help

Yakman

2006-12-11 17:29:02

he put 40 for the randomness, also Random(2) returns 0 or 1, but not 2, so c0de, your case statement will never do the 2:

Akriam

2006-12-12 16:57:24

So other than the minor errors do you like it?