bran_corn
02-17-2016, 02:58 AM
Ok so I wrote my first script, it fetches the IDs of the npcs, objects, and items on your screen and labels them.
I wrote this since I was finding it a pain to get the ids manually and a lot of the time the id's and the names didn't match up. I know the code isn't super elegant. I'd love to hear feedback!
Note that if there are too many objects around you can just comment out the functions that labels them.
// 2016 Bran_corn @villavu.com
//use this script to get ids ect
program new;
{$DEFINE SMART}
{$i aerolib\aerolib.simba }
{$i reflection/reflection.Simba}
{$I SRL-OSR\SRL\utilities\drawing.simba}
procedure PrintNpcIdToScreen();
var
Npcs :TReflectNPCArray ;
i: integer;
ScreenCoord : TPoint;
begin
WriteLn('----------------------------------------------------------');
WriteLn('labelling npcs...');
Npcs.GetAll;
for i:= 0 to high(Npcs) do begin
ScreenCoord := Npcs[i].GetMsPoint;//TReflectionTiles.TileToMS(Npcs[i].GetTile);
if (((ScreenCoord.X > 50) and (ScreenCoord.X < 550)) and ((ScreenCoord.Y > 50) and (ScreenCoord.Y < 350))) then begin
WriteLn('');
WriteLn(Npcs[i].GetName);
WriteLn(Npcs[i].Getid );
OS_SMART.graphics().drawCircle(ScreenCoord,3,clred , True);
OS_SMART.graphics().DrawClippedText(Npcs[i].GetName+' ' +InttoStr(Npcs[i].Getid) ,statChars,ScreenCoord);
end;
end;
end;
procedure PrintItemIdToScreen();
var
Items :TReflectGroundItemArray ;
Item :TReflectGroundItem;
i: integer;
ScreenCoord : TPoint;
begin
WriteLn('----------------------------------------------------------');
WriteLn('labelling items...');
Items.GetAll;
for i:= 0 to high(Items) do begin
Item:= Items[i];
ScreenCoord := Item.GetMsPoint;//TReflectionTiles.TileToMS(Npcs[i].GetTile);
//WriteLn(ScreenCoord);
if (((ScreenCoord.X > 50) and (ScreenCoord.X < 550)) and ((ScreenCoord.Y > 50) and (ScreenCoord.Y < 350))) then begin
WriteLn('');
WriteLn(Item.GetName);
WriteLn(Item.Getid );
OS_SMART.graphics().drawCircle(ScreenCoord,3,clblu e, True);
OS_SMART.graphics().DrawClippedText(Item.GetName +' ' +InttoStr(Item.Getid) ,statChars,ScreenCoord,clblue);
end;
end;
end;
procedure PrintObjectIdToScreen();
var
myObjects :TReflectObjectArray ;
myObject :TReflectObject;
i: integer;
ScreenCoord : TPoint;
begin
WriteLn('----------------------------------------------------------');
WriteLn('labelling objects...');
myObjects.GetAll(ObjGame,30) ;
for i:= 0 to high(myObjects) do begin
myObject:= myObjects[i];
ScreenCoord := myObject.GetMsPoint;//TReflectionTiles.TileToMS(Npcs[i].GetTile);
if (((ScreenCoord.X > 50) and (ScreenCoord.X < 550)) and ((ScreenCoord.Y > 50) and (ScreenCoord.Y < 350))) then begin
WriteLn('');
WriteLn(myObject.GetName);
WriteLn(myObject.GetId );
OS_SMART.graphics().drawCircle(ScreenCoord,3,clpur ple, True);
OS_SMART.graphics().DrawClippedText(myObject.GetNa me +' ' + inttostr(myObject.Getid ),statChars,ScreenCoord,clpurple);
end;
end;
end;
procedure setup();
begin
setDefaultZoom;
end;
begin
initAL();
Reflect.Setup;
setup;
While True do begin
OS_SMART.graphics().Clear;
ClearDebug;
PrintNpcIdToScreen;
PrintItemIdToScreen ;
PrintObjectIdToScreen ;
Wait(10000);
end;
end.
I wrote this since I was finding it a pain to get the ids manually and a lot of the time the id's and the names didn't match up. I know the code isn't super elegant. I'd love to hear feedback!
Note that if there are too many objects around you can just comment out the functions that labels them.
// 2016 Bran_corn @villavu.com
//use this script to get ids ect
program new;
{$DEFINE SMART}
{$i aerolib\aerolib.simba }
{$i reflection/reflection.Simba}
{$I SRL-OSR\SRL\utilities\drawing.simba}
procedure PrintNpcIdToScreen();
var
Npcs :TReflectNPCArray ;
i: integer;
ScreenCoord : TPoint;
begin
WriteLn('----------------------------------------------------------');
WriteLn('labelling npcs...');
Npcs.GetAll;
for i:= 0 to high(Npcs) do begin
ScreenCoord := Npcs[i].GetMsPoint;//TReflectionTiles.TileToMS(Npcs[i].GetTile);
if (((ScreenCoord.X > 50) and (ScreenCoord.X < 550)) and ((ScreenCoord.Y > 50) and (ScreenCoord.Y < 350))) then begin
WriteLn('');
WriteLn(Npcs[i].GetName);
WriteLn(Npcs[i].Getid );
OS_SMART.graphics().drawCircle(ScreenCoord,3,clred , True);
OS_SMART.graphics().DrawClippedText(Npcs[i].GetName+' ' +InttoStr(Npcs[i].Getid) ,statChars,ScreenCoord);
end;
end;
end;
procedure PrintItemIdToScreen();
var
Items :TReflectGroundItemArray ;
Item :TReflectGroundItem;
i: integer;
ScreenCoord : TPoint;
begin
WriteLn('----------------------------------------------------------');
WriteLn('labelling items...');
Items.GetAll;
for i:= 0 to high(Items) do begin
Item:= Items[i];
ScreenCoord := Item.GetMsPoint;//TReflectionTiles.TileToMS(Npcs[i].GetTile);
//WriteLn(ScreenCoord);
if (((ScreenCoord.X > 50) and (ScreenCoord.X < 550)) and ((ScreenCoord.Y > 50) and (ScreenCoord.Y < 350))) then begin
WriteLn('');
WriteLn(Item.GetName);
WriteLn(Item.Getid );
OS_SMART.graphics().drawCircle(ScreenCoord,3,clblu e, True);
OS_SMART.graphics().DrawClippedText(Item.GetName +' ' +InttoStr(Item.Getid) ,statChars,ScreenCoord,clblue);
end;
end;
end;
procedure PrintObjectIdToScreen();
var
myObjects :TReflectObjectArray ;
myObject :TReflectObject;
i: integer;
ScreenCoord : TPoint;
begin
WriteLn('----------------------------------------------------------');
WriteLn('labelling objects...');
myObjects.GetAll(ObjGame,30) ;
for i:= 0 to high(myObjects) do begin
myObject:= myObjects[i];
ScreenCoord := myObject.GetMsPoint;//TReflectionTiles.TileToMS(Npcs[i].GetTile);
if (((ScreenCoord.X > 50) and (ScreenCoord.X < 550)) and ((ScreenCoord.Y > 50) and (ScreenCoord.Y < 350))) then begin
WriteLn('');
WriteLn(myObject.GetName);
WriteLn(myObject.GetId );
OS_SMART.graphics().drawCircle(ScreenCoord,3,clpur ple, True);
OS_SMART.graphics().DrawClippedText(myObject.GetNa me +' ' + inttostr(myObject.Getid ),statChars,ScreenCoord,clpurple);
end;
end;
end;
procedure setup();
begin
setDefaultZoom;
end;
begin
initAL();
Reflect.Setup;
setup;
While True do begin
OS_SMART.graphics().Clear;
ClearDebug;
PrintNpcIdToScreen;
PrintItemIdToScreen ;
PrintObjectIdToScreen ;
Wait(10000);
end;
end.