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):
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.
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();