SRL Archive - News and General

wieldTheItem


activecamo

2011-04-09 18:44:02

procedure dropJunk;
var inv : TInvItemArray;
invIndex : Integer;
dropTheItem : Boolean;
begin
inv := getInventoryItems;
for invIndex := 0 to high(inv) do
begin
dropTheItem := true;
case (inv[invIndex].Name) of
'Lobster': dropTheItem := false;
'Steel arrow': dropTheItem := false;
'Uncut diamond': dropTheItem := false;
'Uncut emerald': dropTheItem := false;
'Uncut ruby': dropTheItem := false;
'Uncut sapphire': dropTheItem := false;
'Trout': dropTheItem := false;
'Salmon': dropTheItem := false;
'Tuna': dropTheItem := false;
'Pizza': dropTheItem := false;
'Cake': dropTheItem := false;
'Swordfish': dropTheItem := false;
'Shark': dropTheItem := false;
'Diamond': dropTheItem := false;
end;
if(dropTheItem) then
R_dropItem(inv[invIndex].slot);
end;
end;

The Above Proc comes from iamadam's stronghold killer. I have one question. in regards to the boolean dropTheItem, is this a command referenced in reflection, and if so is the a command that would wield items instead of doping them or leaving them alone.

Basicaly what i want to do is make it so that the script wields arrows. I don't want it done for me i just want to know the command, or better yet a place where all the commands are referenced.

Blumblebee

2011-04-09 18:57:53

In that procedure no it is a local variable that he uses (see if dropitem then XXX). Weilding arrows is simple. Look in Inventory.scar, you can find procedure like…

ItemExists();
MouseInv();
InvBox();

etc.

if you need more assistance with this I can definitely help push you in the right direction, just let me know.

activecamo

2011-04-09 19:55:50

OK I found the function
Simba Code:

all i have to do is add
R_ClickItem(1601, true, '');

to wield it. and i can throw that into the proc after the first BEGIN?

1601 is the item number for steel arrows


[LEFT]function R_ClickItem(Slot: Integer; Left: Boolean; Action: String): boolean;
[/LEFT]

Yago

2011-04-09 20:24:08

If you see it says that the first parameter is slot… Im pretty sure the inventory does not have 1601 slots…

Try This:

Procedure ClickIt;

var
Item: TInvItem;

begin
if R_ItemExists(1601, Item) then
R_ClickItem(Item.Slot, true, '');
end;

Home

2011-04-10 14:43:09

function R_ClickWield(TheVar: Integer): boolean;
var
item: TInvItem;
begin
if not R_LoggedIn then Exit;
if R_ItemExists(TheVar, Item) then begin
if (Item = NULL_INVITEM) then Exit;
case Random(2) of
0:
begin
MouseItem(Item.Slot, True);
Result := True;
end;
1:
begin
MouseItem(Item.Slot, False);
Result := R_WaitOption('Wield', RandomRange(150, 300));
end;
end;
end;
end;

Should work.

~Home