SRL Archive - OSR Help

FindSymbol - Transportation.


P1ng

2012-06-07 01:17:28

EDIT: Sorry, found it, it was called 'arrow' feel free to delete.

I am writing a function for my script to check whether it is at the correct location to proceed with doing whatever it needs to at each location, so far I have this.
function CheckLocation: Integer;
var
x,y: integer;
begin
if FindSymbol(x,y,'bank') then
begin
Result := 0;
WriteLn('We are at the bank.');
end else
if FindSymbol(x,y,'altar') then
begin
Result := 1;
WriteLn('We are at the ruins.');
end else
if FindSymbol(x,y,'TRANSPORTATION SYMBOL') then
begin
Result := 2;
WriteLn('We are at the altar.');
end else
WriteLn('We are not at a known location.');
TerminateScript;
end;
But I'm trying to find a symbol for the 'transportation' icon on the minimap. Like you would find at portals in the essence mine and/or runecrafting altars I have searched through the include and haven't found anything that would suggest there is a pre-made bitmap in the include for this, do I need to make my own bitmap?

J J

2012-06-07 03:53:20

This achieves the same with less lines:
function CheckLocation: String;
var
X, Y, i: integer;
Symbols: Array of String;

begin
Symbols := ['bank', 'altar', 'arrow'];
for i:=0 to 2 do
begin
if FindSymbol(X, Y, Symbols[i]) then
begin
Result := Symbols[i];
Break;
end;
end;
end;
Other then that, good you got it sorted out :P

Then you can have a case to define where you are in the mainloop
//Mainloop;
begin
case CheckLocation of
'bank': begin
WriteLn('We are at the bank');
//Banking procedures
end;
'altar': begin
WriteLn('We are at the ruins');
//Ruins procedures
end;
'arrow': begin
WriteLn('We are at the altar');
//Altar procedures
end;
end;
end.

P1ng

2012-06-07 08:49:25

Thanks for the reply :) but I ended up separating it up into individual functions so that it would return a boolean and I could use it with WaitFunc

putonajonny

2012-06-07 09:01:58

Btw you know there are symbol constants, like Symbol_Bank instead of 'bank'

P1ng

2012-06-07 09:28:10

What is the difference between using them and the string?

putonajonny

2012-06-07 09:54:06

From: p1ng
What is the difference between using them and the string?


In SRL 6 it is likely that they will be updated to integers, if you change to constants now then your scripts won't be broken by it

P1ng

2012-06-07 09:58:53

Ahh, great to know! thank-you very much :)