alexmeh
05-04-2012, 09:22 PM
I'm trying to make my first script, and i got a lot of help. I got the whole skeleton for the script and just needed to fill things in. The script is a wine drinker and I need a way to click all the 28 wines in the inventory. When I try the script now it only opens the bank and close it again.
here is the code I have now:
Program WineDrinker;
{$DEFINE SMART} {Tells The Script To Open Smart Client}
{$i SRL/srl.simba}
Var
X, Y, wine: Integer; // Variables
Procedure CallThangs;
Begin
wine := DTMFromString('mrAAAAHic42BgYOAGYlYGCGADYjEglgRiYS Q5DihfEirPBcRMUD1dhtpQHnZsxIAfMBLAMAAA3PEB9Q==');
End;
Procedure FreeThangs;
Begin
FreeDTM(wine);
End;
Procedure OpenmyBank; {Going To Give You A Easy Shell}
Begin
If (FindObjCustom(X, Y, ['Bank', 'booth'], [5862270, 5928063, 5928320, 5862527], 10)) Then
Begin
ClickMouse2(False)
Wait(150 + Random(50));
ChooseOption('Bank'); {The Option Uptext Here}
While(IsMoving) Do
wait(2000+random(100)); {2 Second Wait For Bankscreen To Show}
End;
End;
{In FindDTM(X,Y,MSX1 > The MSX1 + Rest Stands for Mainscreen Coords}
Procedure WithdrawWines; {This Will Take Them out of Bank}
Begin
If (Bankscreen) Then
Begin
If FindDTM(wine, X, Y, MSX1, MSY1, MSX2, MSY2) Then
Wait(150 + Random(50)); {To Give It Time To Move Mouse Over Object}
ClickMouse2(False); {False Means Right Click, So Were Finding The Wines Then Right Clicking Them}
Wait(150 + Random(50)); {This Gives It Time For The UpText To Show}
ChooseOption('Withdraw-All'); {After Finding The Object And Right Clicking This Will Choose The Option 'Withdraw-All'}
End;
End;
{Cant Remember How To Do The Case Here So Ask On Forums}
Procedure DrinkWines; {Handles Drinking The Wines}
Begin {Notice These are MIX? > I Stands For Inventory}
Repeat
If FindDTM(wine, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
If (IsUpText('Drink')) Then
Begin
wait(400 + random(150));
ClickMouse2(False);
Wait(150 + Random(100));
ChooseOption('Drink');
End;
End;
Until Not(FindDTM(wine, x, y, MIX1, MIY1, MIX2, MIY2));
End;
Procedure HandleBanking;
Begin
OpenmyBank;
Deposit(1, 28, True);{Simple Deposit SRL Includes Function Will Deposit All Items In Invetory}
WithdrawWines; {Calls The Procedure To Withdraw Wines}
CloseBank;
End;
Begin
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
SetupSRL;
AddOnTerminate('FreeThangs')
SetAngle(SRL_ANGLE_HIGH)
Repeat
HandleBanking;
DrinkWines;
Until(False);
FreeThangs;
Terminatescript();
End.
The notes are to help me because i'm new to scripting.
Thanks
Alexmeh
here is the code I have now:
Program WineDrinker;
{$DEFINE SMART} {Tells The Script To Open Smart Client}
{$i SRL/srl.simba}
Var
X, Y, wine: Integer; // Variables
Procedure CallThangs;
Begin
wine := DTMFromString('mrAAAAHic42BgYOAGYlYGCGADYjEglgRiYS Q5DihfEirPBcRMUD1dhtpQHnZsxIAfMBLAMAAA3PEB9Q==');
End;
Procedure FreeThangs;
Begin
FreeDTM(wine);
End;
Procedure OpenmyBank; {Going To Give You A Easy Shell}
Begin
If (FindObjCustom(X, Y, ['Bank', 'booth'], [5862270, 5928063, 5928320, 5862527], 10)) Then
Begin
ClickMouse2(False)
Wait(150 + Random(50));
ChooseOption('Bank'); {The Option Uptext Here}
While(IsMoving) Do
wait(2000+random(100)); {2 Second Wait For Bankscreen To Show}
End;
End;
{In FindDTM(X,Y,MSX1 > The MSX1 + Rest Stands for Mainscreen Coords}
Procedure WithdrawWines; {This Will Take Them out of Bank}
Begin
If (Bankscreen) Then
Begin
If FindDTM(wine, X, Y, MSX1, MSY1, MSX2, MSY2) Then
Wait(150 + Random(50)); {To Give It Time To Move Mouse Over Object}
ClickMouse2(False); {False Means Right Click, So Were Finding The Wines Then Right Clicking Them}
Wait(150 + Random(50)); {This Gives It Time For The UpText To Show}
ChooseOption('Withdraw-All'); {After Finding The Object And Right Clicking This Will Choose The Option 'Withdraw-All'}
End;
End;
{Cant Remember How To Do The Case Here So Ask On Forums}
Procedure DrinkWines; {Handles Drinking The Wines}
Begin {Notice These are MIX? > I Stands For Inventory}
Repeat
If FindDTM(wine, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
If (IsUpText('Drink')) Then
Begin
wait(400 + random(150));
ClickMouse2(False);
Wait(150 + Random(100));
ChooseOption('Drink');
End;
End;
Until Not(FindDTM(wine, x, y, MIX1, MIY1, MIX2, MIY2));
End;
Procedure HandleBanking;
Begin
OpenmyBank;
Deposit(1, 28, True);{Simple Deposit SRL Includes Function Will Deposit All Items In Invetory}
WithdrawWines; {Calls The Procedure To Withdraw Wines}
CloseBank;
End;
Begin
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
SetupSRL;
AddOnTerminate('FreeThangs')
SetAngle(SRL_ANGLE_HIGH)
Repeat
HandleBanking;
DrinkWines;
Until(False);
FreeThangs;
Terminatescript();
End.
The notes are to help me because i'm new to scripting.
Thanks
Alexmeh