SRL Archive - OSR Help

GetColor, FindColor etc..


weequ

2012-07-28 10:09:44

So I've been away for a couple of weeks and now I can get nothing working..

When I do GetColor(100, 100) it returns different color than the color picker even when the backround is not changing. Also I can't get FindColor functions to work.

I noticed that the navigation bar (Home, Support, Forums, Clans) is now part of the client and I'm wondering if this has something to do with it?

riwu

2012-07-28 10:13:59

Yeah the nav bar added 50 pixel to y-coordinates, so color picker is returning wrong coordinates currently. Make sure u have the latest simba and smart as well. (http://villavu.com/forum/showthread.php?t=87258)

weequ

2012-07-28 10:30:58

From: riwu
Yeah the nav bar added 50 pixel to y-coordinates, so color picker is returning wrong coordinates currently. Make sure u have the latest simba and smart as well. (http://villavu.com/forum/showthread.php?t=87258)
Ok thx. I just found out that SetupSRL changes the coordinates where FindColor etc searches which in my opinion is a bad idea because you'd need a different color picker for rs and other things. But I understand if it's just a quickfix :p

Brandon

2012-07-28 11:57:16

If this gets pushed, you can disable the offset with one line: https://github.com/Brandon-T/SRL-5/commit/e3835638773e2714e897f11da7e6848cfb72fb2f

weequ

2012-07-28 12:01:32

From: Brandon
If this gets pushed, you can disable the offset with one line: https://github.com/Brandon-T/SRL-5/commit/e3835638773e2714e897f11da7e6848cfb72fb2f
But will I then be able to use SRL? (Ofc I could change it back every time I use SRL function)

Coh3n

2012-07-28 12:24:48

From: weequ
But will I then be able to use SRL? (Ofc I could change it back every time I use SRL function)
Yes. He added a variable to disable the nav bar.

I think you'll have to do this, though:

SRL_DisableNavBar := True;
SRL_ResetNavBar();
Actually, Brandon, I would even rather see two new functions. SRL_DisableNavBar and SRL_EnableNavBar. That would be easier than a variable.

SRL_ResetNavBar can still be used as it is.

Brandon

2012-07-28 12:34:20

From: Coh3n
Yes. He added a variable to disable the nav bar.

I think you'll have to do this, though:
Simba Code:
[LEFT]SRL_DisableNavBar := True;
SRL_ResetNavBar();
[/LEFT]

Actually, Brandon, I would even rather see two new functions. SRL_DisableNavBar and SRL_EnableNavBar. That would be easier than a variable.

SRL_ResetNavBar can still be used as it is.


Yeah that would be the usage. If it's a non-rs script you can just do SRL_DisableNavBar := True SetupSRL right after. After that there'll be no need to call it again.

I don't mind making two new functions for it but I thought a variable would be easier. You just call it at the start of your script before setupsrl and it will never need to be called again. If I make it a function would it be the type that is called every time or just a one timer like the variable? Basically I'm asking if you want me to turn that variable into a function.

weequ

2012-07-28 12:35:06

I think it would probably be easiest to just add the offset to every function in srl that uses coordinates.

For example (msx1+xcoordinate, msy1+ycoordinate) could be used to avoid future hustle if they decide remove the navigation bar or add other bars.

Brandon

2012-07-28 12:42:15

From: weequ
I think it would probably be easiest to just add the offset to every function in srl that uses coordinates.


It already does that.

Procedure SRL_ResetNavBar;
var
W, H: Integer;
begin
ImageResetClientArea; //Reset the position the client reads from. 0,0 will be the very top left rather than the 50 offset.
MouseResetClientArea; //Reset the mouse too.
GetClientDimensions(W, H);

if (Not SRL_DisableNavBar) //If the user wants to use the offsets then..
begin
If (FoundBar) then //if the bar is found.
begin
ImageSetClientArea(SRL_NAVBAR_INGAME_X, SRL_NAVBAR_INGAME_Y, W, H); //Offset the client by 50 pixels (basically ignores the navbar at the top).. H - Offset to remove black bar at the bottom.
MouseSetClientArea(SRL_NAVBAR_INGAME_X, SRL_NAVBAR_INGAME_Y, W, H); //do the same for the mouse.
end else
begin
ImageSetClientArea(SRL_NAVBAR_INGAME_X, SRL_NAVBAR_LOGIN_Y, W, H); //if not logged in then offset by 22 due to the black bar glitch at the top (that black bar that x button sits in).
MouseSetClientArea(SRL_NAVBAR_INGAME_X, SRL_NAVBAR_LOGIN_Y, W, H); // same with the mouse.
end;
end; //the user doesn't want to use the offset so do nothing.. no need for the else statement.
end;

Coh3n

2012-07-28 12:43:18

From: Brandon
Yeah that would be the usage. If it's a non-rs script you can just do SRL_DisableNavBar := True SetupSRL right after. After that there'll be no need to call it again.

I don't mind making two new functions for it but I thought a variable would be easier. You just call it at the start of your script before setupsrl and it will never need to be called again. If I make it a function would it be the type that is called every time or just a one timer like the variable? Basically I'm asking if you want me to turn that variable into a function.
The idea is that it can be called anywhere, if the scripter wants, not just at the start. If you have functions, you just call one line of code, not two.

Doesn't matter too much, that is just how I would do it. :)

From: weequ
I think it would probably be easiest to just add the offset to every function in srl that uses coordinates.

For example (msx1+xcoordinate, msy1+ycoordinate) could be used to avoid future hustle if they decide remove the navigation bar or add other bars.
I don't think you realize how much work that actually is. :p

Brandon

2012-07-28 12:47:39

From: Coh3n
The idea is that it can be called anywhere, if the scripter wants, not just at the start. If you have functions, you just call one line of code, not two.

Doesn't matter too much, that is just how I would do it. :)

I don't think you realize how much work that actually is. :p


LOL the first day the navbar came out, I actually went through and added IGX and IGY (InGameY) to all functions.. It's what got the name "Ghetto fix" LOL.

K I'll add the function but it'll be something really simple like:


Procedure SRL_DisableOffset; //Dunno what to name it.
begin
ImageResetClientArea; //Reset everything (all finder functions, etc..) to normal.
MouseResetClientArea; //Reset the mouse offset to normal!
end;

Coh3n

2012-07-28 12:53:04

Have two functions. SRL_EnableNavBar, that calls ImageSetClient and MouseSetClient. Then have SRL_DisableNavBar that calls Image/MouseClientReset. You can then call those two functions in SRL_ResetNavBar (or whatever the current function is) instead of calling the client setting functions each time. Hopefully that wasn't too confusing. :p

weequ

2012-07-28 12:58:13

Ok I'm starting to agree with you guys. Then we just need a color picker with custom offset?

Brandon

2012-07-28 13:05:43

From: Coh3n
Have two functions. SRL_EnableNavBar, that calls ImageSetClient and MouseSetClient. Then have SRL_DisableNavBar that calls Image/MouseClientReset. You can then call those two functions in SRL_ResetNavBar (or whatever the current function is) instead of calling the client setting functions each time. Hopefully that wasn't too confusing. :p


Done. https://github.com/Brandon-T/SRL-5/commit/6f57edb367d7844569bbb146682593353235341a

Split the ResetBar into two functions. One to enable, one to disable. Enable will allow the bar to live and disable will completely ignore it by offsetting the client by 50.

From: weequ
Ok I'm starting to agree with you guys. Then we just need a color picker with custom offset?


Yeah. I think that'd have to be built in though. It shouldn't be hard to actually add to simba. Just make it obey the offset just like the mouse :)

Wizzup?

2012-07-28 13:36:21

From: Brandon
Yeah. I think that'd have to be built in though. It shouldn't be hard to actually add to simba. Just make it obey the offset just like the mouse :)


Something like this. The thing is that Simba does not share the client details
with a script. I'd probably make something that allows one to ``fill in and
save'' a custom offset in Simba settings. Then print the colour like:


Picked colour: 15461613 at (50, 0). Without offset: (0, 0)

blinkblink

2012-07-28 14:02:26

From: Wizzup?
Something like this. The thing is that Simba does not share the client details
with a script. I'd probably make something that allows one to ``fill in and
save'' a custom offset in Simba settings. Then print the colour like:


Picked colour: 15461613 at (50, 0). Without offset: (0, 0)


that would be great for no confusions