Chrisface
2006-05-29 03:51:09
I don't know if any of you play this game but it's one of those online universe things. This script isn't completley finished but functional so all it does right now is upgrades one building repeatedly.
It doesn't run smoothly at the moment because i've only been playing this game a few days and i'm still not familiar with the how the game functions. Sometimes i return to find its logged out or the game page itself has glitched and loaded itself again within it own frame. I will be adding login features and auto checking for errors in the page and so on so that if something goes wrong it start up again. This is only just the start remember but i want to make sure i don't get pruned and show that i'm actually doing some work for the people here.
Post comments please :)
program ReadText;
{.include NeopetsInclude.txt}
//#########Declaring Variables#############
//Mouse Co-ordinates
var x,y: Integer;
//Screen Resolution
var resX, resY : Integer;
//Font Variables
var UpgradeFont: Integer;
//Length And Breadth Of Building Table
var TableX, TableY: Integer;
var TempBuildingX, TempBuildingY: Integer;
//Misc Variables
var tab : Char;
//##############Procuedures###################
//Load The Fonts And Chars
procedure LoadFonts();
begin
UpgradeFont := loadCharsFromFont2('Courier New', 8, True, False, False, False);
//Set Tab Char
tab := Chr(9);
end;
//Scroll Down Webpage Procedure, 'scrollDellay' time to hold scroll button
procedure ScrollDown(scrollDelay: Integer);
Begin
if(FindBitMapIn(Scroll_Down_Button,x,y,0,0,resX,resY))then
Begin
HoldMouse(x,y,true);
wait(scrollDelay);
ReleaseMouse(x,y,true);
end;
end;
//Scroll Up Webpage Procedure, 'scrollDellay' time to hold scroll button
procedure ScrollUp(scrollDelay: Integer);
Begin
if(FindBitMapIn(Scroll_Up_Button,x,y,0,0,resX,resY))then
Begin
HoldMouse(x,y,true);
wait(scrollDelay);
ReleaseMouse(x,y,true);
end;
end;
//Refreshes The Buildings Page
procedure RefreshBuildings();
Begin
if(IsTextInAreaEx(0, 0, resX, resY, x, y, 'Buildings', 0, UpgradeFont, False, False, 0, 0, 15921906))then
begin
ClickMouse(x+10,y+10,True);
end;
end;
//If Finished Building Clicks Continue
function TryFinish(): Boolean;
Begin
if(IsTextInAreaEx(0, 0, resX, resY, x, y, 'Continue', 0, UpgradeFont, False, False, 0, 0, 16509926))then
begin
writeln('Completed Upgrade');
ClickMouse(x+10,y+10,True);
result := true;
end
else
result := false;
end;
//Finds The Upgrade Button
function TryUpgrade(OriginX, OriginY, AddX, AddY: Integer): boolean;
Begin
if(IsTextInAreaEx(OriginX, OriginY, OriginX+AddX, OriginY+AddY, x, y, 'upgrade', 0, UpgradeFont, False, False, 0, 0, 65280))then
begin
//Building Is Ready To Upgrade!
result := true;
writeln('Upgrade Available');
ClickMouse(x+10,y+10,True);
//Loop Until Finished
while (not TryFinish()) do
Begin
//Wait(1000);
wait(random(1800));
end;
end
else
//Building Isn't Ready To Be Upgraded
result := false;
end;
//Finds A Building
procedure FindBuilding(Building: String);
begin
if(IsTextInAreaEx(0, 0, resX, resY, x, y, Building, 0, UpgradeFont, False, False, 0, 0, 16509926))then
begin
TempBuildingX := x;
TempBuildingY := y;
writeln('Found The ' + Building);
end
end;
//Main Program
begin
resX := 1280;
resY := 1024;
TableX := 395;
TableY := 125;
LoadFonts();
//How many times you want to upgrade the building
for i:= 1 to 15 do
begin
//Find The Building You Want
FindBuilding('Solar Plant');
//Try And Upgrade It (Searches Text Within Buildings Section Of Table)
while (not TryUpgrade(TempBuildingX,TempBuildingY,TableX,TableY)) do
begin
MoveMouse(100,100);
wait(100);
RefreshBuildings();
writeln('Waiting For Resources');
//Wait(1000);
//How long to wait before refreshing page to check resources
Wait(random(1800*1000));
end;
end;
end.
It doesn't run smoothly at the moment because i've only been playing this game a few days and i'm still not familiar with the how the game functions. Sometimes i return to find its logged out or the game page itself has glitched and loaded itself again within it own frame. I will be adding login features and auto checking for errors in the page and so on so that if something goes wrong it start up again. This is only just the start remember but i want to make sure i don't get pruned and show that i'm actually doing some work for the people here.
Post comments please :)