Author Topic: Looking For Mentor?  (Read 10728 times)

0 Members and 1 Guest are viewing this topic.

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Looking For Mentor?
« on: July 30, 2016, 07:55:35 PM »
0
Hey guys,

You can call me playforfun! I'm looking for someone who would be willing to help me learn Pascal and how to code in Stealth. I really enjoy learning macro/script like tools for UO I consider it a hobby/passion something about it is so ADDICTIVE! To get a game play itself for you is somewhat MAGICAL lol. Anyways I'm a AVID learner I would say and I'm a curious cat, I would say I mastered UOSteam ( not saying much ) but now I want to learn how to ACTUALLY code and learn languages that I can use outside of UO! I'm not just some guy who hops on the forums and asks for free scripts I prefer to make my own things and share them it's more fun that way, I just need some guidance on how to become an efficient coder. I've already dived into trying to learn the StealthAPI but there is much to learn as well as going to websites to learn Pascal. Not trying to bash the creators of stealth but UOSteam documentation was easier to learn and read because of all the examples, maybe cause they weren't Russian? haha!

Here are some things I've accomplished in UOSteam:

Runebook Recaller: Will scan a runebook determine how many runes are in it regardless of name and will recall to them accordingly.
Leather Suit Creator: Will create 125 sets of leather armor, dye them and store them in designated containers.
Stool Macro: Will place stools around a player according to position they are from you.

lol and plenty more but my favorite!

AFK Tamer Macro: Will recall to spots, kill designated monsters, loot corpses, heal pets, run from any incoming damage and heal, recall out if and dangerous players are nearby, play sound file if a GM is shown, automatically restocks, drops off items that want to be kept, sells remaining items to vendors, take break times ( user set )!

haha I'm just sharing some scripts that I've made to show you that I'm serious and want to succeed in stealth the same way I succeeded in UOSteam, will take more effort but I'm willing to give my all! Anyways I'm not allowed to PM and nor do I want to put my Skype publicly for everyone to see but I would like to communicate to whomever is willing to be my teaching buddy hopefully not just via forums!


TLDR;

Looking for someone willing to teach a dedicated student how to code in Pascal efficiently!

thanks for the read guys.

PS: or if your a new learner to pascal and would love to learn with me!


Post Merge: July 31, 2016, 02:45:26 AM
Hey guys update need help with a mining script I'm trying to make..

I need to learn how to create a list of integers that way I can recall down a list of runes, and always have it bookmarked last place I visited. I'm really confused how to do this I see a way to make a list off strings from cromo tutorial... also was  going to make a list for coordinates to mine but I thought is there a way to target by relative tile? ie: always target 1 tile to east.

Anyways this is what I'm at right now, you can tell I use UOSteam alot based off ths script! ( no it's not complete )

Code: [Select]
{
Author: playforfun
Date: 7/30/2106
Version: 1.0
Desription:
Will mine ore until depletion
}

    {start of structure}
 {000FEE46 // You have worn out your tool!
  0007AD00 // There is nothing to mine here.
 }

Program Miner;

Const
    Swing = 1;
    Shovel = $0F39;
    Tool = $1EB8;
    Ingot = $1BF2;
Var
    TotalSwing : Integer;    
    MineSpots : TIntegerList;  

    {end of structure}
                          
    {start of script}    
    
begin
      {create mine spot locations}
      MineSpots := TIntegerList.Create();
        
        {check if depleted vein}
        ClearJournal;
        while InJournal('0007AD00') < 0 do
        begin  
            {look for shovel}
             if FindType(Shovel,Backpack) > 1 then
             begin
                {use shovel}            
                UseObject(FindItem);
                WaitTargetTile(0,1175,1882,4);  
                Wait(1000);                                                
             {look for required ingots}                        
             end else if FindType(Ingot,Backpack) > 6 then
             begin                  
                UseType(Tool,$0000);
                WaitGump('38920ABD');  
                {make tool}
                while Count(Tool) < 2 do
                begin      
                    WaitGump('23');
                    WaitGump('38920ABD');
                    Wait(300);
                end;
                {make shovel}  
                 while Count(Shovel) < 2 do
                begin      
                    WaitGump('72');
                    WaitGump('38920ABD');
                    Wait(300);
                end;
             end;
        end;          
end.
« Last Edit: July 31, 2016, 01:02:12 AM by playforfun »

Offline Drabadan

  • Jr. Member
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • Drabadan has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #1 on: July 31, 2016, 03:46:36 AM »
0
Here i have a script which has that functionality in it, so you can try read it until you will find out what's and where...
Or ask any questions...

Code: [Select]
Program Mining_BestUO_Kendal;

const
    SeekRange = 20; //радиус поиска деревьев
    Pickaxe_Type = $0E85;
    Shovel_Type = $0E85;
    Invizka_Type = $0E24;
    Invizka_Color = $0060;
    Rune_Type = $1F14;
    Knife_Type = $13F6;
    Lockpick_Type = $14FB;
    IsidasChest_Type = $0E43;
    Rock_Type = $177C;
    Food_Type = $097B;  
//==========================================================================//
    MyMaxWeight = 550;
    //HomeRune = $4029C175;
//===========================================================================//
    HomeChest = $40924E0C;
    BagOfRunes = $40C2BB44;
    ReloadBag = $40975D90;
    ResultBag = $40361CAC;
    UnlootBag = $40C2BB44;
//===========================================================================//
   ICQ_login = ;
   ICQ_password = ;
   TargetICQ_login = ;


type
    MinTile = record
        x, y, z, Tile : Word;
    end;

var
    Caves_Array : Array of Cardinal;
    MinTiles_Array : Array of MinTile;
    Ore : Array[0..3] of Word;
    Cave_Index, Idx, controlInt : Integer;
    FlagPk, FlagProceed : Boolean;
    ReloadItems_Array : Array[0..6] of Word;
    LootItems_Array : Array of Word;
    HomeRune : Cardinal;
    
{$Region Initializing}

//Initiation of ore types Array;
procedure InitOre;
  begin
    Ore[0] := $19B7;               // 1 Ore
    Ore[1] := $19BA;               // 2 Ore
    Ore[2] := $19B8;               // 3 Ore
    Ore[3] := $19B9;               // 4 Ore
    
    if CharName = 'Kraz' then HomeRune := $4029C175;
    if CharName = 'Drabadan' then HomeRune := $4044D616;
  end;
  
//Initiation of ReloadItems_Array
procedure InitReloadItems_Array;
begin
     ReloadItems_Array[0] := BM;
     ReloadItems_Array[1] := BP;
     ReloadItems_Array[2] := MR;
     ReloadItems_Array[3] := Invizka_Type;
     ReloadItems_Array[4] := Pickaxe_Type;
     ReloadItems_Array[5] := Lockpick_Type;
     ReloadItems_Array[6] := Knife_Type;        
end;
  
//Initiation of RunesToCaves;
procedure GetCaveRunes;
var
    i : Integer;
begin
    MoveOpenDoor := True;
    NewMoveXY(GetX(HomeChest), GetY(HomeChest), true, 1, true);
    Wait(1000);
    UseObject(HomeChest);
    CheckLag(30000);
    Wait(1000);
    UseObject(BagOfRunes);
    CheckLag(30000);
    Wait(1000);
    //for i := 0 to 20 do AddToSystemJournal(IntToStr(i));
    if FindType(Rune_Type, BagOfRunes) > 0 then
        begin
            //AddToSystemJournal(IntToStr(FindCount));
            SetLength(Caves_Array, FindCount);
            for i := 0 to FindCount -1 do
                begin
                     FindType(Rune_Type, BagOfRunes);                    
                     Caves_Array[i] := FindItem;
                     Ignore(FindItem);                                          
                end;
        end
    else
        AddToSystemJournal('No runes found...');
    IgnoreReset;
    AddToSystemJournal('Added ' + IntToStr(Length(Caves_Array)) + ' Caves.');        
end;  

{$Endregion}

{$Region Kernel procedures}
function ArrayHasItem(My_Array : Array of Word; Item_Type : Word) : Boolean;
var i : Integer;
begin
    Result := False;
    for i := Low(My_Array) to High(My_Array) do
        if Item_Type = My_Array[i] then Result := True;
end;
{$Region MobHandling}

function IsMob : Cardinal;
begin    
    Result := 0;
    if FindType($000E, Ground) > 0 then Result := FindItem;
end;

procedure CarveAndLoot;
var  
    Corpse : Cardinal;
begin    
    Wait(1000);
    Beep;
    if FindType($2006, Ground) > 0 then
        begin
            Corpse := FindItem;
            UseType(Knife_Type, $FFFF);
            CheckLag(30000);
            if WaitForTarget(5000) then
                TargetToObject(Corpse)
            else
                AddToSystemJournal('No knifes found!');
            CheckLag(30000);
            Wait(650);
            UseObject(Corpse);
            Wait(1000);
            CheckLag(30000);            
            while FindType($FFFF, Corpse) > 0 do
                begin
                    if not ArrayHasItem(LootItems_Array, GetType(FindItem)) then
                        begin
                            SetLength(LootItems_Array, Length(LootItems_Array)+1);
                            LootItems_Array[High(LootItems_Array)] := GetType(FindItem);
                        end;
                    MoveItem(FindItem, 0, Backpack, 0,0,0);
                    Wait(650);
                    CheckLag(30000);
                end;
            if FindType(Rock_Type, Ground) > 0 then
                begin
                    UseObject(FindItem);
                    Wait(300);
                    CheckLag(30000);
                end
            else
                ClientPrint('No rocks found...');
            if FindType(IsidasChest_Type, Ground) > 0 then
                begin
                    Corpse := FindItem;
                    UseType(Lockpick_Type, $FFFF);
                    CheckLag(30000);
                    if WaitForTarget(5000) then TargetToObject(Corpse);
                end
            else
                ClientPrint('No chests found...');
            Ignore(Corpse);
        end;
    ClientPrint('Loot finished!');  
end;

procedure KillMob(Mob : Cardinal);
var
    ctime : TDateTime;    
begin
    ctime := Now;
    while IsMob > 0 do
        begin            
            Attack(Mob);
            Wait(300);
            CheckLag(30000);
            if WaitJournalLine(ctime, 'убили', 300) then break;
        end;
    CarveAndLoot;    
end;

{$EndRegion}

function GetRuneCharges(Rune_Id : Cardinal) : Integer;
var
    CTime : TDateTime;
    s : String;
begin
    CTime := Now;
    ClickOnObject(Rune_Id);
    CheckLag(30000);
    Result := 0;
     if WaitJournalLine(CTime, '(', 2000) then
        begin
            Idx := InJournalBetweenTimes('(', CTime, Now);
            s := Journal(Idx);
            Delete(s, Pos(')',s), Length(s));
            Delete(s, 1, Pos('(', s));
            Result := StrToInt(s);
        end
    else
        Result := -1;
end;

procedure WaitLag(WaitMS : Integer);
begin
    Wait(WaitMS);
    CheckLag(60000);
end;

//Icq handling;
procedure SendMsg_ICQ(str : String);
begin
    if not ICQConnected then
        ICQConnect(ICQ_login, ICQ_password);
    if ICQConnected then
        ICQSendText(TargetICQ_Login, str)
    else
        AddToSystemJournal('No icq connection, failed to send message!');  
end;

//procedure GetTilesToMine;
procedure GetTilesToMine;
var
    x, y, i : Integer;
    TileInfo : TStaticCell;
begin
    SetLength(MinTiles_Array, 0);
    for x := (-1 * SeekRange) to SeekRange do
        for y := (-1 * SeekRange) to SeekRange do
            begin
                TileInfo := ReadStaticsXY(GetX(self)+x, GetY(self)+y, 0);
                if TileInfo.StaticCount > 0 then
                    for i := Low(TileInfo.Statics) to High(TileInfo.Statics) do
                        if (TileInfo.Statics[i].Tile >= 1339) and (TileInfo.Statics[i].Tile <= 1359) and (TileInfo.Statics[i].z = GetZ(self)) then
                            begin
                                SetLength(MinTiles_Array, Length(MinTiles_Array) + 1);
                                MinTiles_Array[High(MinTiles_Array)].Tile := TileInfo.Statics[i].Tile;
                                MinTiles_Array[High(MinTiles_Array)].x := TileInfo.Statics[i].x;
                                MinTiles_Array[High(MinTiles_Array)].y := TileInfo.Statics[i].y;
                                MinTiles_Array[High(MinTiles_Array)].z := TileInfo.Statics[i].z;
                            end;                            
            end;
        AddToSystemJournal('Found ' + IntToStr(Length(MinTiles_Array)) + ' tiles to mine.');  
end;

//Antimacro;
procedure GumpHandling;
var
    gi : TGumpInfo;
    st : TStringList;
    tResult : Integer;
begin
    Wait(RandomRange(1, 6)*1000);
    GetGumpInfo(GetGumpsCount-1, gi);
    st := TStringList.Create;
    StrBreakApart(gi.Text[High(gi.Text)], ' ', st);
    if st.Count > 0 then
        begin
            if st[1] = 'плюс' then
                tResult := StrToInt(st[0]) + StrToInt(st[2]);
            if st[1] = 'минус' then
                tResult := StrToInt(st[0]) - StrToInt(st[2]);
        end;        
    if tResult > -1 then
        begin
            Wait(1500);
            CheckLag(30000);
            AddToSystemJournal('Gump answer is: ' + IntToStr(tResult));
            NumGumpTextEntry(GetGumpsCount-1, 0, IntToStr(tResult));
            NumGumpButton(GetGumpsCount-1, gi.GumpButtons[Low(gi.GumpButtons)].return_value);
        end
    else
        AddToSystemJournal('ERROR');
    st.Free;
end;

//runing from PK;
function RunPK : Boolean;
var i : Integer;
begin
    Result := False;
    Ignore(self);
    FindDistance := 20;
    if (FindType($0190, Ground) > 1) or (FindType($0191, Ground) > 0) then
        begin
            ClickOnObject(FindItem);
            Result := True;
            Cast('Recall');
            AddToSystemJournal('Name: ' + GetName(FindItem));
            SendMsg_ICQ('PK at: ' + CharName);
            CheckLag(30000);
            if WaitForTarget(3000) then TargetToObject(HomeRune);
            UseObject(FindTypeEx($0E24, $0060, Backpack, false));            
            for i := 0 to 45 do
                begin
                    Wait(100);
                    CheckLag(30000);
                    if FindType($0F0D, Ground) > 0 then MoveItem(FindItem, 0, Backpack, 0,0,0);
                end;
        end;
end;

procedure CheckHide;
var i : Integer;
begin
    while not Hidden do
        begin
            UseSkill('Hiding');
            for i := 0 to 55 do
                begin
                    Wait(100);
                    CheckLag(30000);
                    if Hidden then break;
                end;
        end;
end;

procedure CheckMana;
var
    i : Integer;
    ctime : TDateTime;
begin
    if Mana < MaxMana/2 then        
        begin
            for i := 0 to 999 do
                begin
                    ctime := Now;
                    UseSkill('Meditation');
                    Wait(300);
                    CheckLag(30000);
                    if not WaitJournalLine(ctime, 'You lose', 5000) then break;
                end;
            while Mana < MaxMana-10 do Wait(1000);
        end
    else
        ClientPrint('Mana ok...');                      
end;

function FindGM : Boolean;
begin
    Result := False;
    if (GetDistance($00000001) < 20) and (GetDistance($00000001) > -1) then Result := True;
    FindDistance := 20;
    if FindTypeEx($FFFF, $83EA, Ground, True) > 0 then Result := True;
end;

procedure GMFound;
var i : Integer;
begin
    for i := 0 to 3 do
        begin
            SendMsg_ICQ('ЕШЕЛЬМЕ ЕШЕЛЬБЕ!!!! НАЩАЙНИКЕ ПРИШОЛь');
            Beep;
            Wait(600);
            AddToSystemJournal('ЕШЕЛЬМЕ ЕШЕЛЬБЕ!!!! НАЩАЙНИКЕ ПРИШОЛь');
        end;
    UOSay('хеллоу');
    Wait(10000);    
end;

//MinTile with Index of MinTiles_Array
procedure MinTileSpot(Idx : Integer);
var
    i, k : Integer;
    msgFizzle, msgEnd : String;
    cTime : TDateTime;    
begin
    msgFizzle := 'You put |You loosen ';
    msgEnd := 'is nothing| too far| mining in rock| cannot mine| no line| reach| not to mine|Try mining ';
    if Dist(GetX(self), GetY(self), MinTiles_Array[Idx].x, MinTiles_Array[Idx].y) > 2 then
        NewMoveXY(MinTiles_Array[Idx].x, MinTiles_Array[Idx].y, true, 1, true);
    for k := 0 to 4 do
        begin
            if IsMob > 0 then KillMob(IsMob);
            if FlagPk then exit;
            if WarMode then SetWarMode(False);
            if FindGM then GMFound;
            //if not Hidden then CheckHide;    
            if IsGump then GumpHandling;
            if RunPk then FlagPk := True;    
            if UseType(Pickaxe_Type, $FFFF) = 0 then
                UseType(Shovel_Type, $FFFF);
            CheckLag(30000);
            if not WaitForTarget(3000) then
                if UseType(Pickaxe_Type, $FFFF) = 0 then
                    UseType(Shovel_Type, $FFFF);
            CheckLag(30000);
            if not WaitForTarget(3000) then
                begin
                    ClientPrint('No pickaxes or shovels found...');
                    exit;
                end
            else
                begin
                    cTime := Now;
                    TargetToTile(MinTiles_Array[Idx].Tile, MinTiles_Array[Idx].x, MinTiles_Array[Idx].y, MinTiles_Array[Idx].z);                    
                    for i := 0 to 70 do
                        begin
                            if IsMob > 0 then KillMob(IsMob);
                            if RunPk then
                                begin
                                    FlagPk := True;
                                    break;
                                end;
                            Wait(100);
                            CheckLag(30000);
                            if (InJournalBetweenTimes(msgFizzle, cTime, Now) <> -1) then break;
                            if (InJournalBetweenTimes(msgEnd, cTime, Now) <> -1) then exit;
                        end;
                end;
        end;
    ClientPrint('Tile finished.');    
end;

//no comments
function Recall(Rune : Cardinal) : Boolean;
var i, cX, cY : Integer;
begin
    Result := False;
    cX := GetX(self);
    cY := GetY(self);
    Cast('Recall');
    CheckLag(30000);
    if WaitForTarget(3000) then TargetToObject(Rune);
    for i := 0 to 70 do
        begin
            CheckLag(30000);
            Wait(100);
            if (GetX(self) <> cX) or (GetY(self) <> cY) then
                begin
                    Result := True;
                    break;
                end;
        end;                
end;

procedure RemarkHomeRune;
begin
    if GetRuneCharges(HomeRune) < 10 then
        begin
            Cast('Mark');
            CheckLag(30000);            
            if WaitForTarget(5000) then TargetToObject(HomeRune);
            Wait(5000);
            CheckMana;
        end
    else
        ClientPrint('Rune ok...');      
end;

function CanRecall(Rune_Id : Cardinal) : Boolean;
begin
    Result := False;
    if GetRuneCharges(Rune_Id) > 10 then
        begin
            CheckMana;
            Result := True;
        end;
end;

//no comments
procedure Unload;
var
    i, tQuantity : Integer;
    tItem : Cardinal;
    ctime : TDateTime;  
begin
    SendMsg_ICQ('Unloading at: ' + CharName);
    InitReloadItems_Array;
    InitOre;
    if GetDistance(HomeChest) = -1 then
        begin
            Recall(HomeRune);
            Wait(300);
            CheckLag(30000);
            CheckMana;
            RemarkHomeRune;
        end;        
    MoveOpenDoor := True;
    NewMoveXY(GetX(HomeChest), GetY(HomeChest), true, 1, true);
    Wait(1000);
    //UOSay('BANK VISCA BARCELONA!!!');
    UseObject(HomeChest);
    Wait(1000);
    CheckLag(30000);
    for i := Low(Ore) to High(Ore) do
        while FindType(Ore[i], Backpack) > 0 do
            begin
                MoveItem(FindItem, 0, ResultBag, 0,0,0);
                Wait(650);
                CheckLag(30000);
            end;
    if Length(LootItems_Array) > 0 then
        begin
            UseObject(UnlootBag);
            CheckLag(30000);
            Wait(600);
            for i := Low(LootItems_Array) to High(LootItems_Array) do
                while FindType(LootItems_Array[i], Backpack) > 0 do
                    begin
                        MoveItem(FindItem, 0, UnlootBag, 0,0,0);
                        Wait(600);
                        CheckLag(30000);
                    end;
        end;  
    UseObject(ReloadBag);
    Wait(600);
    CheckLag(30000);
    if FindType(Food_Type, ReloadBag) > 0 then
        begin
            MoveItem(FindItem, 15, Backpack, 0,0,0);
            Wait(650);
            CheckLag(30000);
            for i := 0 to 30 do                
                begin
                    ctime := Now;
                    UseObject(FindType(Food_Type, Backpack));
                    Wait(300);
                    CheckLag(30000);
                    if WaitJournalLine(ctime, 'simply too', 1000) then break;
                end;
            MoveItem(FindType(Food_Type, Backpack), 0, ReloadBag, 0,0,0);
            Wait(650);
            CheckLag(30000);
        end;
    if FindType($0F0E, Backpack) > 0 then
        begin
            MoveItem(FindItem, 0, ReloadBag, 0,0,0);
            Wait(650);
            CheckLag(30000);
        end;
    for i := Low(ReloadItems_Array) to High(ReloadItems_Array) do
        begin
            if FindType(ReloadItems_Array[i], ReloadBag) > 0 then
                begin
                    tItem := FindItem;
                    if FindType(ReloadItems_Array[i], Backpack) <= 0 then
                        begin                            
                            MoveItem(tItem, 5, Backpack, 0,0,0);
                            Wait(1000);
                            CheckLag(30000);
                        end
                    else
                        begin
                            tQuantity := FindFullQuantity;
                            //AddToSystemJournal(IntToStr(tQuantity));
                            if tQuantity < 5 then                              
                                begin
                                    MoveItem(tItem, 5 - FindFullQuantity, Backpack, 0,0,0);
                                    Wait(1000);
                                    CheckLag(30000);
                                end;
                        end;
                end
            else
                begin
                    FlagProceed := False;
                    AddToSystemJournal('Lack of resources to proceed, halting!');
                end;
        end;    
    ClientPrint('Unload Complete!');    
    CheckMana;        
end;                              

{$Endregion}

//Main Loop
begin
    //SendMsg_ICQ('Script started at: ' + CharName);    
    IgnoreReset;
    FlagProceed := True;
    GetCaveRunes;
    Unload;  
    while not Dead and FlagProceed do
        begin
            while IsGump do CloseSimpleGump(GetGumpsCount-1);
            for Cave_Index := Low(Caves_Array) to High(Caves_Array) do  
                begin
                    CLientPrint('Rune num: ' + IntToStr(Cave_Index));
                    if not FlagProceed then break;
                    if CanRecall(Caves_Array[Cave_Index]) and FlagProceed then
                        begin
                            Recall(Caves_Array[Cave_Index]);
                            Wait(300);
                            CheckLag(30000);
                            GetTilesToMine;
                        end;
                    for Idx := 0 to Length(MinTiles_Array)-1 do
                        begin
                            CLientPrint('Tile num: ' + IntToStr(Idx));
                            if Weight >= MyMaxWeight then
                                begin
                                    controlInt := Idx;
                                    Unload;
                                    Recall(Caves_Array[Cave_Index]);
                                    WaitLag(1000);
                                    Idx := controlInt;
                                end;  
                            if not FlagProceed then break;
                            if (Idx >= Low(MinTiles_Array)) and (Idx <= High(MinTiles_Array)) then
                                 MinTileSpot(Idx)
                            else
                                begin
                                    AddToSystemJournal('Index is out of range, index value is: ' + IntToStr(Idx));
                                    break;
                                end;
                            if FlagPk then
                                begin
                                    Unload;
                                    AddToSystemJournal('PK');
                                    Wait(300000);
                                    FlagPk := False;
                                    break;                                    
                                end;                
                        end;
                    Unload;
                end;
        end;
end.

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #2 on: July 31, 2016, 07:30:11 PM »
0
Code: [Select]
procedure GetTilesToMine;
var
    x, y, i : Integer;
    TileInfo : TStaticCell;
begin
    SetLength(MinTiles_Array, 0);
    for x := (-1 * SeekRange) to SeekRange do
        for y := (-1 * SeekRange) to SeekRange do
            begin
                TileInfo := ReadStaticsXY(GetX(self)+x, GetY(self)+y, 0);
                if TileInfo.StaticCount > 0 then
                    for i := Low(TileInfo.Statics) to High(TileInfo.Statics) do
                        if (TileInfo.Statics[i].Tile >= 1339) and (TileInfo.Statics[i].Tile <= 1359) and (TileInfo.Statics[i].z = GetZ(self)) then
                            begin
                                SetLength(MinTiles_Array, Length(MinTiles_Array) + 1);
                                MinTiles_Array[High(MinTiles_Array)].Tile := TileInfo.Statics[i].Tile;
                                MinTiles_Array[High(MinTiles_Array)].x := TileInfo.Statics[i].x;
                                MinTiles_Array[High(MinTiles_Array)].y := TileInfo.Statics[i].y;
                                MinTiles_Array[High(MinTiles_Array)].z := TileInfo.Statics[i].z;
                            end;                           
            end;
        AddToSystemJournal('Found ' + IntToStr(Length(MinTiles_Array)) + ' tiles to mine.');   
end;

Hey I'm trying to decipher your code but where do we get the value from SeekRange?
Also I was thinking if all my runes will be to the east of a spot, couldn't I subtract -1 from my X location, and it will target to the East always.

Offline graysont

  • Jr. Member
  • **
  • Posts: 12
  • Activity:
    0%
  • Reputation Power: 1
  • graysont has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #3 on: July 31, 2016, 07:31:35 PM »
0
"is there a way to target by relative tile? ie: always target 1 tile to east."

In short, probably not. I've researched all the mining-related macros available on the internet for Stealth. In the Russian forum I'd find a post and then everyone's claiming it says "cannot see location" when trying to use their script.

I've been using Stealth for a couple days now. What I've found is the "tile" that Stealth needs in order to target the tile at x / y / z is the exact same tile number you can get from easyuo ... so you can record an area's information with easyuo and output it to Stealth and that works.

Example ...

This line in Stealth will properly target a tile to mine it (but only cave floor, not mountain edge) ...

TargetToTile(1343,1649,2892,0);   

1343 is easyuo #LTARGETTILE
1649 is easyuo #LTARGETX
2892 is easyuo #LTARGETY
0 is easyuo #LTARGETZ

This only works on cave floors. The reason being, easyuo lets you set #LTARGETKIND ... and mountain sides are often different #LTARGETKIND than cave floors, and I'm failing to see in Stealth UO where you can set #LTARGETKIND.

I've tested using Stealth to find tiles ... the problem is I can find the tile # but I don't know how to reference it. I see the tile # when debugging, but it's nested in a very deep array and can't figure out how to reference it, and the variable name they used for it was only found on 1 page on the entire internet and it was in python and I'm using pascal ... I gave up trying to access that value and I just made an easyuo recorder that stores the values I get manually and then I convert the values to Stealth.


Post Merge: July 31, 2016, 07:37:55 PM
That code posted above, does it actually work for anyone? Drbadan, do you actually use that code successfully?

Because it's taken from here ...

http://forum.uorpg.net/viewtopic.php?t=7990

And you yourself posted this to that ...

[04:25:36:796] You see: Drabadan
[04:25:39:156] System: Where do you want to use the Iron pickaxe?
[04:25:39:593] System: You have no line of sight to that location
[04:25:40:078] System: Where do you want to use the Iron pickaxe?
[04:25:40:281] System: You have no line of sight to that location
[04:25:42:843] You see: 3 уровень
[04:25:42:843] You see: Drabadan
[04:25:44:578] System: Where do you want to use the Iron pickaxe?
[04:25:44:937] System: You have no line of sight to that location
[04:25:45:359] System: Where do you want to use the Iron pickaxe?
[04:25:45:843] System: You have no line of sight to that location
[04:25:46:265] System: Where do you want to use the Iron pickaxe?
[04:25:46:625] System: You have no line of sight to that location
[04:25:47:875] System: Where do you want to use the Iron pickaxe?
[04:25:48:312] System: You have no line of sight to that location
[04:25:53:390] System: Where do you want to use the Iron pickaxe?
[04:25:53:875] System: You have no line of sight to that location
[04:25:54:328] System: Where do you want to use the Iron pickaxe?
[04:25:54:765] System: You have no line of sight to that location

So did you actually get it to work? If so, how?
« Last Edit: July 31, 2016, 07:37:55 PM by graysont »

Offline Drabadan

  • Jr. Member
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • Drabadan has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #4 on: July 31, 2016, 09:31:21 PM »
0



Post Merge: July 31, 2016, 07:37:55 PM
That code posted above, does it actually work for anyone? Drbadan, do you actually use that code successfully?

Because it's taken from here ...

http://forum.uorpg.net/viewtopic.php?t=7990

So did you actually get it to work? If so, how?
it's taken from my harddisk, yes it worked very well for me.

I posted it here just for example, so the playforfun could read some.
You couldn't find the 100% working script even for the exact freeshard, becouse in pascal there is not so much options to make independent script with anonymous datasources. So every script should be tuned for yourself.

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #5 on: July 31, 2016, 10:10:45 PM »
0
Hey guys, I made a easy procedure although probably could be improved so much, but I'm just making things simple atm.. keeping it easy not going over my head lol.

Code: [Select]
{mine to west}   
Procedure MineOre ( VAR x, y, z : Integer );
begin
   x:= (GetX(Self)) - 1;   
   y:= (GetY(Self));
   z:= (GetZ(Self));
end;

basically this is a target by relative in hindsight. the issue I've noticed with it'll target to the west but some mountainsides have a higher Z value, so I'm guessing I'll have to create an array of some sort 0-10 and attempt to determie where I can mine.

Offline Drabadan

  • Jr. Member
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • Drabadan has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #6 on: July 31, 2016, 10:55:06 PM »
0
Hey guys, I made a easy procedure although probably could be improved so much, but I'm just making things simple atm.. keeping it easy not going over my head lol.

Code: [Select]
{mine to west}    
Procedure MineOre ( VAR x, y, z : Integer );
begin
   x:= (GetX(Self)) - 1;  
   y:= (GetY(Self));
   z:= (GetZ(Self));
end;

basically this is a target by relative in hindsight. the issue I've noticed with it'll target to the west but some mountainsides have a higher Z value, so I'm guessing I'll have to create an array of some sort 0-10 and attempt to determie where I can mine.

No you can use GetSurfaceZ() function
http://www.stealth.od.ua/Doc:Api/GetSurfaceZ
Code: [Select]
Procedure MineOre (x, y : Integer );
var
 z : ShortInt;
begin
   x:= (GetX(Self)) - 1;  
   y:= (GetY(Self));
   z:= GetSurfaceZ(x, y, WorldNum);
end;

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Looking For Mentor?
« Reply #7 on: July 31, 2016, 11:31:58 PM »
0
Keep going guys, its good to see some people having questions and want some answers..
Regarding Pascal itself, there are no modern books about because nowadays people tend to use delphi, which is the object orientated variant.

I once posted this tutorial about pascal: http://www.scriptuo.com/index.php?topic=12441.0

But never finished the stealth specific tutorial because i not found time and motivation anymore. Digging with stealth in C# were much more interesting.

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #8 on: July 31, 2016, 11:50:03 PM »
0
Hey cool thanks, I'll add that to my Z coordinate:

Now I have another question I'm trying to create a type of gems youo get from mining I type this and get this error

Code: [Select]
type
    GemType = ($3197, $3195, $3193, $3192, $3198, $3194);  

02:49:47:516 [Miner]: Compiling
02:49:47:516 [Miner]: Compiler: [Error] (test.pas at 29:13):  Identifier expected but "$3197" found ;
Error line is: "     GemType = ($3197, $3195, $3193, $3192, $3198, $3194);      "
02:49:47:528 [Miner]: Compiling failed
02:49:47:528 [Miner]: Script test.pas stopped successfuly

EDIT: Scratch this, but still wondering why this doesn't work... Read your code you have and will use something similar the way you have your ore.
« Last Edit: July 31, 2016, 11:52:44 PM by playforfun »

Offline graysont

  • Jr. Member
  • **
  • Posts: 12
  • Activity:
    0%
  • Reputation Power: 1
  • graysont has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #9 on: August 01, 2016, 12:17:01 AM »
0
Hey cool thanks, I'll add that to my Z coordinate:

Now I have another question I'm trying to create a type of gems youo get from mining I type this and get this error

Code: [Select]
type
    GemType = ($3197, $3195, $3193, $3192, $3198, $3194);  

02:49:47:516 [Miner]: Compiling
02:49:47:516 [Miner]: Compiler: [Error] (test.pas at 29:13):  Identifier expected but "$3197" found ;
Error line is: "     GemType = ($3197, $3195, $3193, $3192, $3198, $3194);      "
02:49:47:528 [Miner]: Compiling failed
02:49:47:528 [Miner]: Script test.pas stopped successfuly

EDIT: Scratch this, but still wondering why this doesn't work... Read your code you have and will use something similar the way you have your ore.


This is what I'm using.

Code: [Select]
// JEWELS
const
Jewel1=$0F16;
Jewel2=$0F15;
Jewel3=$0F10;
Jewel4=$0F13;
Jewel5=$0F26;
Jewel6=$0F21;
Jewel7=$0F16;
Jewel8=$0F19;
Jewel9=$0F25;
Jewel10=$0F2D;

Then later in a procedure ...

Code: [Select]
// ***** PUT JEWELS IN BANK
    while((count(Jewel1) + count(Jewel2) + count(Jewel3) + count(Jewel4) + count(Jewel5) + count(Jewel6) + count(Jewel7) + count(Jewel8) + count(Jewel9) + count(Jewel10)) > 0) do
      begin                    
        FindTypesArrayEx([Jewel1,Jewel2,Jewel3,Jewel4,Jewel5,Jewel6,Jewel7,Jewel8,Jewel9,Jewel10],[0],[backpack],false);    
          begin
            MoveItem(finditem,0,Bank,0,0,0);
            wait(2000);      
          end      
      end;

That's assuming you put Bank as ...
Bank := objAtLayer(BankLayer);

and declared as

Var Bank : Cardinal;

Post Merge: August 01, 2016, 02:34:01 AM
By the way, I figured out the difference between cave floors and mountain walls.

If you're mining cave floors, TargetToTile works, something like ...

TargetToTile(1343,1649,2898,0);

But if you're doing mountain walls, use TargetToXYZ, like ...

TargetToXYZ(2615,60,21);

I'm going to try out that GetSurfaceZ(x, y, WorldNum) function because that's a lot better than what I've been doing (clicking like crazy on mountain walls trying to find the real Z).

Incidentally, the difference between TargetToTile and TargetToXYZ in Stealth is exactly the same as the difference between SET #LTARGETKIND 3 and SET #LTARGETKIND 2 in easyuo ... Stealth has different functions whereas easyuo is just using 2 vs 3 as a parameter in targeting the tile.

Interested in mining the mountain walls because there's so many of them, and cave floors are too populated and chances of players interacting or PKing are higher lol.

« Last Edit: August 01, 2016, 12:41:24 AM by graysont »

Offline Drabadan

  • Jr. Member
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • Drabadan has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #10 on: August 01, 2016, 12:49:56 AM »
0
the type directive in pascal means that you will specify some new DataType:
Code: [Select]
type
 TMe = record
   Name : String;
   Height : Integer;
   Age : Byte;
 end;

procedure DescribeMe(Me : TMe);
begin
 AddToSystemJournal('My name is: ' + Me.Name);
 AddToSystemJournal('My height is: ' + Me.Height);
 AddToSystemJournal('My age is: ' + Me.Age);
end;

var
 Me : TMe;

begin
  Me.Name := 'IURII';
  Me.Height := 190;
  Me.Age := 29;
  DescribeMe(Me);
end.
For the gems, i would recommend to use an array; and work with array becouse constructions like
Code: [Select]
while((count(Jewel1) + count(Jewel2) + count(Jewel3) + count(Jewel4) + count(Jewel5) + count(Jewel6) + count(Jewel7) + count(Jewel8) + count(Jewel9) + count(Jewel10)) > 0) this are not the thing that should be done ever...


Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #11 on: August 01, 2016, 12:53:15 AM »
0
Hey man, nice reply.

I had question though is there a way to make a loop and check the integers in the arrays rather then type them all out lengthy?

example in uosteam a list would be created and you would check the list and if you found a item matching in the list it would set it as target IE:

Code: [Select]
//create list of 4 items 1-4
@createlist! 'example'
@pushlist! 'example' 1
@pushlist! 'example' 2
@pushlist! 'example' 3
@pushlist! 'example' 4
//search if item matches any value in list
for 0 to 'example'
if findtype (example[], backpack)
moveitem 'found'
endif
endfor

right now I have this:

Code: [Select]
Program Miner;

Const
    Swing = 1;
    Shovel = $0F39;
    Tool = $1EB8;
    Ingot = $1BF2;
    
Var
    TotalSwing : Integer;
    x, y, z : Integer;    
    Ore : Array[0..3] of Integer;
    Gem : Array[0..5] of Integer;
Procedure OreType();
var
k : Integer
begin
     Ore[0] := $19B9; //large pile
     Ore[1] := $19B8; //medium pile
     Ore[2] := $19BA; //small pile 1
     Ore[3] := $19B7; //small pile 2    
     for k := 1 to 6 do
     if FindType(Ore[0], Backpack) > 0 then  
     UOSay('test');
end;  
Procedure GemType();
begin
     Gem[0] := $3197; //fire ruby
     Gem[1] := $3195; //ecru citrine
     Gem[2] := $3193; //turquoise
     Gem[3] := $3192; //dark sapphire
     Gem[4] := $3198; //blue diamond
     Gem[5] := $3194; //perfect emerald  
end;  

right now Ik it will always say 'test' if it finds Ore[0] or maybe this is fix is as easy as just typing:

 if FindType(Ore[0..3], Backpack) > 0 then  

^^ Does not work but will leave unedited for any noobies that come across this.
« Last Edit: August 01, 2016, 12:58:09 AM by playforfun »

Offline graysont

  • Jr. Member
  • **
  • Posts: 12
  • Activity:
    0%
  • Reputation Power: 1
  • graysont has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #12 on: August 01, 2016, 01:01:19 AM »
0
For the gems, i would recommend to use an array; and work with array becouse constructions like
Code: [Select]
while((count(Jewel1) + count(Jewel2) + count(Jewel3) + count(Jewel4) + count(Jewel5) + count(Jewel6) + count(Jewel7) + count(Jewel8) + count(Jewel9) + count(Jewel10)) > 0) this are not the thing that should be done ever...


[/quote]

I am a super newbie pascal user who has tackled pascal for an entire sum of perhaps 12 hours, who has never used Stealth or pascal before that.

And I've written a dozen miner routes that will likely pull in about 1 mil gold worth per ingots a day on a freeshard.

It either works, or it doesn't work. :p  My scripts are working.

BTW, my Gem set happens to be the same gems you buy from jeweler (diamonds, rubies, etc).

Feel free to post your far more elegant method of putting gems in the bank and I'll declare you king of pascal, delete my working function and replace it with your better function that does the same thing. :p
« Last Edit: August 01, 2016, 01:11:23 AM by graysont »

Offline Drabadan

  • Jr. Member
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • Drabadan has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #13 on: August 01, 2016, 01:06:45 AM »
0
Code: [Select]
type
 TWordArray : Array of Word;

function CheckArrayContainsItem(item : Word; arr : TWordArray) : Boolean;
var
 i : Integer;
begin
  Result := False;
 for i := Low(arr) to High(arr) do
   if(item = arr[i])then
    begin
      Result := True;
      break;
    end;  
end;
//For your example it will look like this:
for i := Low(Ore) to High(Ore) do
  if(FindType(Ore[i], Backpack) > 0) then
   AddToSystemJournal('Found the ore: ' + IntToStr(Ore[i]));

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Looking For Mentor?
« Reply #14 on: August 01, 2016, 01:11:18 AM »
0
Now let's not fight! Yes if it works, why fix it? haha but it's good to learn all type of ways to do something some more faster and efficient!

Thanks guys both are of big help! And that's the plan to mine mine mine ore! Get lot's of gold!

Post Merge: August 01, 2016, 05:15:46 AM
Code: [Select]
type
 TWordArray : Array of Word;

function CheckArrayContainsItem(item : Word; arr : TWordArray) : Boolean;
var
 i : Integer;
begin
  Result := False;
 for i := Low(arr) to High(arr) do
   if(item = arr[i])then
    begin
      Result := True;
      break;
    end;  
end;
//For your example it will look like this:
for i := Low(Ore) to High(Ore) do
  if(FindType(Ore[i], Backpack) > 0) then
   AddToSystemJournal('Found the ore: ' + IntToStr(Ore[i]));

Wow PERFECT! that is exactly how I wanted it to work. After reading this example I now understand how the i: integer plays it part in looping.

Post Merge: August 01, 2016, 03:19:15 AM
For the gems, i would recommend to use an array; and work with array becouse constructions like
Code: [Select]
while((count(Jewel1) + count(Jewel2) + count(Jewel3) + count(Jewel4) + count(Jewel5) + count(Jewel6) + count(Jewel7) + count(Jewel8) + count(Jewel9) + count(Jewel10)) > 0) this are not the thing that should be done ever...

I am a super newbie pascal user who has tackled pascal for an entire sum of perhaps 12 hours, who has never used Stealth or pascal before that.

And I've written a dozen miner routes that will likely pull in about 1 mil gold worth per ingots a day on a freeshard.

It either works, or it doesn't work. :p  My scripts are working.

BTW, my Gem set happens to be the same gems you buy from jeweler (diamonds, rubies, etc).

Feel free to post your far more elegant method of putting gems in the bank and I'll declare you king of pascal, delete my working function and replace it with your better function that does the same thing. :p

I plan to go to mountainsides as well, sounds less dangerous hehe. Keep in mind I've never mined in my life of UO it's just the easiest way I can think to make simple script and good way to learn, any advice on what spots to hit? I'm estimating you can maybe pull 4k ingots an hour?
« Last Edit: August 01, 2016, 01:20:16 AM by playforfun »

Tags: