ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: VicVega on May 18, 2009, 07:58:43 AM

Title: Scan Journal Sub 0.1 for Public Testing
Post by: VicVega on May 18, 2009, 07:58:43 AM
Code: [Select]
;=================================================================
; Script Name: Scan Journal Sub
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 18/5/2009
; Purpose: Looks for a text in the journal and returns it
; Globals: None
;=================================================================
; Instructions:
; You call the sub with the messages you want to look for.
; If it finds one of the messages you are looking for, the sub returns
; and #result variable saves the message found
; Tries to find the messages during the time marked by %maxTimeOutScan
; %maxTimeOutScan value it's 15 seconds by default
; Call example: gosub scan message1 message2 message3 ...
;************************* Sub **********************************
sub scan
  set %maxTimeOutScan 15
  set %timeout #scnt + %maxTimeOutScan
  set %jrnl #jindex
  scanjournal %jrnl

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }

    for %journalCounter 1 %0
    {
     if % . %journalCounter in #journal
       return % . %journalCounter
    }
  }
return