SRL Archive - General Botting Help

Take break procedure


Guiri

2015-05-09 07:42:24

Hello,

I've been working on a procedure to make my scripts take breaks, but I keep running into an error when I try to test it.

It keeps opening time.simba and writes this message in the debug box:

Error: Access violation at line 456
Execution failed.

My code is:

procedure takeBreak(minimum, maximum: integer);
var
H, M, S, HH, MM, SS, breakFor, timeLeft: integer;
breakStartTimer: TTimeMarker;
begin
breakFor := gaussRangeInt(minimum * 60000, maximum * 60000);
convertTime(breakFor, H, M, S);
writeLn('Taking a break for: ' + toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's');
showBalloonHint('Break', 'Taking a break for: ' + toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's', 3000, 0);

if random(2) = 0 then
begin
players[currentPlayer].logout()
end else
begin
players[currentPlayer].exitToLobby();
end;

breakStartTimer.start();
repeat
timeLeft := breakFor - breakStartTimer.getTime();
convertTime(timeLeft, HH, MM, SS);
writeLn('Ending break in: ' + toStr(HH)+ 'h ' + toStr(MM)+ 'm ' + toStr(SS)+ 's');
showBalloonHint('Break', 'Ending break in: ' + toStr(HH)+ 'h ' + toStr(MM)+ 'm ' + toStr(SS)+ 's', 3000, 0);
wait(10000 + random(5000));
until breakFor < breakStartTimer.getTime();
showBalloonHint('Break', 'Break completed. Loging in..', 3000, 0);
userLogin;
inc(breaksTaken);
end;

The Mayor

2015-05-09 08:47:41

From: Guiri
Hello,

I've been working on a procedure to make my scripts take breaks, but I keep running into an error when I try to test it.

It keeps opening time.simba and writes this message in the debug box:


Can't see anything wrong with your code. When does it throw the error? During a break?

KeepBotting

2015-05-09 09:12:29

You could looks at Echo_'s break handler for help, variations of it are still widely used.

Rich

2015-05-09 11:15:34

What line is line 456?

yourule97

2015-05-09 13:32:16

You need a semicolon after : players[currentPlayer].logout()

Guiri

2015-05-10 05:04:04

From: The Mayor
Can't see anything wrong with your code. When does it throw the error? During a break?


I get the error message after the script exits me to lobby, or logs me out.

From: yourule97
You need a semicolon after : players[currentPlayer].logout()


I've added it and I still get the error, It is not because of that.

From: Rich
What line is line 456?


Line 456 of time.simba is:

Self.time := Self.time + (getTickCount64() - Self.__prevMark);

The Mayor

2015-05-10 05:14:35

From: Guiri
I get the error message after the script exits me to lobby, or logs me out.



I've added it and I still get the error, It is not because of that.



Line 456 of time.simba is:

Self.time := Self.time + (getTickCount64() - Self.__prevMark);


Post the rest of your script?

Guiri

2015-05-10 05:59:57

From: The Mayor
Post the rest of your script?


I'd prefer not releasing my script, what part are you wanting to look at?
The function itself? How i'm calling it, etc?

The Mayor

2015-05-10 07:07:17

From: Guiri
I'd prefer not releasing my script, what part are you wanting to look at?
The function itself? How i'm calling it, etc?


Suit yourself m8 ;)

Thomas

2015-05-10 07:17:03

From: Guiri
I'd prefer not releasing my script, what part are you wanting to look at?
The function itself? How i'm calling it, etc?


You could have posted the parts you didn't mind sharing, or the parts you think might be needed for us to help you.

Thomas

2015-05-10 07:20:50

On iPhone.. Try this

breakStartTimer.start();
repeat
// timeLeft := breakFor - breakStartTimer.getTime();
// convertTime(timeLeft, HH, MM, SS);
// writeLn('Ending break in: ' + toStr(HH)+ 'h ' + toStr(MM)+ 'm ' + toStr(SS)+ 's');
// showBalloonHint('Break', 'Ending break in: ' + toStr(HH)+ 'h ' + toStr(MM)+ 'm ' + toStr(SS)+ 's', 3000, 0);
wait(10000 + random(5000));
until (breakFor < breakStartTimer.getTime()); //added brackets
// showBalloonHint('Break', 'Break completed. Loging in..', 3000, 0);
userLogin;
inc(breaksTaken);

Overall your breaking function seems way more complicated then it should be.

Nvm, it's probably because you converted the breakfor. That isn't needed I think.
Your breakstarttimer isn't converted either. So you cant compare those.

Justin

2015-05-10 07:36:00

I had this issue with one of my scripts, make sure you're declaring players :)

KeepBotting

2015-05-10 07:59:47

From: Guiri
I'd prefer not releasing my script, what part are you wanting to look at?
The function itself? How i'm calling it, etc?

How do you expect us to help you if you won't post the code?