Hello there. As there is no section for stealth scripts, i made this little thread. People that are not familiar with stealth client - it is a non-graphical script client for uo, but if you want you can attach the graphical client as well. It has a mass of possibilities, and the script language(pascal) is pretty easy to learn.
The first script I want to demonstrate is support script in pvp - a healer runs behind the host char with a precasted greater heal and heals every one from the friendlist when theyre health comes down to 94% (23). Cures as well when needed. + the best bonus is line of sight check, so for example if your friend is behind a wall but < 10 tiles from you, you wont try to cast on him.
onst Host = $000F7F27;
var p : TPathArray;
c : Integer;
i : Integer;
MeditTime : Cardinal;
Friend: array of Cardinal;
res : Boolean;
procedure Medit;
begin
if WarMode = true then SetWarMode(false);
if Mana < MaxMana then
begin
if ((Timer > (MeditTime + (11 * 1000))) or (MeditTime = 0)) then
begin
UseSkill('Meditation');
MeditTime :=Timer;
end;
end;
end;
procedure PrecastGH;
begin
if not TargetPresent then
begin
if (Count($0F85) > 0) and (Count($0F84) > 0) and (Count($0F86) > 0) and (Count($0F8D) > 0) and (Mana > 10) then
begin
Cast('Greater heal');
WaitForTarget(2000);
end;
end;
end;
procedure Cure;
begin
if TargetPresent then CancelTarget;
if (Count($0F84) > 0) and (Count($0F85) > 0) and (Mana > 5) then
begin
Cast('Cure');
WaitForTarget(2000);
res := CheckLoS(getX(self), getY(self), getZ(self) + 15, getX(Friend[i]), getY(Friend[i]), getZ(Friend[i]) + 15, WorldNum);
if TargetPresent and (getDistance(Friend[i]) < 11) and (Mana > 5) and res then TargetToObject(Friend[i]);
end;
end;
procedure Checktarget;
begin
Friend := [$000DC8C1, $000DCFE0, $000F7F27];
for i := 0 to Length(Friend) -1 do
begin
res := CheckLoS(getX(self), getY(self), getZ(self) + 15, getX(Friend[i]), getY(Friend[i]), getZ(Friend[i]) + 15, WorldNum);
if IsPoisoned(Friend[i]) and res then cure;
if (GetHP(Friend[i]) < (GetMaxHP(Friend[i]) - 3)) and (GetHP(Friend[i]) > 0) and TargetPresent and (getDistance(Friend[i]) < 11) and (Mana > 10) and res then TargetToObject(Friend[i]);
end;
end;
begin
losOptions := losTypeRunUO;
while not dead do
begin
wait(50);
if getDistance(Host) > 4 then
begin
c := GetPathArrayFrom(PredictedX, PredictedY, PredictedZ, GetX(Host), GetY(Host), 1, True, p);
if c > 0 then StepQ(CalcDir(PredictedX, PredictedY, p[0].X, p[0].Y), True);
end;
PrecastGH;
Checktarget;
Medit;
end;
end.
The other script is a idoc finder, that stores results in a file, [ xy, state, date ], when an greatly or idoc found yells M! so if you want you could mark a rune near the house.
procedure WriteToFile(filepath: string; data: string);
var mode: Word;
begin
if FileExists(filepath) then mode := fmOpenReadWrite
else mode := fmCreate;
with TFileStream.Create(filepath,mode) do
try
Seek(0,soFromEnd);
WriteBuffer(data,Length(data));
finally
Free;
end;
end;
function status(str : String) : String;
begin
result := '???';
// if BMSearch(1, str, 'This house is fairly worn.') > 0 then result := 'fairly'; // just had too amny fairlys on the tests
if BMSearch(1, str, 'This house is greatly worn.') > 0 then result := 'greatly';
if BMSearch(1, str, 'This house is in danger of collapsing.') > 0 then result := 'idoc';
end;
procedure checkStatus;
var s : String;
begin
s := status(journal(lineIndex));
if s <> '???' then
begin
writeToFile('C:\Idocs3.txt', intToStr(getX(finditem)) + ' ' + intToStr(getY(finditem)) +' ' + s + ' ' + DateTimeToStr(Now) +#13#10);
UOsay('M!!!!');
end;
end;
function findTypes(types : array of word; container : cardinal) : cardinal;
var
f : integer;
begin
result := 0;
for f := 0 to getArrayLength(types) - 1 do
if (findType(types[f], container) <> 0) then
begin
result := finditem;
break;
end;
end;
var lastTime : TDateTime;
begin
findDistance := 25 // maximum distance
findVertical := 128 // maximum vertical distance
while not Dead do
begin
FindTypes([$0BD2,$0BA4,$0BA6,$0BA8,$0BAA,$0BAC,$0BAE,$0BB0,$0BB2,$0BB4,$0BB6,$0BB8,$0BBA,$0BBC,$0BBE,$0BC0,$0BC2,$0BC4,$0BC6,$0BC8,$0BCA,$0BCC,$0BCE,$0BD0,$0BD2,$0BD4,$0BD6,$0BD8,$0BDA,$0BDC,$0BDE,$0BE0,$0BE2,$0BE6,$0BE8,$0BEA,$0BEC,$0BEE,$0BF0,$0BF2,$0BF4,$0BF6,$0BF8,$0BFA,$0BFC,$0BFE,$0C00,$0C02,$0C04,$0C06,$0C08,$0C0A,$0C0C,$0C0E], ground)
if finditem <> 0 then
begin
lastTime := now;
wait(100);
clickOnObject(finditem);
if waitJournalLine(lastTime, 'This house is', 3000) then checkStatus;
ignore(finditem);
end;
wait(500);
end;
End.
I'm still a newbie at pascal, so don't judge hard.
ps; you can check house signs that are 25 tiles away from your character, so you have a big advantage..