SRL Archive - SRL Archives

function GetObjInInventory(slot:integer):string;


Ace

2006-05-26 22:04:40

function GetObjInInventory(slot : Integer) : String;
var
text : String;
pMouse : Boolean;
begin
pMouse:= benmouse;
benmouse:= false;
MMouseItem(slot);
Wait(40 + Random(10));
text:= GetOption;
text:= Between(' ',' /',text);
result:= text;
benmouse:= pMouse;
end;

This returns the name of the item in the slot you specify.

It's not much… But I had the Idea and I thought it may be worth adding. :p

Thanks to Krazy_Meerkat for the idea about not messing with mouse settings.

XxKanexX

2006-05-26 22:15:18

Nice work. Just a tip, though. You don't need () around a procedure/function without Parametres ;)

Ace

2006-05-26 22:34:44

It's the Java programmer in me.. :p

Krazy_Meerkat

2006-05-27 00:37:31

Maybe you could put that information into an array for later ;)
And you shouldn't mess with the user's mouse settings, do something like this instead:
[php]function GetObjInInventory(slot : Integer) : String;
var
text : String;
mousesettings : Boolean;
begin
mousesettings:= benmouse;
benmouse:= false;
MMouseItem(slot);
Wait(40 + Random(10));
text:= GetOption;
text:= Between(' ',' /',text);
result:= text;
benmouse:= mousesettings;
end;[/php]

Ace

2006-05-27 06:49:07

Thanks Ill fix that.