Log in

View Full Version : Old scripter in need of help



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?

Runescape Pro
11-23-2010, 06:40 AM
No way! I might be able to help you with this one!!!!!

You never called "SetValues". ;)

Love you. <3

EDIT: I was thinking... and this MIGHT not fix your problems. I thought I read that you got an outofrange error. GL.

Bonfield
11-23-2010, 08:20 AM
i was looking through it to, ^ that is all i can see

JPHamlett
11-23-2010, 12:17 PM
Now, I'm getting a out or range error, how would I fix that?

All I did to the code was change the mainloop as follows


var
I : Integer;
Ores : OreArray;

begin
Smart_Server := 86;
Smart_Signed := true;
SetupSRL;
SetValues;
Ores := OresPresent;
Writeln(Tostr(High(Ores)));
Writeln(Tostr(Ores));
end.

JPHamlett
11-23-2010, 08:38 PM
Sorry bout the double post, any help?

Camaro'
11-23-2010, 09:21 PM
You can add my MSN if you would like?

aarondawg14@yahoo.com

Sir R. M8gic1an
11-23-2010, 09:42 PM
Out of range might be because you never set the array size for the arrays is SetValues.

~RM

Cstrike
11-23-2010, 10:57 PM
Random question: Whered you get all those ID's [manually]? Are those the only rock type ID's or are there more than listed?

JPHamlett
11-23-2010, 11:03 PM
Those are the only ones and I took it from a different bot of mine.