SRL Archive - First Scripts

Scriptkitty's first script non RS


scriptkitty

2009-12-05 23:45:07

i created a script that would log you into gaiaonline and get your daily chances for the day, coh3n helped me with the LoadBitmaps function and the tut he wrote helped me with the rest. i hope to expand on this script later on


{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Gaiadaily |
| Version: beta |
| Scriptkitty |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| what it does: |
| logs into gaia, gets your daily chances for the day |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Setup: put your user name and password in line 60 and 61 |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Notes: Please let me know if you have any suggestions |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}
program gaiadaily;
{.include SRL/SRL.scar}


function LoadBitmaps(Which: Integer): Integer; //LoadBitmaps function from Coh3n
begin
case Which of
0: Result := BitmapFromString(26, 2, 'beNpNjuEKgDAIhN//IbM2KmirH' +
'4u5li7MLagE5TyPDy+RKw49rMjyVnN8pEeYye14cKF8kkhZLID1VJ' +
'iIT9z6mmROHgBC1js2WvnR0KgTKz8Fpxqg07azy5xGXavzzUlfqTS' +
'TbigKkXc='); //username
1: Result := BitmapFromString(27, 2, 'beNodjVsOwyAMBO9/yBiIQpPSC' +
'BUQLzuYuuzXaqWZ7ahhcwnnnMw8qN0vBcrUMcOlAMDH0lv5nFrG/A' +
'y3gzpcRczBAWzWlzmKVmDviNj8ZQTZhfujK6u8v1X8rcRU5IiJMPl' +
'zCR8Rgj58SB2pNyTiyVmExrqUKz3Yfr5WlkM='); //password
2: Result := BitmapFromString(19, 2, 'beNr79qO7u2fbth0MDAxAxs+f' +
'f4AIyHZzd4ewIQgoBRQEKkOWBQqeOXMGyM3KygZyX79+A5H69u0HH' +
'ME1/v37DyoLAJwdRBY='); //login
3: Result := BitmapFromString(10, 1, 'beNpz9fr/yx+IfF0D640s' +
'gWhxaGSDrWOIhkSupm4PANerDAk=');//gaiadailydrawing
4: Result := BitmapFromString(21, 2, 'beNr7/9+3cOJ/MPAtmgRlFE4' +
'CIr+iiQipwolA7n8Y8AMrACIg27ugHyKIzIAjhEg+CCErALEANXZY' +
'Yg=='); //mygaia
5: Result := BitmapFromString(18, 2, 'beNr7/z+gZIp/yWQg+R8GgFwI' +
'Ay4IUYMm6Fc00bdoEpRdOMm3EMr2LZwIZwDVQNlABgA2SlEB'); //Shops
6: Result := BitmapFromString(18, 1, 'beNr7/x8OfAsnwhl+RTA2nFE' +
'4CSgIVQMAxTsqDw=='); //forums
7: Result := BitmapFromString(16, 3, 'beNrL6/UtmvgfDHwLJ8EYE/3g' +
'gkVQQb/CSb5g5F3QDxGBM3wK+hGC+QhZbyRxr7xeIIJK5fXA2V75v' +
'cgKvABmkGa0'); //Wolrd
8: Result := BitmapFromString(15, 2, 'beNor6PcrmvgfBnwLJwK5vkWT' +
'/iMB38JJcFnvgn4ggnBB7HwEG43hAwDZL0O1'); //Games
9: Result := BitmapFromString(15, 2, 'beNrrP+jSf/A/KoCIIJNoU' +
'riUocgCAHcuS40='); //ok button
else
Writeln('Invalid Bitmap Selection.');
end;
end;
procedure glogin; //gaia login sequence
var
username, password, login, x, y, x1, y1, x2, y2 : Integer;
u, p : String;
begin
username := LoadBitmaps(0);
password := LoadBitmaps(1);
login := LoadBitmaps(2);
u := ''; //Put username here between ''
p := ''; //Put Password here between ''
wait(8000)
if FindBitmap(username, x, y) then //looks for the username bitmap
begin
writeln('username found');
Mouse(x, y, 4, 4, True);
wait(500);
TypeKeys(u);
end else
if FindBitmap(username, x, y) then
begin
writeln('username found on the secound try');
Mouse(x, y, 4, 4, True);
wait(500);
TypeKeys(u);
end else
begin
writeln('still could not find... terminating script')
writeln('you might need to adjust the wait time in line 48');
TerminateScript;
end;
if FindBitmap(password, x1, y1) then
begin
Writeln('password found');
Mouse(x1, y1, 4, 4, True);
wait(500);
TypeKeys(p);
end else
begin
writeln('could not find password');
TerminateScript;
end;
If FindBitmap(login, x2, y2) then
begin
Writeln('login button found');
Mouse(x2, y2, 4, 4, True);
wait(500);
writeln('login to gaia online successful');
FreeBitmap(username);
FreeBitmap(password);
FreeBitmap(login);
end else
begin
writeln('could not find login button');
TerminateScript;
end;
end;
procedure getdaily; //finds the daily chance and clicks it)
var
daily, ok, x, y, x1, y1 : Integer;
begin
daily := LoadBitmaps(3);
ok := Loadbitmaps(9);
wait(5000);
if FindBitmap(daily, x, y) then
begin
writeln('daily chance found');
Mouse(x, y, 4, 4, True);
end else
begin
writeln('no daily chance found, did you do it already today?');
end;
wait(7000)
if FindBitmap(ok, x1, y1) then
begin
writeln('ok button found');
Mouse(x1, y1, 4, 4, True);
end else
begin
writeln('adjust the wait time in line getdaily but ignore if no daily chance found');
end;
end;
procedure mygaia;
var
mg, x, y :integer; //mg stands for mygaia bitmap
begin
mg := LoadBitmaps(4);
if FindBitmap(mg, x, y) then
begin
writeln('mygaia found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else
begin
writeln('could not find mygaia');
TerminateScript;
end;
FreeBitmap(mg);
end;
procedure shops;
var
sh, x, y :integer; //sh stands for shops bitmap
begin
sh := LoadBitmaps(5);
if FindBitmap(sh, x, y) then
begin
writeln('shops found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else
begin
writeln('could not find shops');
TerminateScript;
end;
FreeBitmap(sh);
end;
procedure forums;
var
f, x, y :integer; //f stands for forums bitmap
begin
f := LoadBitmaps(6);
if FindBitmap(f, x, y) then
begin
writeln('forums found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else
begin
writeln('could not find forums');
TerminateScript;
end;
FreeBitmap(f);
end;
procedure world;
var
w, x, y :integer; //w stands for world bitmap
begin
w := LoadBitmaps(7);
if FindBitmap(w, x, y) then
begin
writeln('world found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else
begin
writeln('could not find world');
TerminateScript;
end;
FreeBitmap(w);
end;
procedure games;
var
g, x, y :integer; //g stands for games bitmap
begin
g := LoadBitmaps(8);
if FindBitmap(g, x, y) then
begin
writeln('games found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else
begin
writeln('could not find games');
TerminateScript;
end;
FreeBitmap(g);
end;

var
t : integer; //time to wait for page to load
begin
t := 5000;
ClearDebug;
SetupSRL;
OpenWebPage('http://www.gaiaonline.com');
wait(t);
glogin;
wait(t);
getdaily;
wait(t);
mygaia;
wait(t);
getdaily;
wait(t);
shops;
wait(t);
getdaily;
wait(t);
forums;
wait(t);
getdaily;
wait(t);
world;
wait(t);
getdaily;
wait(t);
games;
wait(t);
getdaily;
writeln('script is done!!!');
end.

Coh3n

2009-12-06 00:21:40

Not too bad for your first script, and I'm glad you used my tutorial. :smile: Although, I don't think you read the 'Standards' part of it. I've fixed your standards here:

{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Gaiadaily |
| Version: beta |
| Scriptkitty |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| what it does: |
| logs into gaia, gets your daily chances for the day |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Setup: put your user name and password in line 60 and 61 |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Notes: Please let me know if you have any suggestions |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}
program gaiadaily;
{.include SRL/SRL.scar}

function LoadBitmaps(Which: Integer): Integer; //LoadBitmaps function from Coh3n
begin
case Which of
0: Result := BitmapFromString(26, 2, 'beNpNjuEKgDAIhN//IbM2KmirH' +
'4u5li7MLagE5TyPDy+RKw49rMjyVnN8pEeYye14cKF8kkhZLID1VJ' +
'iIT9z6mmROHgBC1js2WvnR0KgTKz8Fpxqg07azy5xGXavzzUlfqTS' +
'TbigKkXc='); //username

1: Result := BitmapFromString(27, 2, 'beNodjVsOwyAMBO9/yBiIQpPSC' +
'BUQLzuYuuzXaqWZ7ahhcwnnnMw8qN0vBcrUMcOlAMDH0lv5nFrG/A' +
'y3gzpcRczBAWzWlzmKVmDviNj8ZQTZhfujK6u8v1X8rcRU5IiJMPl' +
'zCR8Rgj58SB2pNyTiyVmExrqUKz3Yfr5WlkM='); //password

2: Result := BitmapFromString(19, 2, 'beNr79qO7u2fbth0MDAxAxs+f' +
'f4AIyHZzd4ewIQgoBRQEKkOWBQqeOXMGyM3KygZyX79+A5H69u0HH' +
'ME1/v37DyoLAJwdRBY='); //login

3: Result := BitmapFromString(10, 1, 'beNpz9fr/yx+IfF0D640s' +
'gWhxaGSDrWOIhkSupm4PANerDAk=');//gaiadailydrawing

4: Result := BitmapFromString(21, 2, 'beNr7/9+3cOJ/MPAtmgRlFE4' +
'CIr+iiQipwolA7n8Y8AMrACIg27ugHyKIzIAjhEg+CCErALEANXZY' +
'Yg=='); //mygaia

5: Result := BitmapFromString(18, 2, 'beNr7/z+gZIp/yWQg+R8GgFwI' +
'Ay4IUYMm6Fc00bdoEpRdOMm3EMr2LZwIZwDVQNlABgA2SlEB'); //Shops

6: Result := BitmapFromString(18, 1, 'beNr7/x8OfAsnwhl+RTA2nFE' +
'4CSgIVQMAxTsqDw=='); //forums

7: Result := BitmapFromString(16, 3, 'beNrL6/UtmvgfDHwLJ8EYE/3g' +
'gkVQQb/CSb5g5F3QDxGBM3wK+hGC+QhZbyRxr7xeIIJK5fXA2V75v' +
'cgKvABmkGa0'); //Wolrd

8: Result := BitmapFromString(15, 2, 'beNor6PcrmvgfBnwLJwK5vkWT' +
'/iMB38JJcFnvgn4ggnBB7HwEG43hAwDZL0O1'); //Games

9: Result := BitmapFromString(15, 2, 'beNrrP+jSf/A/KoCIIJNoU' +
'riUocgCAHcuS40='); //ok button
else
Writeln('Invalid Bitmap Selection.');
end;
end;

procedure glogin; //gaia login sequence
var
username, password, login, x, y, x1, y1, x2, y2 : Integer;
u, p : String;
begin
username := LoadBitmaps(0);
password := LoadBitmaps(1);
login := LoadBitmaps(2);
u := ''; //Put username here between ''
p := ''; //Put Password here between ''
wait(8000);

if FindBitmap(username, x, y) then //looks for the username bitmap
begin
writeln('username found');
Mouse(x, y, 4, 4, True);
wait(500);
TypeKeys(u);
end else

if FindBitmap(username, x, y) then
begin
writeln('username found on the secound try');
Mouse(x, y, 4, 4, True);
wait(500);
TypeKeys(u);
end else

begin
writeln('still could not find... terminating script')
writeln('you might need to adjust the wait time in line 48');
TerminateScript;
end;

if FindBitmap(password, x1, y1) then
begin
Writeln('password found');
Mouse(x1, y1, 4, 4, True);
wait(500);
TypeKeys(p);
end else
begin
writeln('could not find password');
TerminateScript;
end;

if FindBitmap(login, x2, y2) then
begin
Writeln('login button found');
Mouse(x2, y2, 4, 4, True);
wait(500);
writeln('login to gaia online successful');

// You should free these bitmaps at the end of the procedure, just before the last 'end;'
FreeBitmap(username);
FreeBitmap(password);
FreeBitmap(login);
end else
begin
writeln('could not find login button');
TerminateScript;
end;
end;

procedure getdaily; //finds the daily chance and clicks it)
var
daily, ok, x, y, x1, y1 : Integer;
begin
daily := LoadBitmaps(3);
ok := Loadbitmaps(9);
wait(5000);

if FindBitmap(daily, x, y) then
begin
writeln('daily chance found');
Mouse(x, y, 4, 4, True);
end else

// You don't need a begin..end nest here when you only have one line of code to execute.
begin
writeln('no daily chance found, did you do it already today?');
end;
wait(7000);

if FindBitmap(ok, x1, y1) then
begin
writeln('ok button found');
Mouse(x1, y1, 4, 4, True);
end else

begin
writeln('adjust the wait time in line getdaily but ignore if no daily chance found');
end;
end;


procedure mygaia;
var
mg, x, y :integer; //mg stands for mygaia bitmap
begin
mg := LoadBitmaps(4);

if FindBitmap(mg, x, y) then
begin
writeln('mygaia found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else

begin
writeln('could not find mygaia');
TerminateScript;
end;
FreeBitmap(mg);
end;

procedure shops;
var
sh, x, y :integer; //sh stands for shops bitmap
begin
sh := LoadBitmaps(5);

if FindBitmap(sh, x, y) then
begin
writeln('shops found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else

begin
writeln('could not find shops');
TerminateScript;
end;
FreeBitmap(sh);
end;

procedure forums;
var
f, x, y :integer; //f stands for forums bitmap
begin
f := LoadBitmaps(6);

if FindBitmap(f, x, y) then
begin
writeln('forums found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else

begin
writeln('could not find forums');
TerminateScript;
end;
FreeBitmap(f);
end;

procedure world;
var
w, x, y :integer; //w stands for world bitmap
begin
w := LoadBitmaps(7);

if FindBitmap(w, x, y) then
begin
writeln('world found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else

begin
writeln('could not find world');
TerminateScript;
end;
FreeBitmap(w);
end;

procedure games;
var
g, x, y :integer; //g stands for games bitmap
begin
g := LoadBitmaps(8);

if FindBitmap(g, x, y) then
begin
writeln('games found');
Mouse(x, y, 4, 4, True);
wait(5000);
end else

begin
writeln('could not find games');
TerminateScript;
end;
FreeBitmap(g);
end;

var
t : integer; //time to wait for page to load
begin
t := 5000;
ClearDebug;
SetupSRL;
OpenWebPage('http://www.gaiaonline.com');
wait(t);
glogin;
wait(t);
getdaily;
wait(t);
mygaia;
wait(t);
getdaily;
wait(t);
shops;
wait(t);
getdaily;
wait(t);
forums;
wait(t);
getdaily;
wait(t);
world;
wait(t);
getdaily;
wait(t);
games;
wait(t);
getdaily;
writeln('script is done!!!');
end.
A few things I would suggest are:
  • Using constants to enter your username and password, that way they're at the beginning of the script.
  • Your last few procedures are almost identical. I would suggest combining them into one, and add the necessary parameters and cases, similar to how the FindBitmap function is setup. That way, you can choose which one of the 3 procedures you want to load without having a bunch of different procedures. In other words, you don't have to have repeating code.
  • You don't need a begin..end nest after an if..then..else statement if you're executing only one line of code. SCAR will do one line regardless of a begin..end nest.
I hope that helped you a little. Keep up the good work and you'll be an expert scripter in no time. :smile:

Cheers,

Coh3n

scriptkitty

2009-12-06 17:35:33

Thank you that helps a lot, yeah i did skip over the standards part.
how would i combine them all into one, the way that im thinking of will have the same amount of identical coding as before. how would i be able to call a case and have that case call a case of the same case number. So when i call the case it will also call the LoadBitMaps case that would go with it

Coh3n

2009-12-06 17:47:05

From: scriptkitty
Thank you that helps a lot, yeah i did skip over the standards part.
how would i combine them all into one, the way that im thinking of will have the same amount of identical coding as before. how would i be able to call a case and have that case call a case of the same case number. So when i call the case it will also call the LoadBitMaps case that would go with it

Lol that was one confusing question, but I think I understood it. :tongue:

You would make it something like the following. I tried explaining the best I could, so if you have any questions, don't be afraid to ask. :smile:

{
Notice the different parameters -
findWhat is a string, so you would put something like 'mygaia' or 'shops'

whichBitmap is an integer, so you would put the integer that corresponds to the
bitmap in LoadBitmaps.
}
function FindWhatever(findWhat: String; whichBitmap: Integer): Boolean;
var
Bitmap, x ,y: Integer;
begin
// This loads the desired Bitmap, depending on what you assign as the whichBitmap parameter.
Bitmap := LoadBitmaps(whichBitmap);

{
Notice the 'Result' variable being used. Since the function returns a Boolean, it will
result true if the Bitmap is found.
}
Result := FindBitmap(Bitmap, x, y);
if Result then
begin
{
Notices how i used findWhat, so it will tell you what you found depending on
what you put for the findWhat parameter.
}
Writeln(findWhat + 'found');
Mouse(x, y, 4, 4, True);
Wait(5000);
end else

begin
Writeln('could not find ' + findWhat);// Again, used the findWhat parameter.
TerminateScript;
end;

FreeBitmap(Bitmap);
end;
And what it should look like without all my annoying comments.

function FindWhatever(findWhat: String; whichBitmap: Integer): Boolean;
var
Bitmap, x ,y: Integer;
begin
Bitmap := LoadBitmaps(whichBitmap);

Result := FindBitmap(Bitmap, x, y);
if Result then
begin
Writeln(findWhat + 'found');
Mouse(x, y, 4, 4, True);
Wait(5000);
end else

begin
Writeln('could not find ' + findWhat);
TerminateScript;
end;

FreeBitmap(Bitmap);
end;

Cheers,

Coh3n

scriptkitty

2009-12-06 23:59:54

That helped a lot. This is the Redone version of my beta
Is it okay that i did not free the bitmap used in GetDaily? I thought it was okay because i use that procedure over and over in the script.
{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| GaiaDaily |
| Version: beta.2 |
| Scriptkitty |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| what it does: |
| logs into gaia, gets your daily chances for the day |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Setup: put username and password in the constants and adjust the t for best performance with your internet speed |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>]
| Notes: Please let me know if you have any suggestions. Thank you coh3n for your help in writing this script |
[<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}
program gaiadaily;
{.include SRL/SRL.scar}
const
username = ''; //username
password = ''; //password
t = 5000; //time to wait for page to load

function LoadBitmaps(Which: Integer): Integer; //LoadBitmaps function from Coh3n
begin
case Which of
0: Result := BitmapFromString(26, 2, 'beNpNjuEKgDAIhN//IbM2KmirH' +
'4u5li7MLagE5TyPDy+RKw49rMjyVnN8pEeYye14cKF8kkhZLID1VJ' +
'iIT9z6mmROHgBC1js2WvnR0KgTKz8Fpxqg07azy5xGXavzzUlfqTS' +
'TbigKkXc='); //username

1: Result := BitmapFromString(27, 2, 'beNodjVsOwyAMBO9/yBiIQpPSC' +
'BUQLzuYuuzXaqWZ7ahhcwnnnMw8qN0vBcrUMcOlAMDH0lv5nFrG/A' +
'y3gzpcRczBAWzWlzmKVmDviNj8ZQTZhfujK6u8v1X8rcRU5IiJMPl' +
'zCR8Rgj58SB2pNyTiyVmExrqUKz3Yfr5WlkM='); //password

2: Result := BitmapFromString(19, 2, 'beNr79qO7u2fbth0MDAxAxs+f' +
'f4AIyHZzd4ewIQgoBRQEKkOWBQqeOXMGyM3KygZyX79+A5H69u0HH' +
'ME1/v37DyoLAJwdRBY='); //login

3: Result := BitmapFromString(10, 1, 'beNpz9fr/yx+IfF0D640s' +
'gWhxaGSDrWOIhkSupm4PANerDAk=');//gaiadailydrawing

4: Result := BitmapFromString(21, 2, 'beNr7/9+3cOJ/MPAtmgRlFE4' +
'CIr+iiQipwolA7n8Y8AMrACIg27ugHyKIzIAjhEg+CCErALEANXZY' +
'Yg=='); //mygaia

5: Result := BitmapFromString(18, 2, 'beNr7/z+gZIp/yWQg+R8GgFwI' +
'Ay4IUYMm6Fc00bdoEpRdOMm3EMr2LZwIZwDVQNlABgA2SlEB'); //Shops

6: Result := BitmapFromString(18, 1, 'beNr7/x8OfAsnwhl+RTA2nFE' +
'4CSgIVQMAxTsqDw=='); //forums

7: Result := BitmapFromString(16, 3, 'beNrL6/UtmvgfDHwLJ8EYE/3g' +
'gkVQQb/CSb5g5F3QDxGBM3wK+hGC+QhZbyRxr7xeIIJK5fXA2V75v' +
'cgKvABmkGa0'); //Wolrd

8: Result := BitmapFromString(15, 2, 'beNor6PcrmvgfBnwLJwK5vkWT' +
'/iMB38JJcFnvgn4ggnBB7HwEG43hAwDZL0O1'); //Games

9: Result := BitmapFromString(15, 2, 'beNrrP+jSf/A/KoCIIJNoU' +
'riUocgCAHcuS40='); //ok button
else
Writeln('Invalid Bitmap Selection.');
end;
end;

procedure GaiaLogin; //gaia login sequence
var
u, p, login, x, y, x1, y1, x2, y2 : Integer;
begin
u := LoadBitmaps(0);
p := LoadBitmaps(1);
login := LoadBitmaps(2);
wait(8000);

if FindBitmap(u, x, y) then //looks for the username bitmap
begin
writeln('username found');
Mouse(x, y, 4, 4, True);
wait(500);
TypeKeys(username);
end else

if FindBitmap(u, x, y) then
begin
writeln('username found on the secound try');
Mouse(x, y, 4, 4, True);
wait(500);
TypeKeys(username);
end else

begin
writeln('still could not find... terminating script')
writeln('you might need to adjust the wait time in line 48');
TerminateScript;
end;

if FindBitmap(p, x1, y1) then
begin
Writeln('password found');
Mouse(x1, y1, 4, 4, True);
wait(500);
TypeKeys(password);
end else
begin
writeln('could not find password');
TerminateScript;
end;

if FindBitmap(login, x2, y2) then
begin
Writeln('login button found');
Mouse(x2, y2, 4, 4, True);
wait(500);
writeln('login to gaia online successful');
end else
begin
writeln('could not find login button');
TerminateScript;
end;
FreeBitmap(u);
FreeBitmap(p);
FreeBitmap(login);
end;

procedure GetDaily; //finds the daily chance and clicks it)
var
daily, ok, x, y, x1, y1 : Integer;
begin
daily := LoadBitmaps(3);
ok := Loadbitmaps(9);
wait(5000);

if FindBitmap(daily, x, y) then
begin
writeln('daily chance found');
Mouse(x, y, 4, 4, True);
end else

writeln('no daily chance found, did you do it already today?');
wait(7000);

if FindBitmap(ok, x1, y1) then
begin
writeln('ok button found');
Mouse(x1, y1, 4, 4, True);
end else

begin
writeln('adjust the wait time in line getdaily but ignore if no daily chance found');
end;
end;

function FindWhatever(findWhat: String; whichBitmap: Integer): Boolean; //Coh3n came up with this to simplify my code
var
Bitmap, x ,y: Integer;
begin
Bitmap := LoadBitmaps(whichBitmap);

Result := FindBitmap(Bitmap, x, y);
if Result then
begin
Writeln(findWhat + ' found');
Mouse(x, y, 4, 4, True);
Wait(5000);
GetDaily;
end else

begin
Writeln('could not find ' + findWhat);
TerminateScript;
end;

FreeBitmap(Bitmap);
end;

begin
ClearDebug;
SetupSRL;
OpenWebPage('http://www.gaiaonline.com');
wait(t);
GaiaLogin;
wait(t);
GetDaily;
wait(t);
FindWhatever('Mygaia', 4);
wait(t);
FindWhatever('Shops', 5);
wait(t);
FindWhatever('Forums', 6);
wait(t);
FindWhatever('World', 7);
wait(t);
FindWhatever('Games', 8);
wait(t);
writeln('script is done!!!');
end.

Coh3n

2009-12-07 10:59:25

From: scriptkitty
That helped a lot. This is the Redone version of my beta
Is it okay that i did not free the bitmap used in GetDaily? I thought it was okay because i use that procedure over and over in the script.

Looks a lot better! :smile: Also, you should always free your bitmaps, no matter how many times you use them throughout the script.

scriptkitty

2009-12-07 23:05:09

thank you, i freed the bitmap in GetDaily but i felt no need in re uploading the script just for that little modification when it runs fine.

If you are familiar with gaia, what do you suggest i add to the script next?
I would start working on a script for rs but my computer will not run with the S.M.A.R.T. and my connection on rs breaks to much to work on a script and test it out.
My computer is about 15 years old if not older

Coh3n

2009-12-08 00:42:08

From: scriptkitty
thank you, i freed the bitmap in GetDaily but i felt no need in re uploading the script just for that little modification when it runs fine.

If you are familiar with gaia, what do you suggest i add to the script next?
I would start working on a script for rs but my computer will not run with the S.M.A.R.T. and my connection on rs breaks to much to work on a script and test it out.
My computer is about 15 years old if not older

I' not familiar with Gaia. I don't even know what it is. Lol. I'd say as long as it works, you're good to go. Also, get a new computer! :tongue: