SRL Archive - OSR Help

Paying For EASY SCRIPT FIX


Tiggy

2012-04-28 13:37:48

The script would withdraw 14 of both ingredients and left click on it, which isn't good because I'm making recover specials and the ingredients are Super energy 3 and Papaya fruits, all left click "eat"

Is there a way to change it so it right click and click "use"


{*******************************************************************************
** Bud_wis_er_420's All Potions Maker **
** **
** Instructions: **
** 1: Standing at sw bank. Loged or not, don't matter. **
** 2: first item in 1st bank slot and second item in 2nd slot **
** 3: Push play **
** **
** This a a beta test of the main script without the item finding. **
** The porpose is to test the script can complet its loop for hours on end. **
** It will also give you something reliable until I can finish the item **
** finding. **
*******************************************************************************}

program AllPotionsMaker;
{$DEFINE SMART}
{$i srl/srl.Simba}
//{$i FindBankItem.Simba}

// ItemArray stores everything about every item.
type
ItemArray = record
ItemName: string;
ItemType: integer;
LocationX: integer;
LocationY: integer;
end;

var
x, y, count, amt, Tamt: Integer;
FirstTime, FoundChat: Boolean;
Item: array of ItemArray;

const


////////////////// SETUP SCRIPT ///////////////////
Pots_to_make = 15000; // How many to make
Login_44 = 1; // 0 = off; 1 = on;
CheckTextType = 0; // 0 = off; 1 = text; 2 = name
WarningSound = 'C:\botclient\config\sounds\alarm.wav';
ManualMode = 'On'; // Leave this on 'On' for now
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Youe Rs username
Players[0].Pass := ''; //Your RS password
Players[0].Nick := ''; //3-4 letters from name
Players[0].Active:= True;
Players[0].Pin := '';
end;

//////////////// End SETUP SCRIPT /////////////////

//******************************************************************************
// Checks for any text in chat box if const CheckTextType = 1;
// Checks for your nick in chat box if const CheckTextType = 2;
//******************************************************************************
procedure CheckForText;
var
time :longword;
begin
if(FoundChat = false)then
begin
//Checks for text
if(CheckTextType = 1)then
begin
if(FindColorSpiral (x, y, 16711680, 22, 446, 134, 454))then
begin
playsound(WarningSound);
time := GetSystemTime;
writeln('Text found at ' + inttostr(time));
//FoundChat := true;
end;
end;

//Checks for nick
if(CheckTextType = 2)then
begin
if(FindChatBoxText(Players[0].Nick, 8, clBlue))or
(FindChatBoxText(Lowercase(Players[0].Nick), 8, clBlue))then
begin
playsound(WarningSound);
time := GetSystemTime;
writeln('You name found at ' + inttostr(time));
//FoundChat := true;
end;
end;
end;
end;

//******************************************************************************
// Checks if Logged off and Logs in player
// Returns true if logged out
//******************************************************************************
function CheckLogin: Boolean;
begin
//Looks for Login and Lobby Screens
if(GetColor(745, 17) = 16645629)or
(LobbyScreen)then
begin
Writeln('Not Logged in, Logging in now.');
Result := True;
Sleep(1000+Random(1000));
if(LoginPlayerToLob)then
begin
if(Login_44 = 1)then
begin
if(OpenWorldScreen)then
begin
Sleep(1000+Random(1000));
Mouse(123,125, 3, 3, true);//click world order arrow
Sleep(500+Random(1000));
Mouse(686,157, 4, 0, true);//click scroll bar top
Sleep(1000+Random(1000));
Mouse(687, 257, 3, 0, true);//click scroll bar to see world 44
Sleep(1000+Random(1000));
Mouse(144, 281, 100, 8, true);//click world 44
Sleep(2000+Random(1000));
Mouse(308, 452, 160, 19, true);//click login
Sleep(2000+Random(1000));
Writeln('Logged into world 44');
end else
begin
Writeln('Could not log into world 44');
if(LoginPLayer)then
begin
Writeln('Logged in');
end else
begin
CheckLogin;
end;
end;
end else
begin
if(LoginPLayer)then
begin
Writeln('Logged in');
end else
begin
CheckLogin;
end;
end;
end else
begin
CheckLogin;
end;
end;
end;

//******************************************************************************
// Antiban
//******************************************************************************
procedure AntiBan;
var
j, SkillNum :Integer;
begin
j := Random(301);
LevelUp;
case j of
0: begin
SkillNum := random(25);
HoverSkill (SkillNum, False);
Sleep(1000+Random(3000));
GameTab(tab_Inv);
end;
1..5: PickUpMouse;
6..10: RandomRClick;
11: RandomAngle(1);
12: ExamineInv;
13..200:
begin
//Do nothing
end;
end;
end;

//******************************************************************************
//Checks for pin screen and enters pin
//******************************************************************************
function CheckPin: Boolean;
begin
if(Players[CurrentPlayer].Pin = '')then
begin
Writeln('We are at the pin screen and you didn''t enter a pin');
TerminateScript;
end;
if(PinScreen)then
begin
Writeln('Found Pin Screen');
InPin(Players[CurrentPlayer].Pin);
Writeln('Pin successfully entered');
if(WaitFunc(@BankScreen, 200 + Random(100), 4000))then
begin
Result := true;
Exit;
end;
end;
end;

//******************************************************************************
// Fixes angle if MakeCompass is off
//******************************************************************************
procedure CheckAngle(ang: Integer);
var
AngDeg: Extended;
c: Integer;
begin
repeat
AngDeg := rs_GetCompassAngleDegrees;
c := 0;
if(AngDeg > ang + 7)or(AngDeg < ang - 7)then
begin
MakeCompass(ang);
Sleep(500+Random(500));
end;
AngDeg := rs_GetCompassAngleDegrees;
Inc©
until(AngDeg < ang + 10)and(AngDeg > ang - 10)or(c > 10)
end;

//******************************************************************************
//Script setup ** Not Finished
//******************************************************************************
procedure SetupWhatToMake;
begin
SetArrayLength(Item, 2);
Item[0].ItemName := 'Vial of water';
Item[1].ItemName := 'Clean harralander';
end;

//******************************************************************************
//
//Need a way to check current item amount in bank to
//crosscheck with how many to be made. Don't want to
//go over the amount and lose item positions
//
//******************************************************************************

//******************************************************************************
//Uses SetupWhatToMake array list to find all the items in bank the
//script is gona need to complete all tasks and store it's bank location.
//******************************************************************************
procedure WithdrawSetup;
var
I, Ind: Integer;
FoundXY, BankXY, RowSlot: TPoint;
begin
Writeln('Setting up Withdraw');
if(Lowercase(ManualMode) = 'off')then
begin
Writeln('Manual Mode is off');
SetupWhatToMake;
for I := 0 to High(Item) do
begin // Loops till all items script is gonna need is found
{ if(FindBankItemMulti(x, y, Item.ItemName))then
begin
FoundXY := Point(x, y); //Stores found item x, y to a Tpoint
RowSlot := MSTPointToBankPoint(FoundXY); //Converts mouse point to a bank point(row, column)
Ind := BankPointToBankIndex(RowSlot); //Converts point to index
BankXY := BankIndexToMSPoint(Ind); // Converts index to mouse point
Item.LocationX := BankXY.x + 14;// Stores middle point of bank slot for item
Item.LocationY := BankXY.y + 15;
writeln(Item.ItemName + ' found and stored at row ' + IntToStr(RowSlot.y + 1) + ', Slot ' + IntToStr(RowSlot.x + 1));
end else
begin
Writeln('Shutting down script');
TerminateScript;
end; }
end;
end else
begin
Writeln('Manual Mode is on');
SetArrayLength(Item, 2);
//First bank Slot
Item[0].LocationX := 53;// Stores middle point of bank slot for item
Item[0].LocationY := 107;
//Second Bank Slot
Item[1].LocationX := 97;// Stores middle point of bank slot for item
Item[1].LocationY := 107;
end;
end;

//******************************************************************************
// Simple right click and move mouse 87(Random) pixels down to withdraw-X
// use this because there is no need to use ChooseOption which could fail
//******************************************************************************
procedure ClickAmountX(ax, ay: integer; Amount: string);
begin
//Writeln('Using ClickAmountX');
Mouse(ax - 4, ay - 4, 8, 8, false);
GetMousePos(ax, ay);
Mouse(ax - 5, ay + 87, 10, 4, true);
sleep(1000 + random(200));
TypeSend(Amount);
sleep(1000 + random(500));
end;

//******************************************************************************
// Simple right click and move mouse 74(Random) pixels down to withdraw-?
// use this because there is no need to use ChooseOption which could fail
//******************************************************************************
procedure ClickAmount(ax, ay: Integer);
begin
//Writeln('Using ClickAmount');
Mouse(ax - 4, ay - 4, 8, 8, false);
Sleep(500 + Random(500));
GetMousePos(x, y);
Mouse(x - 5, y + 74, 10, 4, true);
end;

//******************************************************************************
// Withdraws First items
//******************************************************************************
function WithdrawFirst: Boolean;
begin
//Writeln('Using WithdrawFirst');
Result := False;
if(FirstTime = True)then
begin
ClickAmountX(Item[0].LocationX, Item[0].LocationY, '14');
if(WaitInvCount(14, 4000, ExactCT))then //****Change to item.amount
begin
Result := True;
FirstTime := False;
end else
begin
Writeln('Did not detect withdrawn items in inv.');
if(CheckLogin)then Exit;
end;
end else
begin
ClickAmount(Item[0].LocationX, Item[0].LocationY);
if(WaitInvCount(14, 4000, ExactCT))then //****Change to item.amount
Result := True
else
begin
Writeln('Did not detect withdrawn items in inv.');
if(CheckLogin)then Exit;
end;
end;
end;

//******************************************************************************
// Withdraws Second items
//******************************************************************************
function WithdrawSecond: Boolean;
begin
//Writeln('Using WithdrawSecond');
Result := False;
ClickAmount(Item[1].LocationX, Item[1].LocationY);
if(WaitInvCount(28, 4000, ExactCT))then
Result := True
else
begin
Writeln('Did not detect withdrawn items in inv.');
if(CheckLogin)then Exit;
end;
end;

//******************************************************************************
// Withdraws items
//******************************************************************************
function WithdrawStuff: Boolean;
begin
//Writeln('Using WithdrawStuff');
DepositAll;
if(FirstTime = True)then
begin
WithdrawSetup;
end;
if(WithdrawFirst)then
begin
if(WithdrawSecond)then
begin
Result := True
CloseBank;
end else
begin
if(CheckLogin)then Exit;
WithdrawStuff;
end;
end else
begin
if(CheckLogin)then Exit;
WithdrawStuff;
end;
end;

//******************************************************************************
//Waits for 4 sec for the bank screen and also handles pin screen
//******************************************************************************
function WaitForBank: Boolean;
begin
//Writeln('Using WaitForBank');
Result := False;
if(WaitFunc(@BankScreen, 200 + Random(100), 4000))or
(WaitFunc(@PinScreen, 200 + Random(100), 4000))then
begin
if(PinScreen)then
begin
Writeln('We are at pinscreen');
if(CheckPin)then
begin
WaitFunc(@BankScreen, 500 + Random(100), 4000);
if(BankScreen)then
begin
Writeln('The bank was successfully opened 1.');
Result := True;
Sleep(500 + Random(500));
Exit;
end else
begin
if(CheckLogin)then Exit;
Writeln('Did not find bank after enetering pin');
end;
end;
end;
if(BankScreen)then
begin
Writeln('The bank was successfully opened 2.');
Result := True
Sleep(500 + Random(500));
end;
end else
begin
if(CheckLogin)then Exit;
Writeln('Did not find bank after waiting');
end;
end;

//******************************************************************************
// Finds MM bank symbol and clicks on it
//******************************************************************************
function GoToBank: Boolean;
begin
//Writeln('Using GoToBank');
Result := False;
if(FindSymbol(x,y,'bank'))then
begin
Writeln('Found Bank Symbol');
MouseFlag(x - 1, y - 1, 2, 2, 0);
WaitFunc(@FlagPresent, 100 + Random(100), 4000)
Sleep(1000 + random(1000));
if(FindSymbolIn(x,y,'bank',MMCX - 20, MMCY - 20, MMCX + 20, MMCY + 20))then
begin
Writeln('Successfully walked to the bank');
end else
begin
Writeln('Did not successfully walked to the bank');
if(CheckLogin)then Exit;
GoToBank;
end;
end else
begin
if(CheckLogin)then Exit;
Writeln('Lost bank, shutting down');
Logout;
TerminateScript;
end;
end;

//******************************************************************************
// Finds bank using OpenBankChest
//******************************************************************************
function FindTheBank_SrlChest: Boolean;
begin
//Writeln('Using FindTheBank_SrlChest');
Result := False;
if(OpenBankChest(SRL_BANK_SW))then
begin
Writeln('Bank Found');
Result := True;
end else
begin
Writeln('Bank not Found');
if(CheckLogin)then Exit;
end;
end;

//******************************************************************************
// Finds bank using OpenBankChestEdge
//******************************************************************************
function FindTheBank_SrlChestEdge: Boolean;
begin
//Writeln('Using FindTheBank_SrlChestEdge');
Result := False;
if(OpenBankChestEdge(SRL_BANK_SW))then
begin
Writeln('Bank Found');
Result := True;
end else
begin
Writeln('Bank not Found');
if(CheckLogin)then Exit;
end;
end;

//******************************************************************************
// Edited IsUpTextMultiCustom made for only looking for blue bank text.
//******************************************************************************
function IsBankUpText(Text: TStringArray): Boolean;
var
TheText: string;
i, n: Integer;
begin
//Writeln('Using IsBankUpText');
TheText := GetTextAt(33, 10, 0, 5, 10, 14671648, 52, 10, UpChars); ;
n := High(Text);
for i := 0 to n do
if (Pos(Text, TheText) > 0) then
begin
Writeln('Text Found');
Result := True;
Exit;
end;
end;
//******************************************************************************
// Finds bank using only uptext(Quick)
//******************************************************************************
function FindTheBankQuick: Boolean;
var
Btxt: TStringArray;
VBtxt: TVariantArray;
begin
//Writeln('Using FindTheBankQuick');
Result := False;
Btxt := ['Use', 'ank', 'hest', 'che', 'nk ch'];
VBtxt := [Btxt];
count := 0;
x := 295;
y := 161;
CheckAngle(270);
repeat
MMouse(x, y, 15, 15);
WaitFuncEx('IsBankUpText', VBtxt, 50 + Random(10), 1000);
Inc(count);
until(IsBankUpText(Btxt))or
(count > 10)
if(IsBankUpText(Btxt))then
begin
Writeln('Text Found');
GetMousePos(x,y)
Mouse(x,y,0,0,true);
if(WaitForBank)then
begin
Writeln('Bank Found');
Result := True;
end else
begin
Writeln('Bank not Found');
if(CheckLogin)then Exit;
end;
end;
end;

//******************************************************************************
// Looks for bank symbol and walks to it.
//******************************************************************************
function FindBankFix: Boolean;
begin
//Writeln('Using FindBankFix');
if(GoToBank)then
begin
if(FindTheBank_SrlChestEdge)then
Result := True
else
begin
if(FindTheBank_SrlChest)then
begin
Result := True;
end else
begin
FindBankFix;
end;
end;
end else
begin
Writeln('Could not open the bank');
if(CheckLogin)then Exit;
end;
end;

//******************************************************************************
// Uses the above 3 funtions to try and open the bank.
//******************************************************************************
function OpenTheBank: Boolean;
begin
//Writeln('Using OpenTheBank');
Result := False;
if(BankScreen)then
begin
Result := True;
Exit;
end;
CheckAngle(270);
if(FindTheBankQuick)then
Result := True
else
begin
if(CheckLogin)then Exit;
if(FindTheBank_SrlChestEdge)then
Result := True
else
begin
if(CheckLogin)then Exit;
if(FindTheBank_SrlChest)then
Result := True
else
begin
Writeln('Could not open the bank');
Writeln('Trying to walk to the bank');
if(CheckLogin)then Exit;
if(FindBankFix)then
Result := True;
end;
end;
end;
end;

//******************************************************************************
// Waits for specified inv slot to change color, up to 30 sec
//******************************************************************************
procedure WaitForInvChange(SlotNum: Integer);
var
WTime, SleepT, CTime, SColor, CColor :Integer;
Slot: TBox;
time :longword;
begin
time := GetSystemTime;
WTime := 29000 + Random(1000);
SleepT := time + WTime;
Slot := invbox(SlotNum);
SColor := GetColor(Slot.x1 + 19, Slot.y1 + 15);
writeln('Start color is: ' + inttostr(SColor));
repeat
Sleep(500+Random(100))
CheckForText;
AntiBan;
CTime := GetSystemTime;
CColor := GetColor(Slot.x1 + 19, Slot.y1 + 15);
until not(SimilarColors(CColor, SColor, 5))or(SleepT < CTime)
writeln('Currrent color is: ' + inttostr(CColor));
end;

//******************************************************************************
//Waits 4 sec for the make screen
//******************************************************************************
Function WaitForMakeScreen: Boolean;
begin
//Writeln('Using WaitForMakeScreen');
Result := False;
if(WaitColor(388, 357, 2070783 , 5, 4000))then
Result := True
else
begin
Writeln('Make screen not found');
if(CheckLogin)then Exit;
end;
end;

//******************************************************************************
//Makes the items
//******************************************************************************
procedure Make;
var
ActSlot: TVariantArray;
begin
//Writeln('Using Make');
ActSlot := [17];
While not(ItemActivated(17)) do
begin
Mouse(575, 366, 10, 10, True);
WaitFuncEx('ItemActivated', ActSlot, 50 + Random(10), 2000);
end;

Mouse(570, 332, 10, 10, true);
if(WaitForMakeScreen)then
begin
Writeln('Make screen found');
Mouse(227, 406, 30, 20, true);
count := 1;
WaitForInvChange(14); //Tie in 14 to amount in ItemArray
end;
end;

//******************************************************************************
// Main Loop
//******************************************************************************
procedure MainLoop;
begin
if(OpenTheBank)then
begin
if(WithdrawStuff)then
begin
Make;
end;
end;
end;

//******************************************************************************
// Start of Script
//******************************************************************************
Begin
//ClearDebug();
Smart_Server := 44;
SetupSRL();
DeclarePlayers;
repeat
while not(RSReady) do Sleep(500 + Random(500));
CheckLogin;
until(LoggedIn)
amt := pots_to_make / 14;
Tamt := 0;
count := 0;
FirstTime := True;
FoundChat := false
SetAngle(SRL_ANGLE_HIGH);
SetAngle(SRL_ANGLE_HIGH);

Gucci

2012-04-28 13:40:30

Put the script in Simba tags not Quote and that will make it easy to look through. And to answer your question just use the choose option function

Tiggy

2012-04-28 13:53:49

From: Gucci
Put the script in Simba tags not Quote and that will make it easy to look through. And to answer your question just use the choose option function


Can you guide me through that please?

Le Jingle

2012-04-28 14:04:34

No payments for scripts here.

But in hopes to help, try replacing the right part with something that right clicks. It's pretty simple..

For example I'd edit in something like this:

Mouse(575, 366, 10, 10, False);
WaitOption('Use', 200);

Tiggy

2012-04-28 14:09:12

From: Le Jingle
No payments for scripts here.

But in hopes to help, try replacing the right part with something that right clicks. It's pretty simple..

For example I'd edit in something like this:

Mouse(575, 366, 10, 10, False);
WaitOption('Use', 200);


omfg… i worship u

Coh3n

2012-04-28 15:31:58

Looks like the issue is resolved, but I'm closing this because it is against the rules.