ScriptUO

Scripting Resources & Utilities => OpenEUO Scripts => OEUO => Scripting tools => Topic started by: TrailMyx on August 19, 2010, 10:58:34 PM

Title: Trailmyx's Advanced Journal scanner for OEUO - v1.0
Post by: TrailMyx on August 19, 2010, 10:58:34 PM
Code: [Select]
---------------------------------------------------------------
-- Script Name: TrailMyx's Advanced Journal Scanner for OEUO
-- Author: TrailMyx
-- Version: v1.0
-- Shard OSI / FS: unk
-- Revision Date: 9/29/2007
-- Purpose: Collection of routines, including:
--          Use these subs to quickly find text in your journal entries.
--
-- Examples:
--     speech = TM_AdvJournalInfo:New() -- creates a new scanner object
--     heal = TM_AdvJournalInfo:New() -- creates a new scanner object
--     spellcast = TM_AdvJournalInfo:New() -- creates a new scanner object
--     speech:TM_AdvJournalSync() -- sync "speech" journal space
--     speech:TM_AdvJournalScan("VALID", false, "Find this text", "and find this too") -- will not advance copy of #jindex, applies spam checking
--     heal:TM_AdvJournalScan("VALID_ADVANCE", false, "you heal what", "that patient is not" -- advances pointer after scan, applies spam checking
--     spellcast:TM_AdvJournalScan("NONE", false, "fizzle") ; no spam checking and doesn't advance #jindex copy automatically
--
-- Special Thanks:
--
-- Beta testers:
-- Bug testers:
--
---------------------------------------------------------------
--
--  Example code
--  dofile("tm_oeuo_advjournalscan10.lua")
--  watcher = TM_AdvJournalInfo:New()
--  watcher:TM_AdvJournalSync()
--
--  while true do
--    if watcher:TM_AdvJournalScan("none", true , "hello", "test") == true then
--      print(string.format("I stopped because of the %s trigger.", watcher.match))
--      watcher:TM_AdvJournalSync()
--    end
--  end
--  Obj.Exit()
---------------------------------------------------------------

This is a direct port of my popular advanced journal handling routings from EUO.  All the features you came to know from those routines are present in this new version for OEUO.

Here's some example code to get you started.  Notice these subs look much like my EUO subs and function exactly the same as you would expect.

This example will print a message when you hit the trigger words of "hello" or "test".   Adjusting the first argument of T_AdvJournalScan to "none", "valid", "advance" or "valid_advance" will change the trigger behavior.   For example, change this to "valid" and then use another account to spam the trigger words.  Notice how it won't trigger unless it's the character running the script?  Cool, huh?  

Sample:

Code: [Select]
dofile("tm_oeuo_advjournalscan10.lua") -- required so the code below will be aware of the journal scanner.

watcher = TM_AdvJournalInfo:New()
watcher:TM_AdvJournalSync()

while true do
  if watcher:TM_AdvJournalScan("none", true , "hello", "test") == true then
    print(string.format("I stopped because of the %s trigger.", watcher.match))
    watcher:TM_AdvJournalSync()
  end
end
Obj.Exit()

Note!

Notice I've added a new feature <object>.match where you can see what actually triggered the matching condition.  From the above example:

Code: [Select]
  print(string.format("I stopped because of the %s trigger.", watcher.match))
Title: Re: Trailmyx's Advanced Journal scanner for OEUO - v1.0
Post by: TrailMyx on August 19, 2010, 11:00:11 PM
reserved
Title: Re: Trailmyx's Advanced Journal scanner for OEUO - v1.0
Post by: Superslayer on November 09, 2010, 05:38:12 PM
This is nice so far. I do notice that the trigger words are case sensitive, and compound sentence fragments do NOT require an underscore to extend the phrase. Very nice!
Title: Re: Trailmyx's Advanced Journal scanner for OEUO - v1.0
Post by: smokinjoe26 on February 22, 2012, 09:40:02 AM
This is nice so far. I do notice that the trigger words are case sensitive, and compound sentence fragments do NOT require an underscore to extend the phrase. Very nice!

Correct me if i am wrong, but I think that the second (boolean) option changes case sensitivity. 
Title: Re: Trailmyx's Advanced Journal scanner for OEUO - v1.0
Post by: TrailMyx on February 22, 2012, 09:46:47 AM
You are correct.  That's the idea anyhow.  ;)