PDA

View Full Version : Newbie script in progress (perfect-tuning.nl bot)



DarkSeplep
04-19-2012, 04:29 PM
Hey im very new to creating bots and stuff.
So i started with trying to make a bot script for a text based game to learn a bit more about this whole thing.

The script is far from done, so far i only been able to make a login but im proud that i came this far already after just 1 day and reading loads of tuts.
So i will be sharing my progress here for tips or other methods to do stuff since im a complete newb to this.

Feel free to comment on my work in progress and give hints, please dont flame on my work instead tell me how i should do it if u feel like telling me.

This is what i got so far.


program Perfecttuning;

var
Debug:boolean;

x, y, w, h:integer;
//DTM
DTMPorcheYellow1, DTMPorcheYellow2:integer;

//Bitmaps
LoginButton, PasswordField, UsernameField, WrongPassword:integer;





const
//Login Details here
//**********************
LoginName = 'UserName'; //Here goes your login name
LoginPassword = 'PassWord'; //Here goes your login password
//**********************


procedure UserLogin;

Begin

If FindBitmap (UsernameField, x, y) then
begin
writeln ('Found Username Field');
MoveMouse (x + 38, y + 11);
ClickMouse (x, y, 1);
Wait (RandomRange (500, 1000));
SendKeys (LoginName, 50);
Wait (RandomRange(500, 1500))
end else
begin
writeln ('Cant find Username field');
exit;
end;

If FindBitmap (PasswordField, x, y) then
Begin
writeln ('Found Password Field');
MoveMouse (x + 42, y + 9);
ClickMouse (x, y, 1);
SendKeys (LoginPassword, 50);
Wait (RandomRange(500, 1500))
end else
begin
writeln ('Cant find Password field');
exit;
end;

if FindBitmap (LoginButton, x, y) then
begin
writeln ('Found login button');
MoveMouse (x + 36, y + 26);
ClickMouse (x, y, 1);
wait (RandomRange(500, 1500))
end else
begin
writeln ('Cant find login button');
exit;
end;

If FindBitmap (WrongPassword, x, y) then
begin
writeln ('Wrong Username or Password entered check your settings');
PressKey (8);
end;

end;

procedure init;
begin
ActivateClient;
GetClientDimensions (w, y);
writeln (IntToStr(w)+ '/' + IntToStr(h));
end;

procedure Starting;
begin

end;
procedure mMouse (x, y:integer);
begin
MoveMouse (x, y);
ClickMouse (x, y, 1);
end;

procedure mWait (time: integer);
var
Start: integer;
begin
Start :=GetSystemTime;
while (GetSystemTime < (Start + Time)) do
if (IsKeyDown(54)) then
begin
writeln ('Stopping script');
TerminateScript;
end;

end;

Procedure ScrollDown ;

begin
mMouse (5, 5); //Moves mouse to corner of webpage and clicks to make sure i dont have a dropdown window open.
ScrollMouse (5, 5, -8);
mWait (100);
end;

procedure Msg (Message: string);
begin
if Debug then writeln (message);
end;
{
Procedure FindCar;
begin
if FindDTM (DTMPorcheYellow1, x, y, 173, 73, 870, 310) then
FindDTM (DTMPorcheYellow2, x, y, 173, 315, 870, 415) then
begin




end;
}
procedure LoadDTM;
begin
DTMPorcheYellow1 := DTMFromString('mbQAAAHicY2VgYHjKxMDAyszAcAFI8wDpA0 Cag5GBQQqIlYCYAYhFgLi8qY1hYRMXg5oiB4O+oRHDtl37GLAB RiwYDABXxgi1');
DTMPorcheYellow2 := DTMFromString('mggAAAHicY2NgYOBkZmB4wsTA4A2k5YBYiR nCzmRkYOgH4mYgngzEyUCcAMTzNm5gOLYxnWHylCkMj0/4M1RXFjPEJaUw4AKMODAEAACSYA7V');




end;

procedure LoadBitmaps;
begin
UsernameField := BitmapFromString(76, 23, 'meJzdjskKwkAQRF2uIm6oSMCNoEhEcclFFBFE8/8fFMHBoempxElOoZp3eOlUF5PEzYSd95mf15Gf54Gfx75Bz33H z22LSb+jXC5z8lXjGmHMm133yVeNywaT/sa6FBWAv2RG/s26heOeyKUn8aoOsYXWi0qWw83fExjw5BRiTJUV6VJUXu3lp+u wDXrqTNazIYclxlRZkS5F5WVYxXJK/E/KsZtjTK3yQlKi5O+Jck+iKcZUKXeXbiY/r259YvCkEOuAn3DCz2Jco2c25CcY8DPp8TPq8NNv89Nt8fMB4A 9bdw==');
PasswordField := BitmapFromString(84, 19, 'meJzlkNkKwkAMRV1+QERUSsGNokilUsUXsYgg/f8v0oeBIU5uYjdQiJyH5CTcSS1Pw9Iqz9wuj+PALPfMLsUB8Pr 8wZ0f0tVVtxTgwnn9J3R10nUPcOFS7VtqdBnUSnJFQ59rzGXb5 7jw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qpOYgFGFQhLZilT5vwW8JFDhUDerGyck7w p9gfPLBCWnE2/y6UYh7AvvP6FxapsHRyTU1MuFMu5EYopWbNA1kQ5O8A72d0y67 KYZajQ19gCQEbZZd/fTF7ZF1I/DsiMedi6LzA1NWH+lMF9Z3EuGTEA8tVYOT4/w7f37tv1vx/GAuCZ9Rs8V5Uv7dq36/8s2iAhmiMLiObIAqI5soBojiwgmiMLiObIAqI5soBoDrDA2hsx vGviRZywiexdVTiq2a6Go8Tc+efq+Cs9wf+y9MK+CFlgwHHL9i xNNXSIBcSD7L/bA7vFmD1L261K/JYwPvj27qDTbCqUUW7qhqfl7rIRDakRAzZ3YZFYycMC98+nF7Y H/nofy0xZIJs1c4Xx0VHBzUVzazkUiMAEz07D1k2c0NSzIn2ELMm 3qe5t0oHQAjgBzPJoINMvjMzLAMelbCYUKD8bygsrhyWr6I9JJ SNJ9bF5BDwzv1X+j0kL4JzcXuejvc0Cpc6sIVNmNhRTeOopEJb ZYwHTUHMLDG72y6UsuxIWyI7JKZ5aNslQoPxU4pGqpiyQPZiwE sYCego8KNefcPxxhpDrpAmFg4diQEdmQ/nyfJfDJrJ2w8+wepn8CxYYya/DfdCrMUOz+ReywB+Xi13Yfw/zay/582nV70AWEM2RBURzZAHRnP8vTjc5');

end;

procedure FreeMemory;
begin

//Bitmaps
FreeBitmap (Loginbutton)
FreeBitmap (PasswordField)
FreeBitmap (UsernameField)
FreeBitmap (WrongPassword)

//DTM
FreeDTM (DTMPorcheYellow1)
FreeDTM (DTMPorcheYellow2)


end;
begin
LoadBitmaps;
UserLogin;
Wait(15000)
FreeMemory;
end.

Updates:

attention!

Only working part is the login part of the script.
Since im still working on the other parts just updated this one with some cleaning and some procedures that i didnt activate yet since they are still work in progress.

Login part is still the old method i used maby i will change that in the future for now i leave it as it is, since its the only working part.

I did allot of reading and tutorials thats also why i made so little progress but i think i can make good progress now.
I hope to release some more functions maby even a stable loop in a day or 2.

momotron
04-19-2012, 08:47 PM
Good luck with this and keep at it, hopefully if I have time later I will be able to give you some feedback.

DarkSeplep
04-20-2012, 04:50 PM
Oke cool Thanks.

As i said in my main post, i will be completing this script , it will just take some time since im a complete newb and i posted this here to show my progress.
And get comments on my work.

Shatterhand
04-21-2012, 04:57 AM
You should add SRL include and use functions like MouseBox() or Mouse() instead of MoveMouse (x + 19, y + 12);

trying to figure out how i can do some other stuff like repeating some procedures after x amount of time or something like that.
Use something like this

done := False;
repeat
...
if ... then
done := True;
until done
Also try to use DTMs instead of bitmaps. A lot faster and use less resources. A great tutorial:
http://villavu.com/forum/showthread.php?t=73524
Good luck! :)

DarkSeplep
04-21-2012, 10:24 AM
Thanks, i didnt use SRL so far since its mainly for runescape.
And maby im asking a bit to much of myself since im a complete newb in this stuff but also wanted to be able to make for example those mouse functions myself instead of calling them from a SRL script.

By doing this myself i think i will get a much greater understanding of what my code does, and also gives me a headstart if i ever run into a problem with using SRL so that i will be able to make my own workarounds if SRL doesnt support or or whatever.
But like i said, maby its a bit to much asked for a noob like me :D

I will be checking out DTMs for sure, already read a TUT about it and will read the one you posted also.

Biggest problem i ran into is that there are not much tuts on stuff without runescape for simba wich is kinda wierd since simba is so much more powerfull.

Im looking now for a method to let the script check if im already logged in or not, i know this is in SRL, but i want to make it myself but just havent found some 1 explaining this yet.

Thanks for your input hunt3rx3 i will be checking this out for sure, since i think i will be needing that allot.