ScriptUO
Scripting Resources & Utilities => Stealth Client => Stealth Snippets\Library => Topic started by: Crome969 on January 20, 2012, 01:31:16 PM
-
program SimpleConnect;
begin
while ( true) do
begin
if Connected() = false then
begin
Connect();
Wait(5000);
end;
end;
end.
This is just a Simple Reconnection Method for the used profile. You could use as well the Autoreconnect Setting to autoreconnect the selected Profile.
-
This is a simple Snipped to expand FindTypeEx. FindTypeEx only can scan 1 Type, 1 Color, 1 Location. With this Snipped you can Scan Multiple Types, in Multiple Colors at Multiple Places.
function FindTypeArray(TypeList:Array of Cardinal;ColorList:Array of Cardinal;ContainerList:Array of Cardinal;Distance:Integer;UseSubContainer:Boolean):Integer;
var
TypeArray:Integer;
ColorArray:Integer;
ContainerArray:Integer;
TmpResult:Integer;
begin
for TypeArray:=0 to Length(TypeList) do
begin
for ColorArray:=0 to Length(ColorList) do
begin
for ContainerArray:=0 to Length(ContainerList) do
begin
Finddistance:=Distance;
if (FindTypeEx(TypeList[TypeArray],ColorList[ColorArray],ContainerList[ContainerArray],UseSubContainer)>0)then
begin
Result:=FindItem();
exit;
end;
end;
end;
end;
Result:=TmpResult;
end;
Example of Using:
PetID:=FindTypeArray([22,33,44,55],[0,100,250,9999],[Ground(),BackPack()],1,false);
the Syntax is:
FindTypeArray(Array of Types,Array of Color,Array of Container,GroundmaxDistance,ScanSubContainer);
for those who wondering:
-GroundmaxDistance must be 0 or greater(max 25), if you dont want to scan grounds you can set it how you like. If grounds are on your list it will use the maxdistance
-ScanSubContainer is a setting for the special ability of FindTypeEx. It can scan all Items in all Sub Containers inside the ID.
Best example would be the Giant Beetle. In my experimental Code i scan for Ressources in beetle, using the ID of beetle.No real need for Exevent Popup like Easyuo;)
-
More Advanced Method to scan for Informations:
type Item = record
ItemID:Cardinal;
ItemType:Cardinal;
ItemLocation:Cardinal;
ItemDistance:Integer;
ItemColor:Cardinal;
ItemName:String;
ItemProperty:String;
end;
function ScanRoutine(TypeList:Array of Cardinal;ColorList:Array of Cardinal;LocationList:Array of Cardinal;Distance:Integer;UseSubLocation:Boolean):Array of Item;
var ItemList:Array of Item;
aType,aColor,aLocation,DataLength:Integer;
begin
DataLength:=1;
for aType := 0 to (Length(TypeList) - 1)do
begin
for aColor := 0 to (Length(ColorList) - 1)do
begin
for aLocation:= 0 to (Length(LocationList) - 1) do
begin
while(FindTypeEx(TypeList[aType],ColorList[aColor],LocationList[aLocation],UseSubLocation)>1)do
begin
SetLength(ItemList,DataLength)
ItemList[(DataLength - 1)].ItemID:=FindItem;
ItemList[(DataLength - 1)].ItemType:=TypeList[aType];
ItemList[(DataLength - 1)].ItemLocation:=LocationList[aLocation];
ItemList[(DataLength - 1)].ItemDistance:= FindDistance;
ItemList[(DataLength - 1)].ItemColor:=ColorList[aColor];
ItemList[(DataLength - 1)].ItemName:=GetName(Finditem);
ItemList[(DataLength - 1)].ItemProperty:=GetCliloc(FindItem);
Ignore(FindItem);
DataLength:=DataLength + 1;
end;
end;
end;
end;
for aType:= 0 to (Length(ItemList) -1) do
begin
IgnoreOff(ItemList[aType].ItemID);
end;
Result:= ItemList;
end;
Here is an Example how to use it:
var MyData:Array of Item;
i:Integer;
begin
MyData:=ScanRoutine([$FFFF],[$FFFF],[backpack],25,true);
for i :=0 to (Length(MyData)-1)do
begin
AddToJournal(MyData[i].ItemProperty);
end;
end.
I declare an Own Type and you can make an Data Array of it.
ItemID:Cardinal;
ItemType:Cardinal;
ItemLocation:Cardinal;
ItemDistance:Integer;
ItemColor:Cardinal;
ItemName:String;
ItemProperty:String;
are the Supported Informations.
How to use:
1)Copy and paste Scriptcode
2)Form an Array of Item in your Main
3)Use your Array of Item Variable and call my Method arguments are: (TypeList:Array of Cardinal;ColorList:Array of Cardinal;LocationList:Array of Cardinal;Distance:Integer;UseSubLocation:Boolean)
So you can add multiple Types,Colors,location,Give a Scan Distance for Ground location and enable Subcontainer Scanning.
4)Result will be the List of Foundet Items, with Name,ID,Type,Location,Color,Property as Simple String
My Personal Next Step will be a method to insert Your Array of Item into a new Method and getting a list of
ID,Propertys with amount. My Last Step will be a Method insert Itemlist with propertys and getting ID and Score for each Item:)