SRL Archive - MSI Suggestions

PriorityAutoing


NCDS

2010-09-14 02:24:25

All the code is in Skills.Simba.

I just ran 2 loads of mining and everything seems to be working well.


Skills.Simba:

{******************************************************************************}
{ function MSI_RandomizeArray(Objs: TIntegerArray): TIntegerArray; }
{ By: NCDS & Coh3n }
{ Description: Returns the Objects array in a random order }
{******************************************************************************}
function MSI_RandomizeArray(Objs: TIntegerArray): TIntegerArray;
var
i, o: Integer;
begin
SetLength(Result, Length(Objs));

while (Length(Objs) <> 0) do
for i := 0 to High(Result) do
begin
o := Random(Length(Objs));
Writeln(IntToStr(Objs[o]));
Result[i] := Objs[o];
DeleteValueInIntArray(Objs, o);
end;
end;

{******************************************************************************}
{ function SumTIA(TIA: TIntegerArray); }
{ By: RM }
{ Description: Returns the Sum of 'TIA' }
{******************************************************************************}
function SumTIA(TIA: TIntegerArray): Integer;
var
i: Integer;
begin
for i := High(TIA) downto 0 do
Result := Result + TIA[i];
end;

{******************************************************************************}
{ function MSI_ChooseObject(Priorities: TIntegerArray): Integer; }
{ By: RM, Coh3n, NCDS }
{ Description: Chooses an Object based on 'Priorities' }
{******************************************************************************}
function MSI_ChooseObject(Priorities: TIntegerArray): Integer;
var
TIA: TIntegerArray;
i , Sum, CurrSum: Integer;
begin
SetLength(TIA, Length(Priorities));
Sum := SumTIA(Priorities);

for i := 0 to High(Priorities) do
begin
CurrSum := CurrSum + Priorities[i];
TIA[i] := CurrSum;
end;

Sum := Random(Sum) + 1;

for Result := 0 to High(TIA) do
if Sum <= TIA[Result] then
break;
end;

{******************************************************************************}
{ function MSI_RearrangeArray(Objs, Priorities: TIntegerArray): TIntegerArray; }
{ By: NCDS & Coh3n }
{ Description: Returns the Objs array in a rearranged order }
{******************************************************************************}
function MSI_RearrangeArray(Objs, Priorities: TIntegerArray): TIntegerArray;
var
i, o: Integer;
begin
SetLength(Result, Length(Objs));

if (Length(Objs) <> Length(Priorities)) or (Length(Priorities) = 0) then
begin
Result := MSI_RandomizeArray(Objs);
Exit;
end;

while (Length(Objs) > 0) do
for i := 0 to High(Result) do
begin
o := MSI_ChooseObject(Priorities);
Result[i] := Objs[o];
DeleteValueInIntArray(Objs, o);
DeleteValueInIntArray(Priorities, o);
end;
end;

Sir R. M8gic1an

2010-09-14 04:37:43

Sounds cool :)

~RM

Gu3st...

2010-09-14 05:05:48

Awesome :) gj

Sir R. M8gic1an

2010-09-14 12:38:42

Errr…

I've been running the miner, hoping to see my char switching from copper to tin every now and then as I put it as 50 / 50. However, what happens is it mines a full load of tin then a full load of copper.

At least I had thought it would give me say 14 tin and 14 copper per inv, not 14 loads of tin and 14 loads of copper :S … And I think many would share this view.

~RM

NCDS

2010-09-14 13:01:26

From: Sir R. Magician
Errr…

I've been running the miner, hoping to see my char switching from copper to tin every now and then as I put it as 50 / 50. However, what happens is it mines a full load of tin then a full load of copper.

At least I had thought it would give me say 14 tin and 14 copper per inv, not 14 loads of tin and 14 loads of copper :S … And I think many would share this view.

~RM


Indeed that's not how it's supposed to work at all, and I'm not sure why it's doing that.

I'm just letting it choose randomly, but it seems to be working properly. I don't see why setting the priorities would make in not work right though.

However, it was quite late when I committed it so I guess I could have messed something up.

I'll have a quick look.

Edit:

objects := MSI_RearrangeArray(objects, priorities);
That's how the PriorityAutoing feature is handled and I don't see any reason that would make you do a full load of one and then a full load of the other.

Take a look in MSI_AutoObjects if you would like. I'm a little strapped for time atm.

Sir R. M8gic1an

2010-09-14 14:21:43

My bad actually. I incorrectly merged my objects.simba with the repos one. Sorry for that.

~RM

NCDS

2010-09-14 14:31:33

From: Sir R. Magician
My bad actually. I incorrectly merged my objects.simba with the repos one. Sorry for that.

~RM


No problem at all, just glad you got it worked out. :)

Coh3n

2010-09-14 15:59:27

Nice job, glad this was added. :) I have a 15h run right now with an older version, so I want to see how long it can go. Also, I've been testing the Player Remote a lot and it's been working very nicely. Props to Shuttleu for the idea/extension. :)

WT-Fakawi

2010-09-14 16:46:14

Mining Levels?

Sir R. M8gic1an

2010-09-20 06:22:16

@fawk: 40+, from MSI

I've figured out why the priority autoing is working per load rather than per ore.

Our problem before was that we would mostly always get what was first in the array.
Now our problem is exactly the same, although what is first in the array is sometimes different. We need to call the Priority functions at a lower level, rather than at a high level like we have it now. I'll see what I can do..

~RM

NCDS

2010-09-20 08:56:10

My testing account is right around 50 from this.


Later today as well as tomorrow I should have a good amount of time to do some things.

Coh3n

2010-09-20 13:30:32

From: Sir R. Magician
@fawk: 40+, from MSI

I've figured out why the priority autoing is working per load rather than per ore.

Our problem before was that we would mostly always get what was first in the array.
Now our problem is exactly the same, although what is first in the array is sometimes different. We need to call the Priority functions at a lower level, rather than at a high level like we have it now. I'll see what I can do..

~RM

I thought the functions that changed the order of the objects array were called each time FindObjects was called, so that it would be in a different order each time?

Sir R. M8gic1an

2010-09-21 03:57:48

From: Coh3n
I thought the functions that changed the order of the objects array were called each time FindObjects was called, so that it would be in a different order each time?


I didn't see it there? I only saw them in skills.scar and then being called in mainloop.scar; I'l keep on digging whenever i get back to it.

~RM

Coh3n

2010-09-22 01:15:03

From: Sir R. Magician
I didn't see it there? I only saw them in skills.scar and then being called in mainloop.scar; I'l keep on digging whenever i get back to it.

~RM

It's already been fixed. :)