SRL Archive - OSR Help

Lobby Kick Detection


mrlewcc

2013-09-20 15:55:31


Hey I am working on a Bot which has info for a friends chat to stop people from being scammed by impostors such as "[TIP]Dont trade a non rank your money" and sometimes a rank kicks it from the Friends Chat and I am not on to switch the account when it is running on a VPS so I need it to auto switch accounts once it gets kicked I have everything up to that including switching an account after, at the moment what I have is:-

function WhiteText: String;
var
Box :TBox;
TPA :TPointArray;
begin
FindColors(TPA, clWhite, 70, 381, 672, 400);
Box := GetTPABounds(TPA);
Result := GetTextAtExWrap(Box.X1, Box.Y1, Box.X2, Box.Y2, 0, 3, 4, clWhite, 0, StatChars);
end;

I think that is right to detect for the white text however I don't know if that is right and how to detect that it is kicked.

Thanks :)

Ian

2013-09-20 16:12:47

Are you getting any errors? What does the the function give you as the text when you run it?

mrlewcc

2013-09-20 16:16:22

From: BMWxi
Are you getting any errors? What does the the function give you as the text when you run it?


Well when I add the do this until I get "Type mismatch at line 92" is it since its a string and not a boolean and since people's names have white text inside of it I can't just make it detect for white text since it will just keep hoping accounts when someone speaks so I need a way of adding whitetext and when that line pops up and Im not even sure if my whitetext function is right.

The Killer

2013-09-20 16:26:19

It's because the font got updated. What you're doing is correct. I'd count pixels.
Another option would be to search for the join channel box.

But if its really your fc and you are not working on a spammer, you should consider telling your ranks they will be punished if they kick it (and just give it general rank so only owner (you) can kick it).

mrlewcc

2013-09-20 16:28:22

From: The Killer
It's because the font got updated. What you're doing is correct. I'd count pixels.


How would I be able to detect that?

The Killer

2013-09-20 16:31:26

From: mrlewcc
How would I be able to detect that?


You could eithier use dtm or bitmap search for the Join channel button or use countcolours function on the white text

mrlewcc

2013-09-20 16:35:13

From: The Killer
You could eithier use dtm or bitmap search for the Join channel button or use countcolours function on the white text


I don't really know how to do that I'll try I guess :P

Thanks

The Killer

2013-09-20 16:42:33

From: mrlewcc
I don't really know how to do that I'll try I guess :P

Thanks

Function CountColorTolerance(Colour, x1, y1, x2, y2, tol:Integer): Integer;
So this function is going to be your best friend here. It will literally count the amount of pixels you have of your selected colour in a box (do it for the bottom line?)
It then returns the amount, so we want to use InRange(Value, min, max): boolean; here. You need to find out how many pixels the kicked message is and have that with around 10 pixels below and above for your max and min.

Hopefully this should be sufficient, but reply if you still don't quite understand :)

JennyCocoX

2013-09-20 17:03:38

From: The Killer
Function CountColorTolerance(Colour, x1, y1, x2, y2, tol:Integer): Integer;
So this function is going to be your best friend here. It will literally count the amount of pixels you have of your selected colour in a box (do it for the bottom line?)
It then returns the amount, so we want to use InRange(Value, min, max): boolean; here. You need to find out how many pixels the kicked message is and have that with around 10 pixels below and above for your max and min.

Hopefully this should be sufficient, but reply if you still don't quite understand :)


The problem I see here is that
Now talking in friends chat channel is also white colour and also roughly same amount of pixel compared to the names!
It is slightly longer though so that does work in your favour if you extend the search box so it can include both this message and the message you need.
I would only look in area at the bottom and of course like Killer said you need to find out exactly how much pixels.
GL

mrlewcc

2013-09-20 17:21:10

From: JennyCocoX
The problem I see here is that
Now talking in friends chat channel is also white colour and also roughly same amount of pixel compared to the names!
It is slightly longer though so that does work in your favour if you extend the search box so it can include both this message and the message you need.
I would only look in area at the bottom and of course like Killer said you need to find out exactly how much pixels.
GL


I'm trying with both methods now Killer has helped me out :P