SRL Archive - MSI Bugs

Ugh, woodcutting


Camaro'

2010-12-10 23:34:10

Also, to not use smart, when you uncomment the smart include file, it errored, so you must change this



if DEBUG_SMART then
SmartSetDebug(True);


to..


{$IFDEF SRL_SMART}
if DEBUG_SMART then
SmartSetDebug(True);
{$ENDIF}


In the main loop…

This is for the 100% Color - Port sarim yew

I added more color walking spots, but here is my setup
http://pastebin.com/hCvtM6cs

Here is the debug

http://pastebin.com/J68Fy0Gb

What happens is, it walks to the port sarim yew tree fine, if the tree is not there, it will try and find it, fail, then logout saying its a break. If the tree is there, it will chop it down and then do the same above. Then, after the break, it will login, do nothing, and log back out, stated that (I think) it is trying to walk somewhere, that fails, and it does next-player.

I tried fixing this but I can't seem to figure out why it fails. I read a recent thread stating a relocating fix was made, but maybe its f'n up because there is only one yew?


Part where script fails in main loop



// Walk to location if using a bankable script
if (not (MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript].Name].BankType = NoBank)) then
begin
if (MSI_Locations[MSI_Players[CurrentPlayer].Location].AtBank) then
if (InvCount > Length(MSI_Players[CurrentPlayer].Scripts[CurrentScript].Exceptions)) then
goto AtBank;


if (not MSI_Walk(True)) then
begin
if (MSI_TimedOut) then
Break;

MSI_UnsetPlayer('Failed to walk to location', False);
Break;
end;
end;

I didn't even look into why it was taking a break :(.

Gu3st...

2010-12-11 07:30:36

A quickfix to the breaking problem:
begin
if (not LoggedIn) then
Exit;

if not HUMAN_BREAKING then
if MSI_Players[CurrentPlayer].BreakTime = 0 then
if BREAK_TIME = 0 then
Exit;

if (BankScreen) then
CloseBank;

I'm not sure about the smart problem…
Do I understand you correct?
Doing {$IFDEF SRL_SMART} and commenting out the include smart line prevents smart from loading?

Sir R. M8gic1an

2010-12-11 09:27:30

From: Zyt3x
A quickfix to the breaking problem:
begin
if (not LoggedIn) then
Exit;

if not HUMAN_BREAKING then
if MSI_Players[CurrentPlayer].BreakTime = 0 then
if BREAK_TIME = 0 then
Exit;

if (BankScreen) then
CloseBank;

I'm not sure about the smart problem…
Do I understand you correct?
Doing {$IFDEF SRL_SMART} and commenting out the include smart line prevents smart from loading?


If you're not using smart, SmartSetDebug(true) will give you a compiling error.

Code with {$IFDEFs} is not compiled unless it's definied.

so by doing
{$IFDEF SMART}
SamrtSetDebug(true)
{$ENDIF}

It'll only compile that code if the user is using smart

~RM

Gu3st...

2010-12-11 09:30:32

From: Sir R. Magician
If you're not using smart, SmartSetDebug(true) will give you a compiling error.

Code with {$IFDEFs} is not compiled unless it's definied.

so by doing
{$IFDEF SMART}
SamrtSetDebug(true)
{$ENDIF}

It'll only compile that code if the user is using smart

~RM
Yeah, I know that much, but I wasn't sure if that was all that needed to be changed in order for it to work

Camaro'

2010-12-11 11:16:56

From: Zyt3x
Yeah, I know that much, but I wasn't sure if that was all that needed to be changed in order for it to work


Yea, I only posted that because I think it should be commited, its more of a side note. Yea, thanks for the quickfix for breaking, but I already saw that, and don't think MSI should start using 'cheap' fixes :)

NCDS

2010-12-11 11:18:46

I don't think the ML is the problem. Does this happen when using Reflection as well?

I'll mess withit in just a minute. I've got a few things to do today actually.

Camaro'

2010-12-11 11:35:26

From: NCDS
I don't think the ML is the problem. Does this happen when using Reflection as well?

I'll mess withit in just a minute. I've got a few things to do today actually.


Testing reflection now, will tell you my results.

Reflection when the tree gets chopped down constantly trys searching for the yew, and moves the mouse in the same TPA over and over. Will work on fixing this.

Color will do the same thing as stated above. Don't know how to fix this one.

Camaro'

2010-12-11 14:51:10

Few things needed fixing. I made changes to MSI flag


{******************************************************************************}
{ procedure MSI_Flag; }
{ By: Coh3n Edited by NCDS }
{ Date: 27 September 2010 }
{ Description: Waits while the flag is on the minimap. Will still work when }
{ walking around obstacles }
{******************************************************************************}
procedure MSI_Flag;
var
t: Integer;
label
ProcStart;
begin
ProcStart:
repeat
if (FindNPCChatText('erous', Nothing)) then // Only if total level < 60
begin
ClickContinue(True, True);
t := GetSystemTime + 5000;
while (GetSystemTime < t) do
begin
Wait(500 + Random(300));
if (FindNPCChatText('eave', ClickLeft)) then
Break;
end;
end;

Wait(RandomRange(200, 500));
t := (GetSystemTime + 12000);



MSI_FindRandoms;
MSI_AntiBan(RandomRange(200, 800), ANTI_BAN_CHANCE);

MSI_SubDebug('Flag distance: '+IntToStr(FlagDistance));
if ((FlagPresent) and (FlagDistance <= TOLERANCE_FLAG)) then
Exit;


until((not (FlagPresent)) and (not (IsMoving))) or (t < GetSystemTime);
Wait(RandomRange(200, 500));
if (IsMoving) then
goto ProcStart;
end;

Sometimes if the flag went off the screen(but it was going to come back), and IsMoving would return false(not common) and then the color walking would mess up.

To fix the breaking issue, you must change the part in the main loop to this. (It doesn't check if we set it to break). So I made it check.(I did notice you put it there cause relocating failed, but it should wait if it fails, not break).

// Perform the skill
if (not MSI_AutoObjects) then
begin
if (RelocateAttempts[CurrentPlayer] > 0) then
if (RelocateAttempts[CurrentPlayer] >= 3) then
MSI_UnsetPlayer('Possibly in random ' + Players[CurrentPlayer].Rand, True)
else
begin
with MSI_Players[CurrentPlayer] do
if ((BreakLoads > 0) or (BreakTime > 0) or (HUMAN_BREAKING)) then
MSI_HandleBreaking;
Wait(RandomRange(1500, 4000));
Break;
end;


and change this, to avoid RelocateAttempts from increasing, causing my character to logout when the only yew tree was gone for like 6 seconds :)

in Skills.simba

That AutoInvfull function



end else begin
if (forceFail) then
Exit;

if (waitTime > 0) then
Continue;

if (MSI_Relocate(MSI_Players[CurrentPlayer].Location)) then
begin
tTime := RandomRange(60000, 120000); // Random 1-2 minutes
MSI_SubDebug('Waiting ' + IntToStr(tTime) + ' ms before relocating again');
MarkTime(waitTime);
Break;
end else
begin
with MSI_Players[CurrentPlayer].Scripts[CurrentScript] do
Dec(RelocateAttempts[CurrentPlayer ]);
end;
Wait(1500 + Random(1500));
end;

Those three will make the script (port sarim yews) run, but when the tree is down, it still constantly rotates trying to find the yew (hovering over close trees).

NCDS

2010-12-11 17:55:56

[QUOTE=Camaro';757967]Testing reflection now, will tell you my results.

Reflection when the tree gets chopped down [B]constantly[/B] trys searching for the yew, and moves the mouse in the same TPA over and over. Will work on fixing this.

Color will do the same thing as stated above. Don't know how to fix this one.

Yeah that has nothing to do with Reflection/Color for walking. I'm about to grab some dinner and then I'll be able to sit down for a bit. ( I know I kind of said that earlier too but things come up :/)

Camaro'

2010-12-11 19:59:22

From: NCDS
Yeah that has nothing to do with Reflection/Color for walking. I'm about to grab some dinner and then I'll be able to sit down for a bit. ( I know I kind of said that earlier too but things come up :/)


No problem, life comes first :)

I posted some fixes, and if you want my account just ask on MSN.

NCDS

2010-12-12 15:53:54

[QUOTE=Camaro';758006]Few things needed fixing. I made changes to MSI flag

[SIMBA]
{******************************************************************************}
{ procedure MSI_Flag; }
{ By: Coh3n Edited by NCDS }
{ Date: 27 September 2010 }
{ Description: Waits while the flag is on the minimap. Will still work when }
{ walking around obstacles }
{******************************************************************************}
procedure MSI_Flag;
var
t: Integer;
label
ProcStart;
begin
ProcStart:
repeat
if (FindNPCChatText('erous', Nothing)) then // Only if total level < 60
begin
ClickContinue(True, True);
t := GetSystemTime + 5000;
while (GetSystemTime < t) do
begin
Wait(500 + Random(300));
if (FindNPCChatText('eave', ClickLeft)) then
Break;
end;
end;

Wait(RandomRange(200, 500));
t := (GetSystemTime + 12000);



MSI_FindRandoms;
MSI_AntiBan(RandomRange(200, 800), ANTI_BAN_CHANCE);

MSI_SubDebug('Flag distance: '+IntToStr(FlagDistance));
if ((FlagPresent) and (FlagDistance <= TOLERANCE_FLAG)) then
Exit;


until((not (FlagPresent)) and (not (IsMoving))) or (t < GetSystemTime);
Wait(RandomRange(200, 500));
if (IsMoving) then
goto ProcStart;
end;


Sometimes if the flag went off the screen(but it was going to come back), and IsMoving would return false(not common) and then the color walking would mess up.

The problem here is that 'FlagDistance' returns -1 if it's unsuccessful, which if the flag is not on the MM it clearly would be. I believe I've fixed this issue but I will need to test quick.

[QUOTE=Camaro';758006]
To fix the breaking issue, you must change the part in the main loop to this. (It doesn't check if we set it to break). So I made it check.(I did notice you put it there cause relocating failed, but it should wait if it fails, not break).

// Perform the skill
if (not MSI_AutoObjects) then
begin
if (RelocateAttempts[CurrentPlayer] > 0) then
if (RelocateAttempts[CurrentPlayer] >= 3) then
MSI_UnsetPlayer('Possibly in random ' + Players[CurrentPlayer].Rand, True)
else
begin
with MSI_Players[CurrentPlayer] do
if ((BreakLoads > 0) or (BreakTime > 0) or (HUMAN_BREAKING)) then
MSI_HandleBreaking;
Wait(RandomRange(1500, 4000));
Break;
end;

if ((BreakLoads > 0) or (BreakTime > 0) or (HUMAN_BREAKING)) then
That is already checked in MSI_HandleBreaking.

[QUOTE=Camaro';758006]
and change this, to avoid RelocateAttempts from increasing, causing my character to logout when the only yew tree was gone for like 6 seconds :)

in [b]Skills.simba[/b]

That AutoInvfull function


[SIMBA]
end else begin
if (forceFail) then
Exit;

if (waitTime > 0) then
Continue;

if (MSI_Relocate(MSI_Players[CurrentPlayer].Location)) then
begin
tTime := RandomRange(60000, 120000); // Random 1-2 minutes
MSI_SubDebug('Waiting ' + IntToStr(tTime) + ' ms before relocating again');
MarkTime(waitTime);
Break;
end else
begin
with MSI_Players[CurrentPlayer].Scripts[CurrentScript] do
Dec(RelocateAttempts[CurrentPlayer ]);
end;
Wait(1500 + Random(1500));
end;


Those three will make the script (port sarim yews) run, but when the tree is down, it still constantly rotates trying to find the yew (hovering over close trees).
It shouldn't even be relocating if there is no where to Relocate to. I'll look into that though. Perhaps we should have a 'TotalRelocateAttempts' set in the Script array for scripts that have a chance of failing to relocate often.

Gu3st...

2010-12-12 16:34:40

From: NCDS
if ((BreakLoads > 0) or (BreakTime > 0) or (HUMAN_BREAKING)) then
That is already checked in MSI_HandleBreaking.
Yep! :)
I added this some days ago (2 days or so):
  if not HUMAN_BREAKING then
if MSI_Players[CurrentPlayer].BreakTime = 0 then
if BREAK_TIME = 0 then
Exit;

Coh3n

2010-12-13 00:23:44

Okay, my head's exploding with all these bugs and their fixes. I'm so happy to see all you guys active. I absolutely love it! Any chance someone wants to make a list of the bugs on this thread that still exist? :o

NCDS

2010-12-13 05:33:23

Need someone to test and see as I cant.

Camaro'

2010-12-13 20:06:44

Test what?

Coh3n

2010-12-13 20:24:42

What bugs that were brought up on this thread are still bugs.

I just asked for a list as there were several things brought up. :p

Camaro'

2010-12-13 21:41:16

From: Coh3n
What bugs that were brought up on this thread are still bugs.

I just asked for a list as there were several things brought up. :p


Hmm, will start testing when I get time.

Coh3n

2011-01-13 20:26:13

Okay, I finally had time to look through this thread. :p Here's all my answers.
  1. @{$DEFINE SRL_SMART} - Done.
  2. @Problems with PS Yews - What if we added a WaitToSpawn boolean somewhere (to a type maybe?), that will tell the script to wait until it has spawned. The same thing could be used for mining higher level rocks like mithril, adamantite, or even runite.
  3. The breaking thing you were having should be fixed (will be for sure if we add what I suggested above).
  4. @MSI_Flag - I made some updates a few days ago to make sure it works if the flag does go off the screen. You shouldn't have any problems anymore.
Sorry if I missed something, but I'm pretty sure that's it. :)

Camaro'

2011-01-13 20:41:20

From: Coh3n
Okay, I finally had time to look through this thread. :p Here's all my answers.
  1. @{$DEFINE SRL_SMART} - Done.
  2. @Problems with PS Yews - What if we added a WaitToSpawn boolean somewhere (to a type maybe?), that will tell the script to wait until it has spawned. The same thing could be used for mining higher level rocks like mithril, adamantite, or even runite.
  3. The breaking thing you were having should be fixed (will be for sure if we add what I suggested above).
  4. @MSI_Flag - I made some updates a few days ago to make sure it works if the flag does go off the screen. You shouldn't have any problems anymore.
Sorry if I missed something, but I'm pretty sure that's it. :)


Awesome dude! Your the man :)

Sir R. M8gic1an

2011-01-13 21:34:44

We could add that timer and reflection could also be used to if not check the exact time then perhaps check if the tree is already there before we actually have to move.

~RM

Coh3n

2011-01-13 22:41:05

From: Sir R. Magician
We could add that timer and reflection could also be used to if not check the exact time then perhaps check if the tree is already there before we actually have to move.

~RM

Talking about for relocating? If there was a way to know the exact time until the next tree relocated, that would be absolutely amazing. :p That would also mean we'll be relying on reflection for more than just walking.

NCDS

2011-01-14 05:28:55

From: Coh3n
Talking about for relocating? If there was a way to know the exact time until the next tree relocated, that would be absolutely amazing. :p That would also mean we'll be relying on reflection for more than just walking.


Could still be done with a ifdef and pointer though, if it is deemed possible that is.

Sir R. M8gic1an

2011-01-14 09:38:06

Reflection can do things that colour can't, which is why it can be used for extra features ;)

Like checking things outside of our map :o

~RM

mormonman

2011-01-14 12:50:50

It's possible with the whole timing idea. Each tree has a timer from when it was chopped down.

Sir R. M8gic1an

2011-01-14 12:51:31

From: mormonman
It's possible with the whole timing idea. Each tree has a timer from when it was chopped down.


Gratz on Ref Dev btw

mormonman

2011-01-14 13:10:46

From: Sir R. Magician
Gratz on Ref Dev btw


You noticed before I did lol…:p

Coh3n

2011-01-14 14:26:59

From: mormonman
It's possible with the whole timing idea. Each tree has a timer from when it was chopped down.

But can it be easily accessed? I guess it'd be the same as anything else in reflection.

mormonman

2011-01-14 14:47:51

From: Coh3n
But can it be easily accessed? I guess it'd be the same as anything else in reflection.


No I mean you create a timer from when the bot last saw the object being there.

Coh3n

2011-01-14 14:56:26

From: mormonman
No I mean you create a timer from when the bot last saw the object being there.

Yeah that was one of the original ideas, but the spawn times depend on the population of the world, do they not?

mormonman

2011-01-14 15:17:24

From: Coh3n
Yeah that was one of the original ideas, but the spawn times depend on the population of the world, do they not?


Doesn't matter, just go to the one that was chopped down first, it should spawn first.

Coh3n

2011-01-14 15:20:41

From: mormonman
Doesn't matter, just go to the one that was chopped down first, it should spawn first.

I guess that would work in some situations. Say there was 2 trees. You're chopping at A, other people are at B. B goes down, and you don't know it. Shortly after, A goes down. You walk to B, find out it's already down, and it thinks A was down first, when B actually was.

I'm not really sure how likely that scenario is, but just something to think about. :p

Sir R. M8gic1an

2011-01-14 16:15:18

I've got a better idea than that ;)

Reflection can check things outside of your MS. Not sure if it can check things outside of your MM, but I think it can.

I'm gonna make a TScriptLocation that takes resources into account & etc ;)

~RM

mormonman

2011-01-14 19:41:36

From: Coh3n
I guess that would work in some situations. Say there was 2 trees. You're chopping at A, other people are at B. B goes down, and you don't know it. Shortly after, A goes down. You walk to B, find out it's already down, and it thinks A was down first, when B actually was.

I'm not really sure how likely that scenario is, but just something to think about. :p


As long as you are using reflection you could just check to see how many players were around a particular tree. That is usually a sign of where the next one is coming up.

Coh3n

2011-01-14 19:49:41

From: mormonman
As long as you are using reflection you could just check to see how many players were around a particular tree. That is usually a sign of where the next one is coming up.

Yes, that would work as well. :)