JPHamlett
11-23-2010, 03:25 AM
program PowerMinerRevamped;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
type
Ore = record
OnScreen : Boolean; //Is it on the screen
OreType : String; // Name of Rock
CanMine : Boolean; // If the level is great enough
PlayerMining : Boolean; // If another player if mining the rock
end;
OreArray = array of Ore;
var
CopperIds, TinIds, IronIds, SilverIds, CoalIds, GoldIds, MithrilIds, AdamantIds : TIntegerArray;
procedure SetValues;
begin
CopperIds := [9708, 9709, 9710,
11960, 11961, 11962, 11936, 11937, 11938, 31080, 31081, 31082];
TinIds := [9714, 9716, 11933,
11934, 11935, 11957, 11958, 11959, 31077, 31078, 31079];
IronIds := [9717, 9718, 9719,
11954, 11955, 11956, 31071, 31072, 31073, 37307, 37308, 37309];
SilverIds := [2311, 37304, 37305,
37306];
CoalIds := [11930, 11931, 11932,
31068, 31069, 31070];
GoldIds := [9720, 9722, 31065,
31066];
MithrilIds := [11942, 11943, 11944,
31086, 31088];
AdamantIds := [11939, 11941,
31083, 31085];
end;
function GetName(Id : Integer) : String;
begin
result := 'Null';
if (InIntArray(CopperIds, ID)) then
result := 'Copper';
if (InIntArray(TinIds, ID)) then
result := 'Tin';
if (InIntArray(IronIds, ID)) then
result := 'Iron';
if (InIntArray(SilverIds, ID)) then
result := 'Silver';
if (InIntArray(CoalIds, ID)) then
result := 'Coal';
if (InIntArray(GoldIds, ID)) then
result := 'Gold';
if (InIntArray(MithrilIds, ID)) then
result := 'Mithril';
if (InIntArray(AdamantIds, ID)) then
result := 'Adamant';
end;
function OresPresent : OreArray;
var
Ores : TRSObjectArray;
Kind : String;
I : Integer;
begin
Ores := GetAllObjects(OBJECT_TYPE_INTERACTABLE);
for I := 0 to High(Ores) do
begin
Writeln(tostr(ores[i].ID));
Kind := GetName(Ores[i].ID);
if (kind = 'Null') then
Continue;
Result[i].OreType := Kind;
Result[i].OnScreen := TileOnMS(Ores[i].Tile, 0);
end;
end;
var
I : Integer;
Ores : OreArray;
begin
Smart_Server := 86;
Smart_Signed := true;
SetupSRL;
Ores := OresPresent;
Writeln(Tostr(High(Ores)));
end.
Ok, so when I call OresPresent it always returns -1. I have it set to output every Id in the loaded world. Some Ids are present and should have it set a value, but it doesn't, why?
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
type
Ore = record
OnScreen : Boolean; //Is it on the screen
OreType : String; // Name of Rock
CanMine : Boolean; // If the level is great enough
PlayerMining : Boolean; // If another player if mining the rock
end;
OreArray = array of Ore;
var
CopperIds, TinIds, IronIds, SilverIds, CoalIds, GoldIds, MithrilIds, AdamantIds : TIntegerArray;
procedure SetValues;
begin
CopperIds := [9708, 9709, 9710,
11960, 11961, 11962, 11936, 11937, 11938, 31080, 31081, 31082];
TinIds := [9714, 9716, 11933,
11934, 11935, 11957, 11958, 11959, 31077, 31078, 31079];
IronIds := [9717, 9718, 9719,
11954, 11955, 11956, 31071, 31072, 31073, 37307, 37308, 37309];
SilverIds := [2311, 37304, 37305,
37306];
CoalIds := [11930, 11931, 11932,
31068, 31069, 31070];
GoldIds := [9720, 9722, 31065,
31066];
MithrilIds := [11942, 11943, 11944,
31086, 31088];
AdamantIds := [11939, 11941,
31083, 31085];
end;
function GetName(Id : Integer) : String;
begin
result := 'Null';
if (InIntArray(CopperIds, ID)) then
result := 'Copper';
if (InIntArray(TinIds, ID)) then
result := 'Tin';
if (InIntArray(IronIds, ID)) then
result := 'Iron';
if (InIntArray(SilverIds, ID)) then
result := 'Silver';
if (InIntArray(CoalIds, ID)) then
result := 'Coal';
if (InIntArray(GoldIds, ID)) then
result := 'Gold';
if (InIntArray(MithrilIds, ID)) then
result := 'Mithril';
if (InIntArray(AdamantIds, ID)) then
result := 'Adamant';
end;
function OresPresent : OreArray;
var
Ores : TRSObjectArray;
Kind : String;
I : Integer;
begin
Ores := GetAllObjects(OBJECT_TYPE_INTERACTABLE);
for I := 0 to High(Ores) do
begin
Writeln(tostr(ores[i].ID));
Kind := GetName(Ores[i].ID);
if (kind = 'Null') then
Continue;
Result[i].OreType := Kind;
Result[i].OnScreen := TileOnMS(Ores[i].Tile, 0);
end;
end;
var
I : Integer;
Ores : OreArray;
begin
Smart_Server := 86;
Smart_Signed := true;
SetupSRL;
Ores := OresPresent;
Writeln(Tostr(High(Ores)));
end.
Ok, so when I call OresPresent it always returns -1. I have it set to output every Id in the loaded world. Some Ids are present and should have it set a value, but it doesn't, why?