SRL Archive - Help and Support

Help me with my standards >.<


Sin

2012-02-22 09:55:18

I always believed that it should be like this -
if SomthingHappens then
begin
if somethingelsehappens then
begin
Mouse(FDFDBFDF)
if taasdad then

end;
end;
Although i'm thinking that it's wrong now.

function RenewFamiliar:Boolean;
var
Summoning,x,y,Inv:Integer;
begin
Summoning := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');

if UseSummoning = True then
begin
if not UsingFamiliar then
begin
if GetSummonPoints <= 8 then
begin
if FindDTM(Summoning,x,y,MBX1,MBY1,MBX2,MBY2) then
begin
Mouse(x,y,1,1,True);
repeat
wait(100);
until(FindDTM(Summoning,x,y,MIX1,MIY1,MIX2,MIY2));
CloseBank;
Mouse(x,y,1,1,True);
Wait(RandomRange(500,800));
ClickMouse2(true);
if GetSummonPoints <= 8 then
begin
RenewFamiliar;
exit;
end else
begin
if FindBanker(x,y) then
begin
GetMousePos(x,y);
ClickMouse2(False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);
if BankScreen then
begin
GetInvCount(inv);
wait(1000 + random(200));
MouseBankSlot(Slot,1);
repeat
wait(100);
until(InvCount = Inv + 1);
CloseBank;
MouseItem(2,0);
ChooseOption('ummon');
if UsingFamiliar then
begin
if FindBanker(x,y) then
GetMousePos(x,y);
Mouse(x,y,1,1,False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);
if BankScreen then
exit;
end;
end;
end;
end;
end;
end else
end else
exit;
end else
exit;
end;

If someone could standardize that and show me what to do that'd be great xP
Btw, this is NOT Flight's renew familiar, i'm using his UsingFamiliar and GetSummonPoints fuctions.
I've credited him in the beginning of the script

RISK

2012-02-22 10:07:05

function RenewFamiliar:Boolean;
var
Summoning,x,y,Inv:Integer;
begin
Summoning := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');

if UseSummoning = True then
begin
if not UsingFamiliar then
begin
if GetSummonPoints <= 8 then
begin
if FindDTM(Summoning,x,y,MBX1,MBY1,MBX2,MBY2) then
begin
Mouse(x,y,1,1,True);
repeat
wait(100);
until(FindDTM(Summoning,x,y,MIX1,MIY1,MIX2,MIY2));

CloseBank;
Mouse(x,y,1,1,True);
Wait(RandomRange(500,800));
ClickMouse2(true);
if GetSummonPoints <= 8 then
begin
RenewFamiliar;
exit;
end else
begin
if FindBanker(x,y) then
begin
GetMousePos(x,y);
ClickMouse2(False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);

if BankScreen then
begin
GetInvCount(inv);
wait(1000 + random(200));
MouseBankSlot(Slot,1);
repeat
wait(100);
until(InvCount = Inv + 1);
CloseBank;
MouseItem(2,0);
ChooseOption('ummon');

if UsingFamiliar then
begin
if FindBanker(x,y) then
GetMousePos(x,y);
Mouse(x,y,1,1,False);
ChooseOption('Bank B');

repeat
wait(100);
until(BankScreen);

if BankScreen then
exit;
end;
end;
end;
end;
end;
end else
end else
exit;
end else
exit;
end;

You had it correct with what you've always believed it should be.

Sin

2012-02-22 10:08:01

From: RISK
function RenewFamiliar:Boolean;
var
Summoning,x,y,Inv:Integer;
begin
Summoning := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');

if UseSummoning = True then
begin
if not UsingFamiliar then
begin
if GetSummonPoints <= 8 then
begin
if FindDTM(Summoning,x,y,MBX1,MBY1,MBX2,MBY2) then
begin
Mouse(x,y,1,1,True);
repeat
wait(100);
until(FindDTM(Summoning,x,y,MIX1,MIY1,MIX2,MIY2));

CloseBank;
Mouse(x,y,1,1,True);
Wait(RandomRange(500,800));
ClickMouse2(true);
if GetSummonPoints <= 8 then
begin
RenewFamiliar;
exit;
end else
begin
if FindBanker(x,y) then
begin
GetMousePos(x,y);
ClickMouse2(False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);

if BankScreen then
begin
GetInvCount(inv);
wait(1000 + random(200));
MouseBankSlot(Slot,1);
repeat
wait(100);
until(InvCount = Inv + 1);
CloseBank;
MouseItem(2,0);
ChooseOption('ummon');

if UsingFamiliar then
begin
if FindBanker(x,y) then
GetMousePos(x,y);
Mouse(x,y,1,1,False);
ChooseOption('Bank B');

repeat
wait(100);
until(BankScreen);

if BankScreen then
exit;
end;
end;
end;
end;
end;
end else
end else
exit;
end else
exit;
end;

You had it correct with what you've always believed it should be.


Ha!
Take that Toxin, telling me my standards are horrible!!
Thanks RISK ! :)

footballjds

2012-02-22 10:10:01

From: RISK
You had it correct with what you've always believed it should be.


I disagree, I don't like to indent if begin is the first thing after an if then. Which you seem to agree with me because you didn't do like him.

for instance, I do this:

if YouSeekAmy then
begin
ListenToBrittanySpears;
StompOnMP3Player;
end;
as opposed to this:

if YouSeekAmy then
begin
ListenToBrittanySpears;
StompOnMP3Player;
end;

Er1k

2012-02-22 10:10:09

From: RISK
You had it correct with what you've always believed it should be.


How did you tab it so quickly? :( I was literally frozen by the non-standardized snippet :P

RISK

2012-02-22 10:14:52

@ Sin : No worries. :) Glad to help!

@ Football : Ah, yes. I didn't notice that. Yeah, I don't think you should indent the procedure/function's begin .. end nest. Thanks for catching that. - I love that song, by the way. D:

@ Nosaj : I'm magical! :p Actually I just 'Tutor' a lot of people on MSN. So I'm used to standardizing other people's scripts.

masterBB

2012-02-22 10:14:59

footballjds is right on this one.

Brandon

2012-02-22 10:15:37

I'd say that the begins annoy me a little.

You don't need that many begin's..

Can just be:

if this then
if this then
if this then
do whatever..
else..
else
else..

or

if this then
if that then
begin
//do multiple stuff
end else
do whatever

Sin

2012-02-22 10:16:19


function RenewFamiliar:Boolean;
var
Summoning,x,y,Inv:Integer;
begin
Summoning := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');

if UseSummoning = True then
begin
if not UsingFamiliar then
begin
if GetSummonPoints <= 8 then
begin
if FindDTM(Summoning,x,y,MBX1,MBY1,MBX2,MBY2) then
begin
Mouse(x,y,1,1,True);
repeat
wait(100);
until(FindDTM(Summoning,x,y,MIX1,MIY1,MIX2,MIY2));
CloseBank;
Mouse(x,y,1,1,True);
Wait(RandomRange(500,800));
ClickMouse2(true);
if GetSummonPoints <= 8 then
begin
RenewFamiliar;
exit;
end else
begin
if FindBanker(x,y) then
begin
GetMousePos(x,y);
ClickMouse2(False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);
if BankScreen then
begin
GetInvCount(inv);
wait(1000 + random(200));
MouseBankSlot(Slot,1);
repeat
wait(100);
until(InvCount = Inv + 1);
CloseBank;
MouseItem(2,0);
ChooseOption('ummon');
if UsingFamiliar then
begin
if FindBanker(x,y) then
GetMousePos(x,y);
Mouse(x,y,1,1,False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);
if BankScreen then
exit;
end;
end;
end;
end;
end;
end else
end else
exit;
end else
exit;
end;
Standardized, let me know if it's good.

footballjds

2012-02-22 10:17:27

From: RISK
@ Football : Ah, yes. I didn't notice that. Yeah, I don't think you should indent the procedure/function's begin .. end nest. Thanks for catching that. - I love that song, by the way. D:


Ha, I like the song as well, just first thing that came to my head for lulz :P
In fact, I like almost all songs by her… :P

RISK

2012-02-22 10:17:49

You need to indent after the begin end nest of the procedure.
function RenewFamiliar:Boolean;
var
Summoning,x,y,Inv:Integer;
begin
Summoning := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');

if UseSummoning = True then

Following after that to indent accordingly.


ggzz is right, by the way. You have a lot of begin end's. So it's hard to keep track of it. Try to shorten that.


Yay! @ Football

footballjds

2012-02-22 10:20:57

From: ggzz
I'd say that the begins annoy me a little.

You don't need that many begin's..

Can just be:

if this then
if this then
if this then
do whatever..
else..
else
else..

or

if this then
if that then
begin
//do multiple stuff
end else
do whatever


From: RISK
ggzz is right, by the way. You have a lot of begin end's. So it's hard to keep track of it. Try to shorten that.


Yay! @ Football


agree'd, however, using or not using begin's when you don't have to isn't REALLY an issue with standards, more of a personal preference.
Although I sure as hell would prefer to look at code without all the begins… :P

@RISK- "Piece of me" is currently my fave. :P

Bebe

2012-02-22 10:49:08

http://kaitnieks.com/scar/scriptingsta/
or
http://www.econos.de/delphi/cs.html

Both still apply. That is what we used to use as reference back on Kaitnieks forums.

footballjds

2012-02-22 11:18:32

From: Bebe
http://kaitnieks.com/scar/scriptingsta/
or
http://www.econos.de/delphi/cs.html

Both still apply. That is what we used to use as reference back on Kaitnieks forums.


thanks babe.

This confirms how i would standardize my code:


var
x, y: Integer;
space between the colon and "Integer"

Kyle Undefined

2012-02-22 11:29:13

It's really just a matter of opinion.

putonajonny

2012-02-22 12:03:30

function RenewFamiliar : Boolean;
var
Summoning, x, y, Inv : Integer;
begin
Summoning := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrILaE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');

if UseSummoning = True then
begin
if not UsingFamiliar then
begin
if GetSummonPoints <= 8 then
begin
if FindDTM(Summoning, x, y, MBX1, MBY1, MBX2, MBY2) then //I cba doing it to all of them but all of your paramaters should be spaced out like this
begin
Mouse(x,y,1,1,True);
repeat
wait(100); //Don't forget your randomness, even for a wait like this.. ;)
until(FindDTM(Summoning,x,y,MIX1,MIY1,MIX2,MIY2));
CloseBank;
Mouse(x,y,1,1,True);
Wait(RandomRange(500,800));
ClickMouse2(true);
if GetSummonPoints <= 8 then
begin
RenewFamiliar;
exit;
end
else
begin
if FindBanker(x,y) then
begin
GetMousePos(x,y);
ClickMouse2(False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);
if BankScreen then
begin
GetInvCount(inv);
wait(1000 + random(200));
MouseBankSlot(Slot,1);
repeat
wait(100);
until(InvCount = Inv + 1);
CloseBank;
MouseItem(2,0);
ChooseOption('ummon');
if UsingFamiliar then
begin
if FindBanker(x,y) then
GetMousePos(x,y);
Mouse(x,y,1,1,False);
ChooseOption('Bank B');
repeat
wait(100);
until(BankScreen);
if BankScreen then
exit;
end;
end;
end;
end;
end;
end else //?
end else
exit;
end else
exit;
end;

Bonfield

2012-02-27 06:54:16

Your standards seem ok a little off in places, the only reason for all those begins would be to use end else to debug everything but there are a few unneeded ones like after if getsummoningpoints<= 8 etc