SRL Archive - RS3 Help

DTM randomly quits working


HKbotz

2015-06-19 20:29:31

I recently set up multiplayer(with player form/manager) on my script, however after it goes through 1 or 2 players at least 2 of the DTMs stop working(not sure if others because it breaks on the two and tries another account). It is suppose to find a ring and necklace, and it runs just fine for at least the first player, and sometimes the second, but after it switches it thinks it can't find them and I have absolutely no idea why. I've looked over the logic about a thousand times and it's definitely a problem with it finding the DTM. I know the DTM is fine since it works for the first player and if I check for it in the DTM editor it shows up fine. The DTMs are set when the script first starts and when it ends, so they aren't getting unset or overwritten or anything. Just to make sure I tried setting and unsetting them at the beginning and end of the main loop but it didn't change anything. I am sure the DTMs aren't getting modified anywhere else(at least not by my doing) and even if they were it would break on the first player, not just the 2nd or 3rd+.

I am completely lost as to why it's doing it, but it makes multiplayer rather useless since it can only run, at best, two accounts. Has anyone else had any other issues similar to this, and if so, any ideas on how to fix it? It was never an issues until I added multiplayer, so I have a feeling it has something to do with that, although I have no clue what(maybe memory is getting corrupted, I really don't know). It doesn't crash simba and there's no out of bounds errors or anything like that.

I'd rather not post the script, but I will post parts if necessary.

Edit: I've narrowed it down to having to do with the action bar. If I run this(5 players selected with player form):


program new;

{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i srl-6/lib/misc/srlplayerform.simba}
var
RingDTM, x, y: integer;

//so the player form isn't super tiny making it impossible to check players
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'test';
scriptHelpThread := '';

editBoxLabels := ['1', '2', '3'];
editBoxDefaults := ['text', 'text', 'text'];
editBoxHints := ['1', '1', '1'];

checkBoxLabels := ['1', '2', '3'];
checkBoxDefaults := ['true', 'true', 'true'];
checkBoxHints := ['1', '2', '3'];

comboBoxLabels := ['1', '2', '3'];
comboBoxDefaults := ['1', '2', '3'];
comboBoxHints := ['1', '2', '3'];

setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['1', '2', '3'];
comboBoxItems[1] := ['1', '2', '3'];
comboBoxItems[2] := ['1', '2', '3'];
end;
end;

begin
setupSRL();
initPlayerForm();
runPlayerForm();

//Ring of dueling
RingDTM := DTMFromString('mggAAAHicY2NgYGBjgABeIGaH8vmgNCcUMwIxD1SdsJI2w6UtsgxFSfwMuxZIMWydI8kgWC3C8B8oJ44Fs0L1o2MIAAAbUwg6');

players.setup(playerForm.players);
currentPlayer := 0;

players[currentPlayer].login();
while (players.getActive > 0) do
begin
wait(5000); //give screen time to fully load
if (findDTM(RingDTM, x, y, actionbar.getSlotBox(1))) then //check in first slot of actionbar for ring
writeln('Found RingDTM.')
else
writeln('No RingDTM.');
players.next(false);
end;
freeDTM(RingDTM);
end.

It works for the first and last account this time, but not the rest.
It works if I change actionbar.getSlotBox(1) to getClientBounds(), so it isn't the DTM changing value(no idea how it could anyway).

The ring is a Ring of Dueling and is in first slot of the action bar on all accounts.

Edit2: Fixed by resetting the dynamic interface. Not sure if everything was necessary besides action bar but I did it anyway.
  actionbar.__init();
chatbox.__init();
mainscreen.__init();
__areDynamicInterfacesSet := false;
__setDynamicInterfaces();

J_R

2015-06-19 22:13:13

Maybe try increasing the tolerances? There have been cases where objects are ever so slightly differently colored on different worlds.

HKbotz

2015-06-19 22:31:27

From: J_R
Maybe try increasing the tolerances? There have been cases where objects are ever so slightly differently colored on different worlds.


I have. And it always works the first time, and sometimes second, but never after that. I've also ran it so all accounts are on the same world, and restarted it with the account already logged in on the one it fails and it works fine, so the color couldn't have changed.

I've also watched it really closely to make sure the ring/necklace weren't blocked by something(they're on my action bar), and nothing was covering them or anything like that.

cosmasjdz

2015-06-20 01:57:56

May be the issue with toobig dtm in relation to the actionbar box and toolow center cordination tolerance so it goes out of bounds and gives false. Id better use bitmap and findbitmaptilerance() or just lower the dtm width and heigth or just probably simplest way is to hardcode tbox where you search it a bit wider than getslotbox gives you. Another issue might be getslotbox fails especially if any chooseoption or upptext is over actionbar. Its same issue as within the bank when you hover over bounds it gives false false.

HKbotz

2015-06-20 02:26:00

From: cosmasjdz
May be the issue with toobig dtm in relation to the actionbar box and toolow center cordination tolerance so it goes out of bounds and gives false. Id better use bitmap and findbitmaptilerance() or just lower the dtm width and heigth or just probably simplest way is to hardcode tbox where you search it a bit wider than getslotbox gives you. Another issue might be getslotbox fails especially if any chooseoption or upptext is over actionbar. Its same issue as within the bank when you hover over bounds it gives false false.


I managed to fix it. It wasn't chooseoption or uptext in the way. I think it was looking in wrong spot for action bar slot since some of my accounts have slightly different chatbox heights which affects where the action bar is, and they weren't getting reset when the player switched. When I reset the dynamic interfaces it worked fine.