SRL Archive - Other Scripts

http://www.ogame.org/ Bot


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.


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 :)

XxKanexX

2006-05-29 06:44:14

We need the Neopets Include that you have to run it ;)

Chrisface

2006-05-29 09:17:05

Oops… You don't actually need that include at the moment it just contains the bitmaps for the "scroll up" and "scroll down" procedures which will be diferent for every user depending on whether they use IE or Mozilla or Opera or even if they're using any skins. They can be removed :) Is there a diferent way to scroll up and down other than the method i was using?

Just incase you want the neopets include here it is:


var
//######------------------Declaring Vars--------------------######

//############Menu Bar Vars############
menuExplore_X, menuExplore_Y : Integer;
menuGames_X, menuGames_Y : Integer;
menuShops_X, menuShops_Y : Integer;
menuLogin_X, MenuLogin_Y : Integer;
MenuLogout_X, MenuLogout_Y : Integer;

//###########World Locations############
FaerieLand_X, FaerieLand_Y : Integer;
LostDesert_X, LostDesert_Y : Integer;
HauntedWoods_X, HauntedWoods_Y : Integer;
NeopiaCentral_X, NeopiaCentral_Y : Integer;
Meridell_X, Meridell_Y : Integer;
Tyrannia_X, Tyrannia_Y : Integer;
Maraqua_X, Maraqua_Y : Integer;
MysteryIsland_X, MysteryIsland_Y : Integer;
KrawkIsland_X, KrawkIsland_Y : Integer;
VirtupetsStation_X, VirtupetsStation_Y : Integer;
TerrorMountain_X, TerrorMountain_Y : Integer;
Kreludor_X, Kreludor_Y : Integer;

//############Login Pages Vars############
UserNameBox_X, userNameBox_Y : Integer;
loginButton_X, loginButton_Y : Integer;
passwordBox_X, passwordBox_Y : Integer;
passwordButton_X, passwordButton_Y : Integer;

//############Stock Markey Page###########
goBuyStocks_X, goBuyStocks_Y : Integer;
goPortfolio_X, goPortfolio_Y : Integer;
goListStocks_X, goListStocks_Y : Integer;

//###########Bitmap Vars##################

//Stock Market Image Bitmap
Stock_Market : Integer;

//Scroll button Bitmaps
Scroll_Down_Button, Scroll_Up_Button : Integer;

//#########Company Stock Variables(Collection Of All Stocks)########
Type Stock = record
Name: String;
Abbrev: String;
Open: Integer;
Cur: Integer;
Change: Extended;
end;

var Company: array [0..42] of Stock; //List Of All Stocks
var CheapStocks: array [0..9] of Stock; //CheapStocks (price = 15NP)

//Current Company
var i: Integer;

//############Misc Vars###################
rightDiaDelete_X, rightDiaDelete_Y :Integer;
refreshWait: Integer;

//Something Has Happened Message
RandomOffset : Integer;

//######--------------------Functions----------------------######

//Log In User When At Login Screen
Procedure loginUser(username,password: String);
Begin
//Delete Text From Last Login
ClickMouse(UserNameBox_X,userNameBox_Y,false);
wait(500);
ClickMouse(UserNameBox_X+rightDiaDelete_X,userNameBox_Y+rightDiaDelete_Y,true);
wait(500);

//Enter UserName
SendKeys(username);
wait(500);

//Click Login button
ClickMouse(loginButton_X,loginButton_Y,true);
wait(refreshWait);

//Enter Password
ClickMouse(passwordBox_X,passwordBox_Y,true);
wait(500);
SendKeys(password);
wait(1000);
ClickMouse(passwordButton_X,passwordButton_Y, true);
wait(refreshWait);
end;

//---------------Menu Bar Functions--------------------
//Clicks Explore On Menu Bar
procedure menuExplore();
Begin
ClickMouse(menuExplore_X,menuExplore_Y,true);
wait(refreshWait);
end;

//Clicks Games On Menu Bar
procedure menuGames();
Begin
ClickMouse(menuGames_X,menuGames_Y,true);
wait(refreshWait);
end;

//Clicks Shops On Menu Bar
procedure menuShops();
Begin
ClickMouse(menuShops_X,menuShops_Y,true);
wait(refreshWait);
end;

//Clicks Login On Menu Bar
procedure menuLogin();
Begin
ClickMouse(menuLogin_X,menuLogin_Y,true);
wait(refreshWait);
end;

//Clicks Logout On Menu Bar
procedure menuLogout();
Begin
ClickMouse(menuLogout_X,menuLogout_Y,true);
wait(RefreshWait);
end;

//-----------Explore Functions---------

//Clicks Faerie Land
procedure GoFaerieLand();
Begin
ClickMouse(FaerieLand_X,FaerieLand_Y,True);
wait(RefreshWait);
end;

//Clicks Lost Desert
procedure GoLostDesert();
Begin
ClickMouse(LostDesert_X,LostDesert_Y,True);
wait(RefreshWait);
end;

//Clicks Haunted Woods
procedure GoHauntedWoods();
Begin
ClickMouse(HauntedWoods_X,HauntedWoods_Y,True);
wait(RefreshWait);
end;

//Clicks Neopia Central
procedure GoNeopiaCentral();
Begin
ClickMouse(NeopiaCentral_X,NeopiaCentral_Y,True);
wait(RefreshWait);
end;

//Clicks Meridell
procedure GoMeridell();
Begin
ClickMouse(Meridell_X,Meridell_Y,True);
wait(RefreshWait);
end;

//Clicks Tyrannia
procedure GoTyrannia();
Begin
ClickMouse(Tyrannia_X,Tyrannia_Y,True);
wait(RefreshWait);
end;

//Clicks Maraqua
procedure GoMaraqua();
Begin
ClickMouse(Maraqua_X,Maraqua_Y,True);
wait(RefreshWait);
end;

//Clicks Mystery Island
procedure GoMysteryIsland();
Begin
ClickMouse(MysteryIsland_X,MysteryIsland_Y,True);
wait(RefreshWait);
end;

//Clicks Krawk Island
procedure GoKrawkIsland();
Begin
ClickMouse(KrawkIsland_X,KrawkIsland_Y,True);
wait(RefreshWait);
end;

//Clicks Virtupets Station
procedure GoVirtupetsStation();
Begin
ClickMouse(VirtupetsStation_X,VirtupetsStation_Y,True);
wait(RefreshWait);
end;

//Clicks Terror Mountain
procedure GoTerrorMountain();
Begin
ClickMouse(TerrorMountain_X,TerrorMountain_Y,True);
wait(RefreshWait);
end;

//Clicks Kreludor
procedure GoKreludor();
Begin
ClickMouse(Kreludor_X,Kreludor_Y,True);
wait(RefreshWait);
end;


//--------------Daily Events Functions-----------

//Visits Healing Fairy
procedure visitHealingFairy();
Begin
//Click Explore
menuExplore();

//Go To Faerie Land
GoFaerieLand();

//Click Healing Springs
ClickMouse(330,850,true);
wait(RefreshWait);

//Click BUTTON using find text
ClickMouse(435,670,true);
wait(RefreshWait);
end;

//Grabs Omelette
procedure GetOmelette();
Begin
//Click Explore
menuExplore();

//Go To Tyrannia
GoTyrannia();

//Click Tyrannian Plateau
ClickMouse(630,430,true);
wait(RefreshWait);

//Click Giant Omelette
ClickMouse(230,720,true);
wait(RefreshWait);

//Click BUTTON using find text
ClickMouse(435,770,true);
wait(RefreshWait);
end;

//Visits Coltazan's Shrine
procedure visitColtazan();
Begin
//Click Explore
menuExplore();

//Go To Lost Desert
GoLostDesert();

//Click Coltazan's Shrine
ClickMouse(375,560,true);
wait(RefreshWait);

//Click BUTTON using find text
ClickMouse(440,960,true);
wait(RefreshWait);
end;

//Visits Tombola
procedure visitTombola();
Begin
//Click Explore
menuExplore();

//Go To Mystery Island
GoMysteryIsland();

//Click Tombola
ClickMouse(350,850,True);
wait(RefreshWait);

//Click BUTTON using find text

end;

//---------------Stock Page Functions------------

//Clicks buy stocks link
procedure goBuyStocks();
Begin
ClickMouse(goBuyStocks_X,goBuyStocks_Y,true);
wait(refreshWait);
end;

//Clicks my portfolio link
procedure goPortfolio();
Begin
ClickMouse(goPortfolio_X,goPortfolio_Y,true);
wait(refreshWait);
end;

//Clicks the list stocks link
procedure goListStocks();
Begin
ClickMouse(goListStocks_X ,goListStocks_Y,true);
wait(refreshWait);
end;


//---------Set Company Names And Abbreviations-------------
Procedure setCompanyNames();
Begin
//-----Set Names-----\\
Company[0].Name := 'Alien Aisha Vending Ltd.';
Company[1].Name := 'Achyfi Enterprises';
Company[2].Name := 'Brea';
Company[3].Name := 'Balthazars Faerie Bottling Inc.';
Company[4].Name := 'Buzz-A-Way Insect Removal';
Company[5].Name := 'Chia Steel Holdings';
Company[6].Name := 'Chiatech Password Security';
Company[7].Name := 'Confederation of Fish Lovers';
Company[8].Name := 'Cybun Electromatics';
Company[9].Name := 'Dice-A-Roo Industries PLC.';
Company[10].Name := 'EEEEEURGH!!! Ltd.';
Company[11].Name := 'Faerie Clothing Ltd.';
Company[12].Name := 'Fish Pops!';
Company[13].Name := 'Health Frog Groceries';
Company[14].Name := 'Hot';
Company[15].Name := 'Kau-Kau Farm';
Company[16].Name := 'Kor-Bat Cricket Supplies';
Company[17].Name := 'Kacheek and Sons Landscaping';
Company[18].Name := 'Lost Desert Scratchcards';
Company[19].Name := 'Lupe Consolidated';
Company[20].Name := 'Meridell Potato Company';
Company[21].Name := 'Mynci Banana Imports';
Company[22].Name := 'Nakron';
Company[23].Name := 'The National Neopian Bank';
Company[24].Name := 'PD Secure Storage';
Company[25].Name := 'Peophin Water Parks!';
Company[26].Name := 'Power-X Corp.';
Company[27].Name := 'Shoyrux Enterprises';
Company[28].Name := 'Skeith Bodyguards Inc.';
Company[29].Name := 'Skeith Feeding Ltd.';
Company[30].Name := 'The Smugglers Cove';
Company[31].Name := 'Super Splime Shakes';
Company[32].Name := 'Stuff';
Company[33].Name := 'Shop Wizard';
Company[34].Name := 'The Auction Genie';
Company[35].Name := 'The Neopian Auction House';
Company[36].Name := 'The Neopian Times';
Company[37].Name := 'Theme Park Entertainers Guild';
Company[38].Name := 'The Presidential Palace';
Company[39].Name := 'The Shoyru Company';
Company[40].Name := 'Unis Beauty Salon';
Company[41].Name := 'Virtupets';
Company[42].Name := 'Yippee!';

//----Set Abbreviations----\\
Company[0].Abbrev := 'AAVL ';
Company[1].Abbrev := 'ACFI ';
Company[2].Abbrev := 'BB ';
Company[3].Abbrev := 'BOTT ';
Company[4].Abbrev := 'BUZZ ';
Company[5].Abbrev := 'CHIA ';
Company[6].Abbrev := 'CHPS ';
Company[7].Abbrev := 'COFL ';
Company[8].Abbrev := 'CYBU ';
Company[9].Abbrev := 'DROO ';
Company[10].Abbrev := 'EEEEE';
Company[11].Abbrev := 'FAER ';
Company[12].Abbrev := 'FISH ';
Company[13].Abbrev := 'HELT ';
Company[14].Abbrev := 'HUW ';
Company[15].Abbrev := 'KAUF ';
Company[16].Abbrev := 'KBAT ';
Company[17].Abbrev := 'KSON ';
Company[18].Abbrev := 'LDSC ';
Company[19].Abbrev := 'LUPE ';
Company[20].Abbrev := 'MPC ';
Company[21].Abbrev := 'MYNC ';
Company[22].Abbrev := 'NAKR ';
Company[23].Abbrev := 'NATN ';
Company[24].Abbrev := 'PDSS ';
Company[25].Abbrev := 'PEOP ';
Company[26].Abbrev := 'POWR ';
Company[27].Abbrev := 'SHRX ';
Company[28].Abbrev := 'SKBD ';
Company[29].Abbrev := 'SKEI ';
Company[30].Abbrev := 'SMUG ';
Company[31].Abbrev := 'SSS ';
Company[32].Abbrev := 'STFP ';
Company[33].Abbrev := 'SWNC ';
Company[34].Abbrev := 'TAG ';
Company[35].Abbrev := 'TNAH ';
Company[36].Abbrev := 'TNPT ';
Company[37].Abbrev := 'TPEG ';
Company[38].Abbrev := 'TPP ';
Company[39].Abbrev := 'TSRC ';
Company[40].Abbrev := 'UNIB ';
Company[41].Abbrev := 'VTPS ';
Company[42].Abbrev := 'YIPP ';
end;

//-----------Calculate Change in % For Day---------------
procedure CalculateChange();
var i: Integer;
Begin
Company[14].Open := 1;

for i:= 0 to 42 do
Begin
Company[i].Change := ((Company[i].cur/Company[i].Open)*100)-100;
end
end;

//--------------Stock Calculations(returns array of 'stock')---------
procedure findCheapStocks();
var j : Integer; //Number of stocks added to new list
Begin

for i:=0 to 42 do
Begin
if (Company[i].Cur=15)then
Begin
CheapStocks[j].Name := Company[i].name;
CheapStocks[j].Abbrev := Company[i].Abbrev;
CheapStocks[j].Cur := Company[i].Cur;
CheapStocks[j].Change := Company[i].Change;
CheapStocks[j].Open := Company[i].Open;
j := j + 1;
end
end
end;

Procedure InitialiseInclude();
begin
//#############Menu Vars###############
//Explore Button
menuExplore_X := 75;
menuExplore_Y := 365;

//Games Button
menuGames_X := 75;
menuGames_Y := 400;

//Shops Button
menuShops_X := 75;
menuShops_Y := 465;

//Login Button
menuLogin_X := 75;
MenuLogin_Y := 630;

//Logout Button
MenuLogout_X := 75;
MenuLogout_Y := 660;

//#########World Vars#############

FaerieLand_X := 460;
FaerieLand_Y := 675;
LostDesert_X := 315;
LostDesert_Y := 740;
HauntedWoods_X := 320;
HauntedWoods_Y := 655;
NeopiaCentral_X := 355;
NeopiaCentral_Y := 570;
Meridell_X := 450;
Meridell_Y := 575;
Tyrannia_X := 515;
Tyrannia_Y := 515;
Maraqua_X := 555;
Maraqua_Y := 615;
MysteryIsland_X := 575;
MysteryIsland_Y := 685;
KrawkIsland_X := 520;
KrawkIsland_Y := 720;
VirtupetsStation_X := 630;
VirtupetsStation_Y := 535;
TerrorMountain_X := 435;
TerrorMountain_Y := 500;
Kreludor_X := 230;
Kreludor_Y := 515;


//##########Login Page Vars#########
//Username Text Box
UserNameBox_X := 450;
userNameBox_Y := 560;

//Login Button
loginButton_X := 445;
loginButton_Y := 595;

//Password Text Box
passwordBox_X := 445;
passwordBox_Y := 655;

//Enter Password Button
passwordButton_X := 445;
passwordButton_Y := 715;

//######Stock Market Pages Vars#####

//By Stocks Link
goBuyStocks_X := 470;
goBuyStocks_Y := 400;

//My Portfolio Link
goPortfolio_X := 400;
goPortfolio_Y := 400;

//List Stocks Link
goListStocks_X := 365;
goListStocks_Y := 505;

//########Initialise Company Names#######
setCompanyNames();

//######Setting Bitmap Strings#########

//Stock Market Bitmap String
Stock_Market := BitmapFromString(17, 9, 'z78DA9D926B8EC320' +
'0C84AF04D8C6F8272FDFFF48EB64D2C7AAD5AA5D461AA1287C836' +
'DDCC7A0E297CF44E3EEC2C717E3163E782C1B4D6A3A1769B154C9' +
'C9F2B4AA56F6D8BD09C1AD37222B39C73F32A551067FBAF5B2449' +
'9332FED4C724F093E4EA59566B2F4C1021989EE9E9BA8CBCC8AAC' +
'51DAA28C3BA42F174E9959E200EFA9337CB78414DC10553FF70AD' +
'DF89CBF7D71AD416EAAAF29628790855A90A2456621F55AD5978F' +
'B21CCCE65ADAB5D7591711E6154CD1FC3BE5E0874B1B751EE27D0' +
'859980BAA6366E2E8ED8C33171FB59F930A5AAAE31DFF51C59592' +
'1FA275081D0854BF4DFCAAE5DCE3FEEE6B55F95F0A546A483097E' +
'B259C7CBCC0B7FC3F7A05C75C5E05F2F31BB8F5FFBB2AC2BB951F' +
'B4FBCEB4');

//Scroll Down Bitmap String
Scroll_Down_Button := BitmapFromString(9, 6, 'z78DA7590510E80200C4' +
'3CF0408E2A76BDDFD8F64758992A03F2F0B79A5CB40EE8E852DF5' +
'8A8DDD1134C3E1B40D740B8633CE239158DC82D694FD723ADB7F7' +
'67E8F7F5059B5D5CDD999FD27D5EED4C30F3FC3E50F44D6264011' +
'A9F9EACD6FAFED5C7499F572AC3039743A759D5A814C6B');

//Scroll Up Bitmap String
Scroll_Up_Button := BitmapFromString(9, 6, 'z78DA6D904B0EC4200C43C' +
'FD40F0C2C89DDDCFF48F534744A356C9E2CF44C023848271AAB58' +
'98DD823BF35292190EA735D06155B4C8209B58596E863FB2FB9FA' +
'7AB29E59A25FEFBAF6ED6DCDE1DF7198985DBEC3CBA133F31E9B6' +
'F54BE3BC2B27DF6F898C4D3E7BAB711757F8EF7FAE7C027F6E4CF' +
'5');

//############Misc Vars################
//RightClick Dialog Box Delete Text
rightDiaDelete_X := 10;
rightDiaDelete_Y := 100;

//Time To Wait After Page Change
refreshWait := 4000;

//Page Offset When Random Event Ocurs
RandomOffset :=120;
end;

moparisthebest

2006-05-30 11:40:12

in my open runescape procedure that worked on ie and firefox I found the best most universal way to scroll up and down are the arrow keys ;) :D