Hi,
Is there a way to check if a player is already located in lumbridge?
- Thank you!
Hi,
Is there a way to check if a player is already located in lumbridge?
- Thank you!
See if you can find a way to walk to lumbride, but not actually click. But there isn't a written in include like
checkiflumbride or something.
You could do a symbol check or a colour check of some kind.
To make it most effective add them both together in something like this:
SCAR Code:Function InLumbridge: Boolean;
Var
x, y:integer;
Begin
If FindSymbol(x, y, 'water') then
If FindColorTolerance(x, y, {colour}, MSX1, MSY1, MSX2, MSY2, {tolerance}) then
Result := true
else
Result := false;
end;
Not sure if that would compile, you have to find something that is unique to lumbridge, and do a search for that unique item, if found then the function returns that its in lumbridge.
Hahah yea lol, i've been trynna find something unique in in lumbridge for soooo long nowand when i did find something pretty much suitable, that place is really crowded so most of the times it'll prolly not detect it due to players covering up the symbol... :S
Probably lowering the accuracy would help, as the water symbol is pretty much unique, as low as 0.2 may work.
Try FindSymbols. Where exactly in lumby? Screenshot please? Doors might help.
Or u could use Reflection.
I do visit every 2-6 months
SCAR Code:Function InLumby: Boolean;
var x, y: Integer;
begin
if FindSymbol(x, y, 'water') then
result := (CountColor(FindLumbyRoadColor, mmx1, mmy1, mmx2, mmy2) > 2000);
end;
Originally Posted by irc
or... you could just Home Tele, so you know the exact location you're at in lumby.

Careful, you're leaving result unassigned in once branch of execution. It may be initialized to a reliable value by the script engine, but it's bad practice to rely on implementation details of the engine. A future engine upgrade might change that behavior and break your code.
SCAR Code:Function InLumby: Boolean;
var x, y: Integer;
begin
[B]result := false;[/B]
if FindSymbol(x, y, 'water') then
result := (CountColor(FindLumbyRoadColor, mmx1, mmy1, mmx2, mmy2) > 2000);
end;
Of course you could do this as well:
SCAR Code:Function InLumby: Boolean;
var x, y: Integer;
begin
result := FindSymbol(x, y, 'water') and (CountColor(FindLumbyRoadColor, mmx1, mmy1, mmx2, mmy2) > 2000);
end;




Like I said, it does in this version. It may be unlikely to change, but think of it as a failsafe, a more portable variant, and code that is easier for a reader to understand.
Now, if unnecessary variable init were to become a performance problem in a particular location, one would be quite justified in commenting it out with a note about why it is a problem. However, it has been said, premature optimization is the root of all evil, meaning, among other things, that code should first be correct and clear before being tweaked for speed.
On the other hand, if you /want/ code that is difficult to follow ('if it was hard to write, it should be hard to read!'), perhaps to dazzle noobs with one's superior scripting talent, or whatever (nothing wrong with this, it's why we have things like the The International Obfuscated C Code Contest, it's great fun!), stuff like this, and more, is certainly a fair standard (or, perhaps, non-standard).
Anyway, my advice was just that one ought to be aware that leaving vars uninitialized in that way can potentially be a source of problems, depending on what happens to the code in the future, not necessarily that it is, in fact, a problem in this case. Take it or leave it.
There are currently 1 users browsing this thread. (0 members and 1 guests)