Page 1 of 1

about Journal Scan

Posted: 15.12.2012 19:03
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?

Re: about Journal Scan

Posted: 15.12.2012 22:20
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);