SRL Archive - MSI Bugs

Right clicking rocks


Coh3n

2010-07-14 22:02:21

Hey guys,

I don't have time to look at this now, but I was just watching it a little, and it right clicks the rocks A LOT. The thing is, it right clicks, but it doesn't choose the option? I think it should left click a lot more than it's right clicking, and it seems we need to change the option a little. I'm not exactly sure why it's not working.

I'm going to leave it running over night with 8 players, we'll see how it goes. :)

NCDS

2010-07-15 00:37:36

I'm quite sure the problem with it not choosing the option is with ChooseOption(); It happens to me a lot and I have to use something like:

WaitOptionMulti(['in', 'ne', 'Mine', 'ne R', 'ock'], ...);

That usually fixes it..

Possible solution to this, make .option an array, then we can do what is shown above, and hopefully that will solve that problem.

The reason it RightClick's is because I have:

if WaitUpText(Rocks[i].UpText, 1200) then
begin
GetMousePos(x, y);
if Rocks[i].RightClickOnly then
Mouse(x, y, 0, 0, Rocks[i].RightClickOnly)
else
begin
Click := (Random(4) < 2);
Mouse(x, y, 0, 0, Click);
end;

if (not(Click)) and Rocks[i].RightClickOnly then
Result := WaitOption(Rocks[i].Option, 2000)
else
Result := True;

if Result then
MSI_WaitWhileMining(Rocks, i, Point(tP.x, tP.y));
Exit;
end;
end;
in 'MSI_MineRock;' by your request ;)


As you can see above, the reason it RightClick's is because every time it finds the rock, it chooses randomly using this:

begin
Click := (Random(4) < 2);
Mouse(x, y, 0, 0, Click);
end;
to click left or right. Right now it has a 50% chance of each.

The main reason it Clicks so much right now is because WaitWhileChopping; is messing up, I'm assuming anyways.

However, if you still would rather it RightClick less we could make it:

begin
Click := (Random(3) < 2);
Mouse(x, y, 0, 0, Click);
end;
and that would only make it RightClick a third of the time.

I probably wont have much time tomorrow, but Friday I can probably work on WaitWhileMining; and hopefully get that working 100%.

Coh3n

2010-07-15 05:55:39

Yes, the right clicking should be more like

Click := (Random 10 < 7);
I work all day today, but I should be able to look tonight if no on else does.

E: I also thought about for something to add to WaitWhileMining, thoughts? It would obviously be a little better, but this is the basic idea.

procedure WaitWhileMining;
begin
for i := 1 to 28 do
while (not ExistsItem(i)) do
Wait(RandomRange(500, 1000));
end;

E2: I would also probably be useful if we added some debugging to the mining functions seeing as we don't use the Objects.scar functions.

NCDS

2010-07-15 06:43:49

From: Coh3n
Yes, the right clicking should be more like

Click := (Random 10 < 7);
I work all day today, but I should be able to look tonight if no on else does.

E: I also thought about for something to add to WaitWhileMining, thoughts? It would obviously be a little better, but this is the basic idea.

procedure WaitWhileMining;
begin
for i := 1 to 28 do
while (not ExistsItem(i)) do
Wait(RandomRange(500, 1000));
end;


What if someone else gets the ore though?

From: Coh3n

E2: I would also probably be useful if we added some debugging to the mining functions seeing as we don't use the Objects.scar functions.


I was thinking the same.


Edit:
I committed:

Click := (Random(10) < 7);

I can maybe get to something later tonight, but the rest will be tomorrow hopefully :)

Coh3n

2010-07-15 17:15:39

That would just be one thing to add, it wouldn't be the only thing we look for. ;)

NCDS

2010-07-15 18:09:42

From: Coh3n
That would just be one thing to add, it wouldn't be the only thing we look for. ;)


Do you agree with making the .Option a TStringArray then?

Coh3n

2010-07-15 23:21:36

From: NCDS
Do you agree with making the .Option a TStringArray then?

It may not be a bad idea, but we shouldn't need it. I would rather try like 'ne Rock', 'e Ro', 'e Roc' before switching. The thing about using just parts from the word 'Rock' is that is could choose 'Examine Rock' rather than 'Mine Rock'. I know ChooseOption is suppose to click the first occurrence, but I've had it pick the second, or sometimes third.

NCDS

2010-07-15 23:42:47

Yeah, I'll mess with it while testing. Let me know if you fix it before I do.

Sir R. M8gic1an

2010-07-16 07:28:23


Click := (Random(10) < 7);

CONSTANTS ! ! ! ! !

['ine Rock', 'ine', 'Mine']

~RM

NCDS

2010-07-16 12:24:38

From: Rasta Magician

Click := (Random(10) < 7);

CONSTANTS ! ! ! ! !

['ine Rock', 'ine', 'Mine']

~RM


I'll get it when I switch it to use MSI_FindObj();

nickrules

2010-07-19 10:59:17

On the topic of right clicking rocks, I have also noticed, that it right clicks one, doesn't choose the option, and instead, just kind of 'hangs' there for awhile (I assume a timeout of some sort?),
and then it doesn't always find a rock, because the right-click menu hides uptext and covers up rocks (was at VEM).
Could just be my fonts not working right. Idk, i'll restart simba and try some other things to see if i can get it to work.

Coh3n

2010-07-19 11:10:07

From: nickrules
On the topic of right clicking rocks, I have also noticed, that it right clicks one, doesn't choose the option, and instead, just kind of 'hangs' there for awhile (I assume a timeout of some sort?),
and then it doesn't always find a rock, because the right-click menu hides uptext and covers up rocks (was at VEM).
Could just be my fonts not working right. Idk, i'll restart simba and try some other things to see if i can get it to work.

It's not just your fonts, it's everyone's. Either that or ChooseOption is broken. Anyway, it does the same for me. I'm gonna see if I can fix this right now.

nickrules

2010-07-19 11:17:33

I just modified the mining.scar file. Temporary fix.

Edit: Just realized this was my 100th post :norris:

Coh3n

2010-07-19 11:22:13

From: nickrules
I just modified the mining.scar file. Temporary fix.

Fixed in revision 159. Yeah, the bug was in MSI_MineRocks.

Thanks nick. :)

NCDS

2010-07-19 15:39:25

From: Coh3n
Fixed in revision 159. Yeah, the bug was in MSI_MineRocks.

Thanks nick. :)


It wasn't just ChooseOption messing up?

MSN me, I'm curious ;)