Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

about Journal Scan

Only for requests.
Post Reply
TheEnd
Neophyte
Neophyte
Posts: 23
Joined: 20.11.2012 11:20
Contact:

about Journal Scan

Post by TheEnd »

Code: Select all

Program New;
var
  t : integer;
  sTime: TDateTime;

function Scan():Integer;
begin
  //AddToSystemJournal(TimeToStr(Now));
  if (Now > sTime + 1.0/(24*60*3)) then
  begin
      t := 0;
      sTime := Now;
  end;
  if InJournal('APM') <> -1 then  // the Guild's Name
  begin
    inc(t);
    ClearJournal();
    UOSay('\'the Guild Player ' + IntToStr(t) + 'Counts.');
    //AddToSystemJournal(TimeToStr(Now));
  end; 
end;

function autoConnect():Integer;
begin
  while not Connected() do 
  begin
    if not Connected() then
    begin
      Connect();
      Wait(10000);
      Continue;
    end;
  end;
end;

begin
  t := 0;
  sTime := Now;
  autoConnect;
  while Connected() do
  begin
    autoConnect;
    scan();
  end;
end.
my purpose: Scan Journal to get the Player's info : Name and Guild Name, Red, gray, blue, and the Player Counts.
this my simple code to scan journal, then get the info.
is there any better way to improve the scripts?
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: about Journal Scan

Post by Vizit0r »

TheEnd wrote:

Code: Select all

Program New;
var
  t : integer;
  sTime: TDateTime;

function Scan():Integer;
begin
  //AddToSystemJournal(TimeToStr(Now));
  if (Now > sTime + 1.0/(24*60*3)) then
  begin
      t := 0;
      sTime := Now;
  end;
  if InJournal('APM') <> -1 then  // the Guild's Name
  begin
    inc(t);
    ClearJournal();
    UOSay('\'the Guild Player ' + IntToStr(t) + 'Counts.');
    //AddToSystemJournal(TimeToStr(Now));
  end; 
end;
Injection style, yes. + Copy-Paste from Stealth scripts. Together = awesome crazy code.

forgot Injection. ClearJournal never needed, it left for few unstandart situations. NOT for usual scripts.

Example of normal journal working.

Code: Select all

     stime := Now;
     WaitTargetObject($5EA22CAE);
     UseSkill('Arms Lore');
     repeat 
       CheckSave; 
       InJournalBetweenTimes('make|destroyed|already', stime, Now); 
       wait(100); 
     until (LineCount > 0) or (Now > stime + (1.5/1440));
     wait(10000);
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
Post Reply