Lol UpText is very simple. As blumblebee said, move the mouse onto the DTM. Then call this line.
if (WaitUpText({Object UpText}, RandomRange(200, 400))) then
//Do What You Want :D
There are several functions for checking uptext :D
There are plenty of ways of making it know which amulet it is, just gotta use your imagination :)
As for Casting on each amulet, just take your time and think it through :D
function FindItemsInInventory(ItemDTMs:TIntegerArray): TIntegerArray; // ItemDTM's will be the Item DTMs :D The Result will be the slot numbers of all the items it found.
var
a, i, X, Y: Integer;
InventorySlot: TBox;
SlotsFound: Integer;
begin
SlotsFound := 0;
for I := 1 to 28 do // 28 inventory slots. starting from the 1st...
begin
InventorySlot := InvBox(I); // gets the inv slot.
{scans the slot for each dtm in the array}
for a := 0 to High(DTM) do
if FindDTM(ItemDTMs[a], X, Y, InventorySlot.X1, InventorySlot.Y1, InventorySlot.X2, InventorySlot.Y2) then
begin
{SlotsFound is simply used to set the result array length}
Inc(SlotsFound);
SetLength(Result, SlotsFound); // Sets the Results Length to the amount of items it found.
Result[SlotsFound - 1] := i; // saves the slot number to the result array.
Break; // Breaks out of the loop since we can only have 1 item in each slot.
end;
end;
end;
function CastOnAllAmulets(SpellName: string): Boolean;
var
a, CGT: Integer; // CGT = Current Game Tab.
i: TBox; // Used for inventory slots.
AmuletDTM: Integer; // amulet DTM.
Amulets: TIntegerArray; // Our slot array.
begin
{Setup}
CGT := GetCurrentTab;
GameTab(25);
Amulets := FindItemsInInventory([AmuletDTM]); // Saves the Slot Numbers of all the amulets.
{Attempts to cast spell}
try // I like using Try loops ^^.
for a := 0 to High(Amulets) do
begin
{Search for items}
i := InvBox(Amulets[a]); // Gets the Inventory slot of our amulet.
GameTab(28); // switches to magic tab.
{Attempt To Cast Spell}
Result := Cast(SpellName, False); // casts spell.
if (not(Result)) then
begin
srl_Warn('CastOnAllAmulets', 'Failed to activate spell ' +SpellName, 0);
Exit;
end;
{Uhm.. Casts the spell on the item?? I think <.<}
GameTab(25); // switches back to Inv.
MouseBox(i.X1, i.Y1, i.X2, i.Y2, 1); // I dunno how enchanting/magic works =P But MouseBox clicks on a random point in a TBox, so this should work.. i think =/ lol
end;
finally // Regardless of what happens..
GameTab(CGT); // Switch back to the initial gametab.
end;
end;
Just an example, i don't know if that will compile or not xD, or if that will work in theory, but its just to give some ideas :P. Plenty of ways of doing this :D. Blumblebee's methods work very well for this situation ^^. Pretty much any method for anything can do a job :D just make your you failsafe it ^^.