SRL Archive - Archive

Foundry - SRL Member Application


Foundry

2014-02-04 23:00:40

How Long have You Played Runescape?
4 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
I've dabbled in C++ and python


Are you a member of any other communities?
Wurm Online Forum (pm me if you want my username)


Tell us about yourself…
From: Foundry
So, to make this quick, I'm a high school senior who, thanks to all you wonderful people, has become interested in programming. I work two jobs, one in my school cafe and the other for the schools daycare. In between I work on my include for Wurm (as you will see below). Besides that, I make chainmail irl :o and troll people on Omegle >:). Oh, and my name is Robert!

Well you can look at this GitHub page to see all of my stuff. I will post a YouTube video tomorrow of my actual script in action that utilizes my include for those of you who don't play the game.

About my include: It is for a game called Wurm Online. I am sure some of you are familiar with it because there are a few threads on here about it. Anywho, it currently can read stamina, water level, any text log in the Wurm directory, the inventory (this one was hard to code!), the local name box, and the timer bar. I made it so you can use any resolution if you set it up correctly. In addition it has some intuitive features like ignoring event messages from nearby players and detecting if a gm is nearby.

How this pertains to SRL: The include utilizes many of the core functions of SRL like mouse.simba and all of the type functions.

If you want to look at an actual script I suggest viewing the brick maker. Just wrote it tonight. If you want to view a good part of the include I suggest looking at inventory.simba or toolbelt.simba.

Finally, I understand it is lacking some of documentation and some parts just suck. A portion of it was written about a month ago and I have learned a few things since then.

The include is located here. The first script utilizes my own include. The second is part of the include (just to show what I can do). A video of another one of my scripts can be seen here.


Please show us one (or multiple) of your scripts.

program BrickMaker;
{$i wrl-1/wrl.simba}

const
DesiredRuntime = 60;

var
BulkStorageBin: Menu;
BricksMade: Integer;
MaxQueue: Integer = 3;
ScriptTimer: TTimeMarker;

procedure setup();
begin
setupWRL('CHARNAME', 'C:/', 1024, 768, true);
setClientFocus();
wait(3000 + random(1000));
BulkStorageBin.init(BSB);
ToolsBeingUsed := [CHISEL];
Toolset.init();
Toolset.activate(CHISEL);
if not BulkStorageBin.isItemPresent('ock') then
begin
writeLn('You need to put shards in your bsb!');
terminateScript();
end;
ScriptTimer.start();
end;

function enoughWeight(Slot: Integer): Boolean;
var
WeightNeeded: Double;
Count: Integer;
begin
// If somehow an invalid slot number is passed, it will exit.
if Slot = 0 then
exit(false);
Count := Backpack.Contents[Slot - 1].StackCount;
if Count > MaxQueue then
WeightNeeded := (20 * (Count - MaxQueue)) + (3.5 * MaxQueue)
else
WeightNeeded := 3.5 * MaxQueue;
if Backpack.Contents[Slot - 1].Weight > WeightNeeded then
exit(true);
end;

procedure withdrawShards();
var
WithdrawAmount, ShardSlot: Integer;
begin
// Deposit the bricks or shards if we already have them.
if Backpack.isItemPresent('brick') then
begin
Backpack.deposit(BulkStorageBin, Backpack.getItemSlots('brick', false)[0]);
wait(randomrange(200, 500));
BackPack.mouseFreeSpace();
Backpack.update(true);
wait(randomrange(200, 500));
end;
if Backpack.isItemPresent('shards') then
begin
Backpack.deposit(BulkStorageBin, Backpack.getItemSlots('shards', false)[0]);
wait(randomrange(200, 500));
Backpack.mouseFreeSpace();
Backpack.update(true);
wait(randomrange(200, 500));
end;
// Gotta check and see if the rock shards are even there still.
BulkStorageBin.update(true);
if not BulkStorageBin.isItemPresent('shards') then
begin
writeLn('Ran out of shards!');
terminateScript();
end else
ShardSlot := BulkStorageBin.getItemSlots('shard')[0];
// This withdraws the remaining amount if it is below the max queue to avoid
// an infinite loop.
if BulkStorageBin.Contents[ShardSlot - 1].StackCount < MaxQueue then
WithdrawAmount := BulkStorageBin.Contents[ShardSlot - 1].StackCount
else
WithdrawAmount := MaxQueue;
// If it has made it this far there is no reason not to retrieve the shards.
Backpack.retrieve(BulkStorageBin, ShardSlot, WithdrawAmount);
wait(randomrange(600, 1000));
end;

// If this returns false it needs to withdraw.
function makeBricks(): Boolean;
var
ShardSlot: Integer;
begin
if Backpack.isItemPresent('shards') then
begin
ShardSlot := Backpack.getItemSlots('shards', false)[0];
end else begin
writeLn('No shards detected...');
exit(false);
end;
if enoughWeight(ShardSlot) then
begin
waitForStamina();
Backpack.mouseOptions(ShardSlot, ['rea', 'isc', 'one br']);
waitOnActivity();
BricksMade := BricksMade + MaxQueue; // I need to make an inventory function
// that counts an item.
wait(randomrange(500, 800));
exit(true);
end else
begin
writeLn('Not enough weight in shards.');
exit(false);
end;
end;

procedure proggy();
begin
writeLn('----------------------');
writeLn('Bricks made: ' + toStr(BricksMade));
writeLn('Time running: ' + msToTime(ScriptTimer.getTime(), TIME_FORMAL));
writeLn('Bricks per hr: ' + toStr(round((BricksMade * 1000) / (ScriptTimer.getTime() / 3600))));
writeLn('----------------------');
end;

procedure mainLoop();
begin
repeat
wait(randomrange(200, 600));
Backpack.mouseFreeSpace();
Backpack.update(true);
if not makeBricks() then
withdrawShards();
GMCheck();
proggy();
until(round(ScriptTimer.getTime() / 60000) > DesiredRuntime);
end;

begin
setup();
mainLoop();
end.

{$include_once srlutilities\srlutilities.simba}
{$include_once hotkeys.simba}
{$include_once toolbelt.simba}
{$include_once textfinding.simba}

type
Item = record
Name: String;
Slot, StackCount: Integer;
Damage, Quality, Weight: Double;
ImproveType: Integer;
ModBoxes: TBoxArray;
Activated, Ignore, Stack, Collapsed, Container: Boolean;
end;

Menu = record
Title: String;
Contents: array of Item;
SlotBoxes: TBoxArray;
Bounds: TBox;
IsOpen: Boolean;
end;

var
Backpack: Menu;

const
CNAME = 0;
QL = 1;
DMG = 2;
CWEIGHT = 3;
IMP = 4;
CSTACK = 5;
// Used for comparing the color count to get collased and stack boolean.
PLUS_COUNT = 53;
MINUS_COUNT = 47;
// These are those colors that alternate in the inventory. This was the easiest
// way to quickly implement inventory detection. Will improve later.
INV_COLOR_1 = 1053977;
INV_COLOR_2 = 1185564;
SELECT_COLOR = 4264470;
ACTIVATE_COLOR = 65280;
ACTIVATE_TEXT_COLOR = 8453888;
// Constants for menu titles
INVENTORY = 'ven';
FORGE = 'orge';
PILE = 'ile';
BSB = 'bin';

procedure debugItem(var item: Item);
begin
writeLn('Slot ' + toStr(item.Slot) + ': ' + item.Name + ' QL: ' + toStr(item.Quality) + ' DMG: ' + toStr(item.Damage) + ' Weight: ' + toStr(item.Weight) + ' ImproveType: ' + toStr(item.ImproveType));
end;

// By Foundry
{==============================================================================]
Converts the menu type consant to something that makes sense.
[==============================================================================}
function convertMenuConst(MenuConst: String): String;
begin
case MenuConst of
INVENTORY: exit('inventory');
FORGE: exit('forge');
PILE: exit('pile of items');
BSB: exit('bulk storage bin');
end;
end;

// By Foundry
{==============================================================================]
Gets the bounds of any inventory like window. to grab the inventory, you would
pass target as 'Inventory' because it reads the title of the window.
[==============================================================================}
function Menu.getBounds(): Boolean;
var
DotBMP, XBMP, DownArrowBMP, nullint, i: Integer;
NextY: Integer = Mainscreen.y1;
LabelBox: TBox;
tpa: TPointArray;
atpa: T2DPointArray;
begin
result := false;
DotBMP := BitmapFromString(5, 5, 'meJyLLO4Jiom39/R28vIJyGwLiY0p' +
'qm1wDQxKLiwPiEkKioqITEmZvniFZ3C4jZt3cFREXGaOpYe3lZuXr' +
'bunXUCCnY+/iYOziZObuqU3AARZGVQ=');
XBMP := BitmapFromString(10, 11, 'meJwlkG1PglAYhn8DDFTEilzLRE' +
'WQFVLydkA4YIeRJTMmbg74AKPMZf3+zuL5+Fz3/bzcdyOBpmmCINj' +
'eheGuFN0K4119+u2yPe66n1dnDUDiv275se2hQ30WZeXyivPRa5wW' +
'+/LIC1IjyKqv931OUZS6sJY+glGc5HX28U232phy/ZtWuzOZyuYyA' +
'F5ges/ADw/VCUDU2Af8ZK4DAEPD8Z4sz3BRkpXF50+7wzT2IIrDTQ' +
'LRWtFtzfE36QELGIZp7A+POkYARtK9it62aVbiF6aywnRZTPFqWdW' +
'AH+EhWXWciDM8cGG584XZ2IeChO/Z7ouXeIcDUTVbtyEM17wgYkrR' +
'Ld0JBsMRSZLj6cxwfGu5sl1kugHuNOn9ARmuSHU=');
for i := 0 to 3 do
begin
LabelBox := intToBox(0, 0, 0, 0);
if (findBitmapToleranceIn(XBMP, Bounds.x2, Bounds.y1, intToBox(Mainscreen.x1, NextY, ResX, ResY), 50)) and
(findBitmapToleranceIn(DotBMP, LabelBox.x1, LabelBox.y1, intToBox(Mainscreen.x1, Bounds.y1, Bounds.x2, Bounds.y1 + 10), 50)) and
(findBitmapToleranceIn(DotBMP, LabelBox.x2, LabelBox.y2, intToBox(LabelBox.x1 + 25, Bounds.y1, Bounds.x2, Bounds.y1 + 10), 50)) then
begin
LabelBox.edit(15, -5, -5, 10);
if pos(Title, LabelBox.getText()) > 0 then
begin
DownArrowBMP := BitmapFromString(9, 8, 'meJwB2AAn/0JKVhQVFxUWGRIUFRES' +
'FRETFQ8REw8QE0hOWBQVF4SJjpGVm5SYn5ebooyRl36ChnB3fRETF' +
'U1YXxkcHaSpraWqsK2yuKKmrUhPVBETFkZOVlFeZhESFZeco7K2u9' +
'jZ3ba6wFRZXhATFUlSWz5KVUNPWhIUFsTIzNzf4aiuszE2O0pYYVB' +
'bZTQ7RTE8QhASE52hpqOmq2lxeB8iJjpHTUNMUSoyPCk0PDQ/Rw0Q' +
'EnZ7ghMVFzI9RzM9RkBITzhDTDpGTztIVDhETA8REzpFTDI9QTlBS' +
'ktSWYQgSFk=');
Bounds.x1 := LabelBox.x1 - 27;
if findBitmapToleranceIn(DownArrowBMP, nullint, Bounds.y2, intToBox(Bounds.x2 - 3, Bounds.y1, Bounds.x2 + 14, ResY), 15) then
begin
Bounds.edit(0, 15, 0, 10);
result := true;
end;
freeBitmap(DownArrowBMP);
end;
NextY := Bounds.y1 + 5;
end;
if result then
break;
end;
freeBitmaps([XBMP, DotBMP]);
end;

// By Foundry
{==============================================================================]
Obtains the boxes from the inventory by finding the alternating colors of the
slots and making TBoxs out of them.
[==============================================================================}
procedure Menu.getSlotBoxes();
var
i, j: Integer = 0;
tpa1, tpa2, tpa3: TPointArray;
atpa1, atpa2: T2DPointArray;
begin
if findColors(tpa1, INV_COLOR_1, Bounds) and
findColors(tpa2, INV_COLOR_2, Bounds) then
begin
atpa1 := tpa1.cluster(7);
atpa2 := tpa2.cluster(7);
for i := 0 to high(atpa1) do
begin
setLength(SlotBoxes, 1 + j);
SlotBoxes[j] := atpa1[i].getBounds();
inc(j);
end;
// Skips the first box of the menu if it is the inventory.
if Title = INVENTORY then
i := 1
else
i := 0;
for i to high(atpa2) do
begin
setLength(SlotBoxes, 1 + j);
SlotBoxes[j] := atpa2[i].getBounds();
inc(j);
end;
if findColors(tpa3, SELECT_COLOR, Bounds) then
begin
setLength(SlotBoxes, 1 + j);
SlotBoxes[j] := tpa3.getBounds();
end;
end;
end;

// By Foundry
{==============================================================================]
Adjusts the slot boxes obtained in the previous function by sorting them by
y-value and adding in the odd colored box that results when you click on an
item in the inventory.
[==============================================================================}
function Menu.adjustSlotBoxes(): Boolean;
var
LargeBox: TBox;
i, j: Integer;
delete: TIntegerArray;
begin
for i := 0 to high(SlotBoxes) do
begin
if SlotBoxes[i].getheight() < 11 then
begin
setLength(delete, j + 1);
delete[j] := i;
inc(j);
end else if SlotBoxes[i].getHeight() > 18 then
begin
if (not SlotBoxes[i].colorExists(16777215)) and
(not SlotBoxes[i].colorExists(ACTIVATE_COLOR)) then
begin
setLength(delete, j + 1);
delete[j] := i;
inc(j);
end else
begin
SlotBoxes[i].y2 := SlotBoxes[i].y1 + 15;
end;
end;
end;
SlotBoxes.deleteIndex(delete);
SlotBoxes := crudeSortByY(SlotBoxes);
end;

// By Foundry
{==============================================================================]
Finds the free space in the inventory and returns it in a TBox.
[==============================================================================}
function Menu.getFreeSpace(): TBox;
begin
with result do
begin
x1 := Bounds.x1 + 10;
x2 := Bounds.x2 - 10;
y1 := Contents[high(Contents)].ModBoxes[0].y2 + 2;
y2 := Bounds.y2 - 1;
end;
end;

// By Foundry
{==============================================================================]
Moves the mouse to the free sace in the menu. Used to clear the pesky
mouseover text.
[==============================================================================}
procedure Menu.mouseFreeSpace();
var
pnt: TPoint;
begin
getMousePos(pnt);
if not getFreeSpace().isPointInside(pnt) then
mouseBox(getFreeSpace());
end;

// By Foundry
{==============================================================================]
Moves the mouse to the desired slot in the inventory.
[==============================================================================}
procedure Menu.mouseSlot(SlotNumber: Integer; clickType: Integer = MOUSE_MOVE);
var
copy: TBox;
begin
if SlotNumber - 1 > high(SlotBoxes) then
writeLn('Invalid slot number passed')
else
begin
copy := SlotBoxes[SlotNumber - 1];
copy.edit(0, 0, 0, -2);
copy.mouse(clickType);
end;
end;

// By Foundry
{==============================================================================]
Creates a default Item object for every slot in the inventory. Also checks if
it is activated or not.
[==============================================================================}
procedure Menu.setupItems(FirstTime: Boolean = true);
var
i: Integer;
XMod: Integer = 30;
begin
for i := 0 to high(SlotBoxes) do
begin
if FirstTime then
begin
if Title = INVENTORY then
XMod := 44;
setLength(Contents, i + 1);
setLength(Contents[i].ModBoxes, 6);
with Contents[i] do
begin
Slot := i + 1;
ModBoxes[CNAME] := intToBox(Bounds.x1 + XMod, SlotBoxes[i].y1 - 1,
Bounds.x2 - 133, SlotBoxes[i].y2 + 1);
ModBoxes[QL] := intToBox(Bounds.x2 - 134, SlotBoxes[i].y1 - 1,
Bounds.x2 - 101, SlotBoxes[i].y2);
ModBoxes[DMG] := intToBox(Bounds.x2 - 91, SlotBoxes[i].y1 - 1,
Bounds.x2 - 64, SlotBoxes[i].y2);
ModBoxes[CWEIGHT] := intToBox(Bounds.x2 - 54, SlotBoxes[i].y1 - 1,
Bounds.x2 - 19, SlotBoxes[i].y2);
ModBoxes[IMP] := intToBox(Bounds.x2 - 19, SlotBoxes[i].y1 - 1,
Bounds.x2, SlotBoxes[i].y2);
ModBoxes[CSTACK] := intToBox(Bounds.x1 + 15, SlotBoxes[i].y1 - 1,
Bounds.x1 + 27, Slotboxes[i].y2 + 1);
Stack := false;
Collapsed := false;
Ignore := false;
Container := false;
StackCount := 1;
end;
end;
if Contents[i].ModBoxes[CNAME].colorExists(ACTIVATE_COLOR) then
begin
Contents[i].Activated := true;
end else
Contents[i].Activated := false;
end;
end;

// By Foundry
{==============================================================================]
Updates the info for the supplied item by searching for text in the modboxes
setup in the previous function.
[==============================================================================}
procedure Item.updateInfo();
var
ColorName, ColorMod: Integer = 16777215;
Tol, count: Integer = 0;
begin
if Activated then
begin
ColorName := ACTIVATE_COLOR;
ColorMod := ACTIVATE_TEXT_COLOR;
Tol := 15;
end;
try
begin
Name := ModBoxes[0].getText(ColorName);
Quality := strToFloat(takeOutSpaces(ModBoxes[1].getText(ColorMod, Tol)));
Damage := strToFloat(takeOutSpaces(ModBoxes[2].getText(ColorMod, Tol)));
Weight := strToFloat(takeOutSpaces(ModBoxes[3].getText(ColorMod, Tol)));
ImproveType := getImpType(ModBoxes[4]);
end
except
begin
writeLn('Could not fetch contents from slot ' + toStr(Slot) + '.');
terminateScript();
end
end;
count := countColor(16777215, ModBoxes[CSTACK]);
if (count = MINUS_COUNT) or
(count = PLUS_COUNT) then
begin
Stack := true;
if count = PLUS_COUNT then
Collapsed := true;
try
StackCount := strToInt(between('(', 'x)', Name));
except
writeLn('Unable to get stack count of ' + Name + '... it must be a container.');
Container := true;
end;
end;
end;

// By Foundry
{==============================================================================]
Goes through each Item object in the Contents of the Menu and updates the
fields.
[==============================================================================}
procedure Menu.getItemInfo();
var
i: Integer = 0;
begin
for i to high(Contents) do
begin
Contents[i].updateInfo();
if Title = BSB then
begin
try
Contents[i].StackCount := strToInt(between('(', 'x)', Contents[i].Name))
except
writeLn('dangit ' + Contents[i].Name);
end;
end;
end;
end;

// By Foundry
{==============================================================================]
Convenient procedure to update the inventory after it has been setup and then
altered in some way.
[==============================================================================}
procedure Menu.update(Full: Boolean = false);
var
t: Integer;
begin
t := getSystemTime();
if Full then
begin
getSlotBoxes();
adjustSlotBoxes();
end;
setupItems(Full);
getItemInfo();
writeLn('Updated inventory in ' + toStr(getSystemTime() - t) + 'ms.');
end;

// By Foundry
{==============================================================================]
Returns the amount of items in the inventory.
[==============================================================================}
function Menu.getCount(): Integer;
begin
result := length(Contents);
end;

// By Foundry
{==============================================================================]
Returns the slot number of the currently active item in the inventory.
[==============================================================================}
function Menu.getActiveSlot(): Integer;
var
i: Integer;
begin
result := -1;
for i := 0 to high(Contents) do
begin
if Contents[i].Activated then
exit(Contents[i].Slot);
end;
end;

// By Foundry
{==============================================================================]
Convenient way to initialize a given menu.
[==============================================================================}
procedure Menu.init(Target: String = INVENTORY);
begin
Title := Target;
if getBounds() then
begin
getSlotBoxes();
adjustSlotBoxes();
setupItems();
getItemInfo();
writeLn('Set up ' + convertMenuConst(Title) + '.');
end else
begin
writeLn('Failed to set up ' + convertMenuConst(Title) + '.');
terminateScript();
end;
end;

// By Foundry
{==============================================================================]
Returns true if an item with the supplied Name is present.
[==============================================================================}
function Menu.isItemPresent(Name: String; IgnoreStacks: Boolean = false): Boolean;
var
i: Integer;
begin
result := false;
for i := 0 to high(Contents) do
begin
if (not Contents[i].Ignore) and
((not IgnoreStacks) or
(not Contents[i].Stack)) and
(pos(Name, Contents[i].Name) > 0) then
exit(true);
end;
end;

// By Foundry
{==============================================================================]
Returns the slots in a TIntegerArray that have the supplied Name.
[==============================================================================}
function Menu.getItemSlots(Name: String; IgnoreStacks: Boolean = true): TIntegerArray;
var
i, j: Integer = 0;
ignore: Boolean;
begin
for i to high(Contents) do
begin
if (not Contents[i].Ignore) and
((not IgnoreStacks) or
(not Contents[i].Stack)) and
(pos(Name, Contents[i].Name) > 0) then
begin
setLength(result, j + 1);
result[j] := Contents[i].Slot;
inc(j);
end;
end;
end;

// By Foundry
{==============================================================================]
Returns the slots in a TIntegerArray that can be improved with the ImpType
supplied.
[==============================================================================}
function Menu.getImpItemSlots(ImpType: Integer): TIntegerArray;
var
i, j: Integer = 0;
begin
for i to high(Contents) do
begin
if (not Contents[i].Ignore) and
(Contents[i].ImproveType = ImpType) then
begin
setLength(result, j + 1);
result[j] := Contents[i].Slot;
inc(j);
end;
end;
end;

// By Foundry
{==============================================================================]
Returns the slots in a TIntegerArray that are damaged.
[==============================================================================}
function Menu.getDamItemSlots(): TIntegerArray;
var
i, j: Integer = 0;
begin
for i to high(Contents) do
begin
if (not Contents[i].Ignore) and
(Contents[i].Damage > 0.00) and
(not Contents[i].Stack) then
begin
setLength(result, j + 1);
result[j] := Contents[i].Slot;
inc(j);
end;
end;
end;

// By Foundry
{==============================================================================]
Returns the slots in a TIntegerArray that are between the supplied MinQL and
MaxQl.
[==============================================================================}
function Menu.getQlItemSlots(MinQl, MaxQl: Double): TIntegerArray;
var
i, j: Integer = 0;
begin
for i to high(Contents) do
begin
if (not Contents[i].Ignore) and
(Contents[i].Quality >= MinQl) and (Contents[i].Quality <= MaxQl) then
begin
setLength(result, j + 1);
result[j] := Contents[i].Slot;
inc(j);
end;
end;
end;

// By Foundry
{==============================================================================]
Returns the slots in a TIntegerArray that are between MinQl and MaxQl, damaged
or not, and improved with the supplied ImpType.
[==============================================================================}
function Menu.getItems(SlotsToSearch: TIntegerArray; ImpType: Integer; MinQl, MaxQl: Double;
IncludeDamaged: Boolean = false): TIntegerArray;
var
i, j: Integer;
ImpArray, DamArray, QualityArray: TIntegerArray;
begin
ImpArray := self.getImpItemSlots(ImpType);
DamArray := self.getDamItemSlots();
QualityArray := self.getQlItemSlots(MinQl, MaxQl);
// I could do this: array.include().exclude() etc. but it is easier to read this way.
result := DamArray.exclude(ImpArray);
result := QualityArray.include(result);
result := result.include(SlotsToSearch);
end;

// By Foundry
{==============================================================================]
Drops the items in the slots supplied in the TIntegerArray.
[==============================================================================}
procedure Menu.dropItems(Slots: TIntegerArray);
var
i: Integer;
begin
// Drops from the lowest slot to the highest slot in the inventory to prevent
// the shifting of items during the dropping procedure.
for i := high(Slots) downto low(Slots) do
begin
mouseSlot(Slots[i]);
wait(randomrange(30, 200));
drop();
wait(randomrange(30, 70));
end;
end;

// By Foundry
{==============================================================================]
Returns the slots that match Name.
[==============================================================================}
procedure Menu.dropItems(const Name: String; IgnoreStacks: Boolean = true); overload;
begin
self.dropItems(self.getItemSlots(Name, IgnoreStacks));
end;

// By Foundry
{==============================================================================]
Repairs the item in the supplied Slot.
[==============================================================================}
procedure Menu.repairItem(const Slot: Integer);
begin
mouseSlot(Slot);
wait(randomrange(30, 200));
repair();
end;

procedure Menu.mouseOptions(const slot: Integer; TextChain: TStringArray);
var
tmpbox: TBox;
begin
tmpBox := SlotBoxes[slot - 1];
tmpBox.x2 := tmpBox.x2 - (Bounds.getWidth() - 30);
mouseBox(tmpBox, MOUSE_RIGHT);
wait(randomrange(1060, 1109));
clickOptions(TextChain);
end;

// By Foundry
{==============================================================================]
Repairs all items in the Menu that match Name.
[==============================================================================}
procedure Menu.repairItems(Name: String);
var
i: Integer;
Items: TIntegerArray;
begin
Items := getItemSlots(Name);
if length(Items) < 1 then
exit;
for i := 0 to high(Items) do
begin
self.repairItem(Items[i]);
waitForStamina();
end;
end;

// By Foundry
{==============================================================================]
Activates the item in the supplied Slot.
[==============================================================================}
procedure Menu.activateSlot(const Slot: Integer);
begin
mouseSlot(Slot, MOUSE_LEFT);
wait(randomrange(10, 50));
fastClick(MOUSE_LEFT);
end;

// By Foundry
{==============================================================================]
Improves the item in the supplied Slot.
[==============================================================================}
procedure Menu.improveItem(Slot: Integer);
begin
mouseSlot(Slot);
wait(randomrange(30, 200));
improve();
end;

// By Foundry
{==============================================================================]
Sets the Ignore bool in the item in the supplied Slot to true.
[==============================================================================}
procedure Menu.ignoreSlot(Slot: Integer);
begin
Contents[Slot - 1].Ignore := true;
end;

///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////SEPERATOR//////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

type
Tool = record
Location, ID: Integer;
Name: String;
end;

TToolset = record
Contents: array of Tool;
ActiveTool: Integer;
end;

// for locations in the inventory add 100 to the slot and for locations in the
// action bar add 200.

var
Toolset: TToolset;
ToolsBeingUsed: TIntegerArray;
UseToolbelt: Boolean;

procedure Tool.setName();
begin
case ID of
0: Name := 'log';
1: Name := 'file';
2: Name := 'mallet';
3: Name := 'carving knife';
4: Name := 'pelt';
5: Name := 'lump';
6: Name := 'water';
7: Name := 'hammer';
8: Name := 'rock shards';
9: Name := 'whetstone';
10: Name := 'chisel';
end;
end;

function Tool.pair(): Boolean;
var
Slot: Integer;
begin
result := false;
if Toolbelt.isToolPresent(ID) then
begin
Location := Toolbelt.getToolSlot(ID) + 200;
writeLn('Found ' + Name + ' in toolbelt.');
exit(true);
end;
if Backpack.isItemPresent(Name) then
begin
Slot := Backpack.getItemSlots(Name)[0];
Location := Slot + 100;
Backpack.ignoreSlot(Slot);
writeLn('Found ' + Name + ' in backpack.');
exit(true);
end;
end;

procedure TToolset.init();
var
i: Integer;
begin
for i := 0 to high(ToolsBeingUsed) do
begin
setLength(Contents, i + 1);
Contents[i].ID := ToolsBeingUsed[i];
Contents[i].setName();
Contents[i].pair();
ActiveTool := -2;
end;
end;

procedure Tool.activate();
begin
case Location of
-2..0:
begin
writeLn('Invalid tool location passed');
terminateScript;
end;
101..200:
begin
Backpack.mouseSlot(self.Location - 100, MOUSE_LEFT);
wait(randomrange(30, 100));
fastClick(MOUSE_LEFT);
end;
201..300:
begin
Toolbelt.activateSlot(self.Location - 200, false);
end;
end;
end;

function TToolset.getActiveToolType(): Integer;
begin
result := Backpack.Contents[Backpack.getActiveSlot() - 1].ImproveType;
end;

procedure TToolset.activate(ImpType: Integer);
var
i: Integer;
begin
for i := 0 to high(Contents) do
begin
if ((Contents[i].ID = ImpType) or
((ImpType = KNIFE) and
(Contents[i].ID = CHISEL))) and
not(i = ActiveTool) then
begin
ActiveTool := i;
Contents[i].activate();
exit;
end;
end;
end;

///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////SEPERATOR//////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

procedure Menu.improveItems(Slots: TIntegerArray);
var
i, ImpType: Integer;
begin
for i := 0 to high(Slots) do
begin
// Activates the tool needed for the job.
if Contents[Slots[i] - 1].Damage > 0.00 then
repairItem(Slots[i]);
ImpType := Contents[Slots[i] - 1].ImproveType;
Toolset.activate(ImpType);
improveItem(Slots[i]);
waitForStamina();
end;
end;

Ian

2014-02-04 23:02:02

Please put the script itself into the script box, that it what it is there for :)

Although what you have on your github may be very good, you need to apply with a script.

King

2014-02-04 23:05:15

As BMW posted, you may want to put the code in the tags, else you will get a lot of auto-no's

Foundry

2014-02-04 23:14:54

I edited it. Is that right?

King

2014-02-04 23:18:17

From: Foundry
I edited it. Is that right?
Much better, now people will stop to look :)

E* Looked through the include and it looks well, you have a good knowledge of Simba, does not mean it has to be applied to just Runescape. So I voted yes.

The Mayor

2014-02-04 23:35:55

Got any RuneScape scripts?

Foundry

2014-02-04 23:43:18

From: The Mayor
Got any RuneScape scripts?


I did have a fletcher that worked quite well, but if you look at it now it's outdated because it was written right after SRL 6 was released. I can make one if it is required but I thought i might as well use what I've been working on for the past 3 months.

Krazy_Meerkat

2014-02-05 05:29:12

Well I've seen you around the forums :) I just read through the include..
Good descriptions in comments, you show decent knowledge of records and short effective procs/functions…

I will vote yes, because you clearly have learned enough about simba to earn SRL Member status IMO

Edit: Reading through a bit more and it's starting to make sense why you did things the way you did.. But I would like for you to consider a bit more simplicity, some of those methods seem a bit unnecessarily complex..

Foundry

2014-02-05 14:17:44

From: Krazy_Meerkat
Well I've seen you around the forums :) I just read through the include..
Good descriptions in comments, you show decent knowledge of records and short effective procs/functions…

I will vote yes, because you clearly have learned enough about simba to earn SRL Member status IMO

Edit: Reading through a bit more and it's starting to make sense why you did things the way you did.. But I would like for you to consider a bit more simplicity, some of those methods seem a bit unnecessarily complex..


Thanks, I've been working on simplicity in my scripts.

Also, added more comments/documentation to the include.

Kyle

2014-02-05 15:13:07

Yep, was hoping that you would apply soon!

footballjds

2014-02-05 15:23:12

From: Krazy_Meerkat
Well I've seen you around the forums :) I just read through the include..
Good descriptions in comments, you show decent knowledge of records and short effective procs/functions…

I will vote yes, because you clearly have learned enough about simba to earn SRL Member status IMO

Edit: Reading through a bit more and it's starting to make sense why you did things the way you did.. But I would like for you to consider a bit more simplicity, some of those methods seem a bit unnecessarily complex..


what woodwork did you just crawl out off?

Krazy_Meerkat

2014-02-05 23:33:12

From: footballjds
what woodwork did you just crawl out off?


This thread is for Foundry's application review ;)

Foundry

2014-02-06 23:58:48

Added a link to a YouTube video explaining what my include can do. Also added stuff to the brick maker.

Foundry

2014-02-19 08:28:26

May be a little late but a recent rs3 script I wrote can be found here

King

2014-02-21 10:55:22

From: Foundry
May be a little late but a recent rs3 script I wrote can be found here


Did you post it in the script section of your app? I do believe you are allowed to edit it to show improvements and new scripts in the meantime.

Foundry

2014-02-21 14:05:41

From: King
Did you post it in the script section of your app? I do believe you are allowed to edit it to show improvements and new scripts in the meantime.


Yeah, didn't think about that. Doesn't the application close after 2 weeks?

NKN

2014-02-21 14:21:07

From: Foundry
Yeah, didn't think about that. Doesn't the application close after 2 weeks?


The poll is closed.
You're waiting on an admin now.

Justin

2014-02-21 16:11:39

Admins notified.

King

2014-02-21 22:19:23

From: NKN
The poll is closed.
You're waiting on an admin now.


Didn't see that, whoopsie.