ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Script development tools => Topic started by: TrailMyx on June 09, 2008, 01:01:15 PM

Title: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on June 09, 2008, 01:01:15 PM
Code: [Select]
;=================================================================
; Script Name: TrailMyx's Advanced Journal Scanner
; Author: TrailMyx
; Version: 1.0
; Shard OSI / FS: OSI / FS?
; Revision Date: 10/20/2007
; Purpose:
;   Use these subs to quickly find text in your #journal entries.  These subs
; use #jindex for flawless journal scanning and is much more reliable than using
; standard indexing of #journal and #SYSMSG.
;
;   Now it is possible to manage separate journals based on unrelated text.  It's now possible
; to monitor spellcasting, bandaging, stealing, or anything else without a TM_AdvJournalSync
; potentially removing text needed for another UO funciton.
;
;   New is the ability to either gosub or call these functions without the need to change the
; header!  When calling, a limit of 10 arguments is allowed, but more can be added by editing the
; call interface section.
;
;  Examples:
;     gosub TM_AdvJournalSync speech 100 ; sync "speech" journal space, set #LPC to 100 from default of 1000
;     gosub TM_AdvJournalScan speech VALID Find_this_text and_find_this_too ; will not advance copy of #jindex
;     gosub TM_AdvJournalScan heal VALID_ADVANCE you_heal_what that_patient_is_not ; advances pointer after scan
;     gosub TM_AdvJournalScan spellcast NONE fizzle ; no spam checking and doesn't advance #jindex copy automatically
;
;  Subs included:
;     TM_AdvJournalSync - Must call this in initialzation
;     TM_AdvJournalScan - see header for details....
;
;  Release history:
;    v1.0 - Initial release.
;
;  Requirements:
;    Nothing special
;
;  Credit:
;    If you use these subs, please leave credit for me somewhere in your script header.
;=================================================================

... Snipped from another thread...

By this example:

Code: [Select]
gosub TM_AdvJournalScan heal VALID_ADVANCE you_heal_what that_patient_is_not

The first argument "heal" what you are calling this particular journal scanner.  Since you can have different scanners looking for different things and behaving differently, then you can set this.  An example of multiple journal scanners is perhaps you are looking for journal information that's spell casting related, but another part of your script is looking for journal output that's healing related.  Now you can separate these.

The second argument can be the following values:

NONE: defaults to basic journal scan (no SPAM checking, no #jindex pointer copy advancing)
ADVANCE: no spam checking, advances #jindex copy
VALID: invokes SPAM filtering, no advance of #jindex copy
VALID_ADVANCE, VALIDADVANCE, ADVANCE_VALID, etc.: invokes SPAM filtering, advances of #jindex copy

arguments after the first and the second are considered strings you will be searching for to appear in your journal.

About SPAM filtering:

With the NONE option, the script will not filter the journal and will agree with any resulting match with the list your supply as arguments.  

With the VALID option, the script will compare several criterion to the text found within your journal.  These criteria are:
(Joe_Spammer is a fictional grief player trying to mess with your script)

1) Journal entry does not contain ":_" i.e. "Joe_Spammer:_you_heal_what" <will not trigger>
2) Journal entry does contain ":_", but is the first text <this will pass, example boat commands, taming>
3) Journal entry does contain "Your_Charname:_you_heal_what..." <this will pass, since YOU said it.>
4) Journal entry does contain "Joe_Spammer:_Your_Charname:_you_heal_what" <this will not pass because your character name did not come first>

Note there are combinations of the above examples, and may require you to play with it a bit.

With the ADVANCE option, the script will automatically sync the jindex copy when you do a search.  There are times however when you might want to search the same journal information again for another trigger word, so you can sync by hand by:

Code: [Select]
gosub TM_AdvJournalScan heal VALID you_heal_what that_patient_is_not
if #RESULT = #TRUE
{
  gosub TM_AdvJournalSync heal
  .. do something about it..
}

Finally, you notice that most of my scripts will call TM_AdvJournalSync at the beginning of the script execution for each journal scanner, but will include a number for the second argument:

Code: [Select]
 gosub TM_AdvJournalSync heal 100
  gosub TM_AdvJournalSync CastSpell 100

This is just setting the default #LPC for each scanner.  If you have time-critical needs, you may invoke faster scanning for subsequent TM_AdvJournalScan calls.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: rana70 on August 04, 2008, 11:00:57 AM
Hi TM,

I look for a howto for your TrailMyx's Advanced Journal Scanner SUB.

I am not really sure how to use it ....
My Basic problems are ....
- What does this 1st Parameter mean ? Journal Name
- What exactly does the Sync do

I use a pathfind command and I would like to monitor the journal
to catch a "can't_get_there" Msg from the journal and
somehow I was to stupid to figure it out on my own

So I looked around on EUO and here but without to much luck as you can see

Thx
 
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 04, 2008, 11:52:03 AM
Hum, yeh, there's a bit of tribal knowledge there.  I need to impart it somehow.  I don't have time this afternoon, but perhaps I can whip up a little how-to this evening.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: rana70 on August 04, 2008, 11:56:40 AM
Would be great ....

I will wait for it np

thx
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 04, 2008, 08:25:20 PM
Ok, so I don't have a lot of time this evening, but I said I'd give some information.  So hopefully this will help a bit.

By this example:

Code: [Select]
gosub TM_AdvJournalScan heal VALID_ADVANCE you_heal_what that_patient_is_not

The first argument "heal" what you are calling this particular journal scanner.  Since you can have different scanners looking for different things and behaving differently, then you can set this.  An example of multiple journal scanners is perhaps you are looking for journal information that's spell casting related, but another part of your script is looking for journal output that's healing related.  Now you can separate these.

The second argument can be the following values:

NONE: defaults to basic journal scan (no SPAM checking, no #jindex pointer copy advancing)
ADVANCE: no spam checking, advances #jindex copy
VALID: invokes SPAM filtering, no advance of #jindex copy
VALID_ADVANCE, VALIDADVANCE, ADVANCE_VALID, etc.: invokes SPAM filtering, advances of #jindex copy

arguments after the first and the second are considered strings you will be searching for to appear in your journal.

About SPAM filtering:

With the NONE option, the script will not filter the journal and will agree with any resulting match with the list your supply as arguments. 

With the VALID option, the script will compare several criterion to the text found within your journal.  These criteria are:
(Joe_Spammer is a fictional grief player trying to mess with your script)

1) Journal entry does not contain ":_" i.e. "Joe_Spammer:_you_heal_what" <will not trigger>
2) Journal entry does contain ":_", but is the first text <this will pass, example boat commands, taming>
3) Journal entry does contain "Your_Charname:_you_heal_what..." <this will pass, since YOU said it.>
4) Journal entry does contain "Joe_Spammer:_Your_Charname:_you_heal_what" <this will not pass because your character name did not come first>

Note there are combinations of the above examples, and may require you to play with it a bit.

With the ADVANCE option, the script will automatically sync the jindex copy when you do a search.  There are times however when you might want to search the same journal information again for another trigger word, so you can sync by hand by:

Code: [Select]
gosub TM_AdvJournalScan heal VALID you_heal_what that_patient_is_not
if #RESULT = #TRUE
{
  gosub TM_AdvJournalSync heal
  .. do something about it..
}

Finally, you notice that most of my scripts will call TM_AdvJournalSync at the beginning of the script execution for each journal scanner, but will include a number for the second argument:

Code: [Select]
  gosub TM_AdvJournalSync heal 100
  gosub TM_AdvJournalSync CastSpell 100

This is just setting the default #LPC for each scanner.  If you have time-critical needs, you may invoke faster scanning for subsequent TM_AdvJournalScan calls.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 04, 2008, 08:53:56 PM
Oh, and BTW, there have been several times when I thought I found a bug in these, only to find out I had misspelled my trigger works, or was improperly using the VALID option.  What's saved me is a bit of test code, and having a second account to "spam" my script to see if it triggers.  So if you are having problems, start small and use the debugger closely.  I always grumble with I misspell something.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: 12TimesOver on August 05, 2008, 03:13:25 AM
For not having much time this is a tremendous help for me too! You should consider moving this to the Journal Scanning thread, perhaps as part of the initial post so it isn't overlooked. For some reason I have always had difficulty grasping the concept of the "journal name" or the first argument and what it is used for and these subs have already made their way into any script I've needed journal scanning for.

XII
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Xclio on August 05, 2008, 05:29:43 AM
I've been wanting to use these in my tamer for a while but I haven't ever managed to get them straight in my head yet, so hopefully I can use this and make it work :)
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 05, 2008, 07:46:43 AM
These work really well for tamer scripts.  I remember one time I was out "messing" with an obvious scripter.  I would run up and say "you have no chance" and he would keep wandering around.  Eventually I got him over to the Juka without taming a single thing.  The Juka took care of the rest.  ;)  If he would have used this scanner, then I would have been foiled, tipped my scripter's hat and moved on to find my next crappy scripter victim.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Xclio on August 05, 2008, 09:28:52 AM
Yeah that is the exact reason i want to use it in my tamer script so that it can prevent stuff like that :)
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Khameleon on August 05, 2008, 07:51:26 PM
lol.. I thought I was the only one that liked to play tricks on Scripters....
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 05, 2008, 08:23:07 PM
lol.. I thought I was the only one that liked to play tricks on Scripters....

Oh no, I love f*cking with scripters!!  It's a community service to help them to learn to script better.  hehe
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Xclio on August 06, 2008, 05:15:40 AM
Screwing with people that are scripting is hilarious!  I think TM and I have a similar philosophy.  If I can know you are scripting and I can break your script then it needs improvement ;)
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 06, 2008, 10:14:15 AM
Some scripters out there kinda get their panties in a bunch when you hear of one scripter messing with another.  It's like we have a code of honor or something.  I'm no thief. My code only includes respect of a good scripter.  When I determine that a person is running a quality script, I will just leave them be. 
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Khameleon on August 08, 2008, 03:52:31 PM
my Favorite was/is Killing 8x8'er on there own boat.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 20, 2008, 12:17:39 AM
For not having much time this is a tremendous help for me too! You should consider moving this to the Journal Scanning thread, perhaps as part of the initial post so it isn't overlooked. For some reason I have always had difficulty grasping the concept of the "journal name" or the first argument and what it is used for and these subs have already made their way into any script I've needed journal scanning for.

XII

BTW, I did move this to the journal scanner thread.  Good suggestion.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Pearls on August 20, 2008, 01:41:51 AM
When i didnt know much about easyuo and was a contra scripter, i used to lumberjack a lot manually. There was one guy farming all the frostwood trees i had. At first i basically just killed him and took over. After a while i smartened up, marked all the spots he recalls into, dropped a few logs there, and he would basically chop for me and drop all the frostwood to the floor. I only had to go and pick it up.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 20, 2008, 10:22:51 AM
What did you say to get him to drop?
Title: Re: TrailMyx's Advanced Journal Handler
Post by: rana70 on August 22, 2008, 11:21:10 AM
Just runnin UOA with the stack option on would be enough
the char will drop the wood as soon as uoa finds some wood on the ground
Title: Re: TrailMyx's Advanced Journal Handler
Post by: KilroyIsDead on June 27, 2009, 12:33:57 PM
This may have been previously noted, but

If the journal gets substantially bigger since the last time you called it.  You can get unpredictable results.

example:
I use the scanner when I recall, then I mine the spot and teh digging spams the journal, then the next time I recall it has to wade through all that journalling, So now I sync the journal before I recall moreover care to scan the journal
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on June 27, 2009, 01:07:40 PM
You need to be proactive when using the journal and using the Sync function.  Best thing is to resync before you cause an action that might cause a journal entry.  Most things you do can function this way.  That way your journal scans will remain small. Example:

Sync
last last object
last target
Check journal

With my subs, you can monitor "%10" to make sure you don't have a problem with a run-away journal scan.  Under control, you should have a relatively small number in this.  This variable also has the particular journal tag in question just in case you might now know what journal scanner is "bugged".  

Some might not know the debugging value of the "%10" variable, so there you go!

But yes, that's good information for people who might have problems with journal scanning, KilroyIsDead.  Thanks for that!
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Paulonius on February 11, 2010, 08:08:05 AM
So I have been reading this and trying to figure out how to use the subs to replace the crap journal scanning I have been doing.  Maybe its because I don't get to sleep anymore, but I thought that the following should work and it doesn't.  Can anyone tell me what I am doing wrong with it?

I wrote this as a test script to teach myself how to use TM's Journal subs. It is supposed to fire up, initiate the subs, drop into a loop that says "Test Message", check the journal for Test_Message, and then drop out of the loop and report "SUCCESS!!"... but it doesn't...


Code: [Select]
gosub TM_AdvJournalSync Testor 100
gosub TM_AdvJournalSync Testor

REPEAT
event macro 1 0 Test Message
wait 30
gosub TM_AdvJournalScan Testor ADVANCE Test_Message
wait 20
UNTIL #Result = True
Display SUCCESS!!!!
halt
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on February 11, 2010, 09:49:49 AM
"True" must mean something else in your universe.  ;)

Try #TRUE.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Paulonius on February 11, 2010, 10:00:52 AM
I am just tired I think.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on February 11, 2010, 10:07:06 AM
I am just tired I think.

Heh, sometimes it's the simple things that can be hard.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Paulonius on February 11, 2010, 11:09:39 AM
TM,

Couple of questions as I work through introducing the sub into a script.

1. I am guessing that when you put in multiple items to search for they are searched for in the alternative as in A || B . Is this correct?  Is there a limit on the number you can use? (I am hoping its three or more...)

2. Where I am using consecutive checks as in a loop, I am presuming that I don't want to ADVANCE until I am finished with the loop. I am thinking something like this:

Code: [Select]
gosub TM_AdvJournalSync
Repeat
      {
      Code that Does what I need done and produces a journal entry
      gosub TM_AdvJournalScan NAME NONE JOURNAL_TEXT_SOUGHT
      }
Until #Result = #True

 3. Will the Sync will take the place of the advance the next time it enters this loop?

Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on February 11, 2010, 11:46:38 AM
Yes, if you have multiple arguments searched for in each TM_AdvJournalSync, then they act as *OR*.

If you don't use the automatic "ADVANCE" function, then you have to sync by hand:

Code: [Select]
gosub TM_AdvJournalSync NAME 100
Repeat
      gosub TM_AdvJournalScan NAME NONE JOURNAL_TEXT_SOUGHT
      if #RESULT = #TRUE
      {
         ; handle JOURNAL_TEXT_SOUGHT
         gosub TM_AdvJournalSync NAME
      }
      gosub TM_AdvJournalScan NAME NONE SOMETHING_ELSE
      if #RESULT = #TRUE
      {
         ; handle SOMETHING_ELSE
         gosub TM_AdvJournalSync NAME
      }
Until #FALSE

Now it's up to your code to determine if you need to keep searching without SYNCing.  If you have things you want to search for, but are different types of searches, you can create another journal scanner:

Code: [Select]
gosub TM_AdvJournalSync SCANNER1 100
gosub TM_AdvJournalSync SCANNER2 100 
Repeat
      gosub TM_AdvJournalScan SCANNER1 NONE JOURNAL_TEXT_SOUGHT
      if #RESULT = #TRUE
      {
         ; handle JOURNAL_TEXT_SOUGHT
         gosub TM_AdvJournalSync SCANNER1
      }
      gosub TM_AdvJournalScan SCANNER2 NONE SOMETHING_ELSE
      if #RESULT = #TRUE
      {
         ; handle SOMETHING_ELSE
         gosub TM_AdvJournalSync SCANNER2
      }
Until #FALSE

This way, you will not sync and possibily miss something from the other scanner.  A good example is if you are looking for journal entries pertaining to HEALING and other entries for SPELLCASTING, or FISHING.  You don't want one sync to make you miss other entries.  With my advanced journal scanner, I give you n-number of possible scanners.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Scrripty on February 12, 2010, 02:18:31 PM
I *highly* suggest going to easyuo and following their very basic journal scanning tutorial to get a firm grasp on the very basics of how it works, so you fully understand better how this works. :)  It's a HUGE help guys.  I even made a post here somewhere to read up on... the link below has my interpretation of the basic journal tutorial on easyuo.

http://www.scriptuo.com/index.php?topic=4001.0;highlight=journal+scanning
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Katu on April 05, 2010, 12:06:49 PM
Hello,
I Use your this and i love it. However, i had to mod it just a little bit. I think the mod is very handy and has lots of uses. When you use VALID, it checks if your char said it. I modded it so, that you give a name for the sub. I changed so that %3 is !charname.
This way you can wait for text sayd by someone else and be 100% sure its that character saying it. In situations, where multiple characters can issue commands for script, but you want to restrict it to just to those, who you know.

I changed THIS:
Code: [Select]
  set !first_arg 3
To THIS:
Code: [Select]
  ;Katu ADD
  if VALID in !args
  {
     set !charname %3
     set !first_arg 4
  }
  else
      set !first_arg 3
And now, if using VALID arg, you call sub like this:
Code: [Select]
gosub TM_AdvJournalScan network VALID_ADVANCE Friend_Char_Name You_are_invited_to_join_the_party.

Im not saying that you should change this, im just pointing out the possibilities :)

-Katu

PS: I always modify other ppl code to suit my needs, but i always give em credit.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on April 05, 2010, 12:51:59 PM
Well that's what the code is there for.  Tools to help you do your thing, but generally generic code doesn't do EXACTLY what you might want.  For your bot-code, that makes much sense.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Katu on April 05, 2010, 01:15:52 PM
Aye, i really needed that kind of mod. After that i started to work on other mod..
Ever wanted to pick variables from the text?
If someone says you my ID:JFHGUFK and my TARGET:JNGYRD my HP:83.
I modded your scanner to pick these up :)

Title: Re: TrailMyx's Advanced Journal Handler
Post by: JackCiaran on April 06, 2010, 06:49:41 PM
I understand this very well but something I haven't picked up on yet is "#LPC"
im guessing its like lines per count? and the smaller the number following it means smaller search range for more accuracy search time? I hate guessing at things that might be obvious but Id really like someone to let me know for sure =)
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Scrripty on April 06, 2010, 07:06:19 PM
I understand this very well but something I haven't picked up on yet is "#LPC"
im guessing its like lines per count? and the smaller the number following it means smaller search range for more accuracy search time? I hate guessing at things that might be obvious but Id really like someone to let me know for sure =)

#LPC is lines per cycle.  Goto easyuo.com to read up on it.  It's more of an advanced topic imo that needs some reading.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: JackCiaran on April 06, 2010, 07:15:59 PM
wow i just read it over there and its alot easier to understand but putting it to use in other situations is probably harder than this journal scanner but again ty Twinkle McNugget!
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Scrripty on April 06, 2010, 08:51:14 PM
wow i just read it over there and its alot easier to understand but putting it to use in other situations is probably harder than this journal scanner but again ty Twinkle McNugget!

Mainly what you're going to use it for is cranking up the #LPC when you're doing cpu intensive things.  And also lowering the cpu usage when you're doing things that dont require a ton of cpu time.  Like in a non critical loop or repeat, you can set the #lpc very low so it's not taking up tons of cpu cycles.  There's also times you CANT crank it up or it will mess with certain functions.  That's why I say it's kind of an advanced topic.  It's not hard to understand tho. 
Title: Re: TrailMyx's Advanced Journal Handler
Post by: baldielocks on July 22, 2010, 04:34:11 PM
I put the new scanner in my Sliem quester, and checked it in SUO. Sohuld I be concerne with this?
Code: [Select]
Method count: 56
Command count: 56
*** Pass 1 - Label accounting:
*** Warning - GOSUB %1 - Line 220 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 222 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 224 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 226 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 228 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 230 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 232 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 234 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 236 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 238 has no matching SUBroutine
*** Warning - GOSUB %1 - Line 240 has no matching SUBroutine
Subroutine labels = 5
Tag labels = 2
18 Code block(s).
11 Warnings(s) encountered.
*** Pass 2 - Execution [SYNTAXCHECK]
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Paulonius on July 22, 2010, 04:35:52 PM
Probably not an issue. Most of TM's subs have multiple functions and will error like that if there is something you are not using.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Cerveza on April 25, 2011, 05:28:28 PM
Why does "You must wait" work with this but "too far away" not?

    gosub TM_AdvJournalScan LORE VALID too_far_away You_must_wait
    if #result = #true
    {
      set %skipit TRUE
      return
    }

I tried

    gosub TM_AdvJournalScan LORE NULL too_far_away You_must_wait
    if #result = #true
    {
      set %skipit TRUE
      return
    }

Also, still didn't work.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Cerveza on April 25, 2011, 05:31:03 PM
It's gotta be the targetting... lemme put a wait in.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Neo on August 16, 2011, 03:54:07 PM
I've used this for the first time in the Ter Mur lumber I wrote, and I must say, I love this!

Thank you very much for sharing!
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 16, 2011, 04:01:56 PM
I've used this for the first time in the Ter Mur lumber I wrote, and I must say, I love this!

Thank you very much for sharing!

Once you get the gist of how these work, they can really simplify your journal scanning world.  Especially when you are scanning for two or more completely unrelated things.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: OMGBurgers on January 11, 2012, 07:00:13 PM
if i do a scan for VALID_ADVANCE for multiple arguments, is there any variable returned that says which one it found?  i was thinking that would make it real easy to throw in like 8 arguments, then afterwards by the result could do a number of different things by which one it found without having to do like 4 calls.  right now im doin this...

Code: [Select]
      gosub TM_AdvJournalScan fish VALID_ADVANCE You_pull_out Your_fishing_pole_bends_as_you You_fish_a_while,_but_fail Your_fishing_pole_nearly_breaks! You_struggle_and_fight_to_pull
      if #result = #true
         return CONTINUE
      gosub TM_AdvJournalScan fish VALID_ADVANCE The_fish_don't_seem_to_be_biting
      if #result = #true
         return MOVE

but i was thinking i could do:
Code: [Select]
      gosub TM_AdvJournalScan fish VALID_ADVANCE You_pull_out Your_fishing_pole_bends_as_you You_fish_a_while,_but_fail Your_fishing_pole_nearly_breaks! You_struggle_and_fight_to_pull The_fish_don't_seem_to_be_biting
      if #result in You_pull_out_Your_fishing_pole_bends_as_you_You_fish_a_while,_but_fail_Your_fishing_pole_nearly_breaks!_You_struggle_and_fight_to_pull
         return CONTINUE
      if #result = The_fish_don't_seem_to_be_biting
         return MOVE

that way i dont need to call it multiple times.

does that make any sense?  or would it really not matter much?  i dont know if you read my other post but im just brainstorming ways to try to make things faster by reducing all the high LPC calling subs/functions/scripts.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 11, 2012, 07:10:54 PM
Funny you should ask.  I have a set of these I never published.  Lemme try and find them.  It'll return the "trigger" of the match.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 11, 2012, 07:27:20 PM
Ok, I pieced together the trigger stuff.  Check out version 1.2.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: OMGBurgers on January 11, 2012, 07:30:19 PM
wow awesome!  cant wait to try it out :)  the freeshard i play has been down for hours today for a new patch...  but i'll mess around with it tomorrow. thanks a bunch!
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 11, 2012, 07:34:29 PM
I never had an actual release, but in my beetlejacker I had layed the ground work for that feature so it was easy to pull together.  Hope you can find some use for it; I don't believe I've tested it so I'd appreciate your feedback - good or bad.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: OMGBurgers on January 12, 2012, 01:55:31 PM
Perfect :)

I was able to compile all my triggers into the one gosub for that script.  I did modify it though because I forgot there's a few parts of the script that do time tracking based on journal text.  So what I did was copied the TM_AdvJournalGetTrigger, and renamed it TM_AdvJournalGetJournalTrigger, and just had it return the actual journal text.  I also edited the TM_AdvJournalScan sub to store !journaltrigger for returning of the added sub.  That way if it was one of the few triggers that needed to get the exact time out of the journal, or odd text that i can't include in the trigger, i could grab it quickly and easily.

Can't wait to add this into the other scripts.  I think it'll help them out, along with make them simplier because this really simplified the journal handling of the script.

Thank you!
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 12, 2012, 02:34:37 PM
Beautiful, glad that was helpful.  It's amazing how daunting journal scanning can be until you get some good subs to work with.  I look back at my old code and shake my head at all the times in the same script I have the same basic lame code.  Yuck.

Anyhow, I have another version where I do the same thing you are talking about, but I store them in just a %var so it's visible in all namespaces and can be used for diagnostic purposes.  I should add that to the release soon, no?  :)
Title: Re: TrailMyx's Advanced Journal Handler
Post by: The Ghost on July 10, 2013, 09:41:23 PM
Hi TM
 Trying to use ur journal and just wondering if this is correct.   It seen like the journal is not working properly and not sure if I set ur variable correctly. 
Code: [Select]
sub setup
gosub TM_AdvJournalSync snake 100
retrun

 gosub TM_AdvJournalScan snake VALID You_don't_seem_to_be_able_to_persuade_that_to_move.
   if #RESULT = #TRUE
   {
   return UseFlute
   }
  gosub TM_AdvJournalScan snake VALID The_animal_walks_where_it_was_instructed_to.
  if #RESULT = #TRUE
   {
   ignoreitem %snake
   wait 5s
   return UseFlute
   }
  gosub TM_AdvJournalScan snake VALID the_nest_collapses
  if #RESULT = #TRUE
   {
   gosub ignore
   return targethole
   }

sub ignore
  deletejournal
  ignoreitem reset
return
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on July 10, 2013, 11:25:18 PM
you should probably not use "deletejournal" since the subs will take care of that for you.

Also, when you get a "hit" on a journal scan, you need to "sync" so that you won't re-trigger on a journal event.  Under normal circumstances, you could use the VALID_ADVANCE flags, but the way you are using the subs, you probably should call "gosub TM_AdvJournalSync snake" when you have a valid "hit".  So perhaps you will have something like this (NOT TESTED!!!)

Code: [Select]
sub setup
gosub TM_AdvJournalSync snake 100
return  ; note the mispelling.....

 gosub TM_AdvJournalScan snake VALID You_don't_seem_to_be_able_to_persuade_that_to_move.
   if #RESULT = #TRUE
   {
   gosub TM_AdvJournalSync snake
   return UseFlute
   }
  gosub TM_AdvJournalScan snake VALID The_animal_walks_where_it_was_instructed_to.
  if #RESULT = #TRUE
   {
   gosub TM_AdvJournalSync snake
   ignoreitem %snake
   wait 5s
   return UseFlute
   }
  gosub TM_AdvJournalScan snake VALID the_nest_collapses
  if #RESULT = #TRUE
   {
   gosub TM_AdvJournalSync snake
   gosub ignore
   return targethole
   }

sub ignore
;  deletejournal  ; nope, don't do this....
  ignoreitem reset
return

Remember that the ADVANCE modifier automatically syncs the journal pointer.  Without that, the pointer will not advance unless you explicitly "sync" the pointer to the most current place.  If you play with some test code using the VALID vs. VALID_ADVANCE or using the "gosub TM_AdvJournalSync", you can see how this works for your purposes.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: The Ghost on July 11, 2013, 03:47:40 PM
Thx.
  I did try , but didn't seen to woking properly as well.   
Code: [Select]
gosub TM_AdvJournalScan snake VALID_ADVANCE You_don't_seem_to_be_able_to_persuade_that_to_move.
   if #RESULT = #TRUE
  {
   return UseFlute
   }

I notice that few thread below,  we are able to have multiple  search line. 
 1) how do I separate them
      the_snake_searches_the_nest_and_finds_nothing
         and
   The_animal_walks_where_it_was_instructed_to.
 2) can i use only a few work or the whole sentence

Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on July 11, 2013, 04:35:03 PM
Perhaps the "VALID" flag is making it not work.  Try this:

Code: [Select]
   gosub TM_AdvJournalScan snake NONE persuade_that_to_move
   if #RESULT = #TRUE
  {
     gosub TM_AdvJournalSync snake
     return UseFlute
   }

I'd only use a snippet of the "You_don't_seem_to_be_able_to_persuade_that_to_move."  "persuade_that_to_move" will work.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: The Ghost on July 13, 2013, 05:42:38 PM
Good day TM 
It seen that I have a bit of problem and required your wisdom. The journal seen to work half time, and I'm sure it a question of located the right place for the gosub TM Adv.  the # 1 and 2 are working fine.  # 3,   I have try all 3 NONE, Valid & valid_advance  and 90%  of the time the script don't cycle.    I do have 4 to 10 lines before the  gosub TM have the time to scan.   could that be the problem.    And can you tell me if I coded correctly the sub TM to scan for two action in  1 & 2.   Thx

Code: [Select]
; 1
gosub TM_AdvJournalScan snake VALID_ADVANCE to_persuade_that_to_move it_to_recharge  ;   looking for two action here
   if #RESULT = #TRUE
   {
    gosub TM_AdvJournalSync snake
     wait 6s
   goto UseFlute
   }
; 2
  gosub TM_AdvJournalScan snake VALID_ADVANCE The_animal_walks already_taming where_it_was_instructed_to.    ;  looking for two action here
    if #RESULT = #TRUE
   {
        gosub TM_AdvJournalSync snake
   ignoreitem %snake
     wait 6s
    goto UseFlute
   }
; 3
  gosub TM_AdvJournalScan snake VALID_ADVANCE the_nest_collapses Target_cannot_be_seen
  if #RESULT = #TRUE
   {
   gosub TM_AdvJournalSync snake
    gosub ignore
   Return   ; go back to beginning to target a new hole
   }
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on July 13, 2013, 10:00:51 PM
Since you are syncing by hand, you should change all your modifiers to just VALID.  What ADVANCE does when you call the journal scan, it scans for what you have requested and AUTOMATICALLY syncs at the end of a call.  But suppose one of your other triggers (2)  happens while you are looking for the original set (1) and you sync automatically, then you'll miss them.

Question:
Are you looking for different actions here?  Looks like there's taming in there as well as other things.  It would be best to split up your actions into their own individual journal scanner.  Have snake related items in "snake" and create another scanner for other non-related searches.

Another question:
What's UseFlute and why are you using "goto"?
Title: Re: TrailMyx's Advanced Journal Handler
Post by: The Ghost on July 13, 2013, 11:04:19 PM
TM
I'm trying to scan the journal so depending on the snake reaction,  I can target a new one, target the same one or target a new hole.  By having goto within the sub it allow me to moving inside it.    Trying to upgrade my this sub  with ur journal. 
Code: [Select]
sub HuntEgg
UseFlute:
gosub TM_AdvJournalScan snake VALID_ADVANCE the_nest_collapses Target_cannot_be_seen
  if #RESULT = #TRUE
   {
   gosub TM_AdvJournalSync snake
;    pause
    gosub ignore
   Return  ;  go back to beginning to target a new hole
   }
finditem %flute C_ , #BACKPACKID ; Charmer Flute
     event property #findid
  if Charmer in #property
     set %flute #findid   ; find only charmer flute
else
    {
    ignoreitem #findid
    event macro 8 7  ; Open main pack
    wait 15
    contpos 1050 320
    goto UseFlute
    }
    set #lobjectid %flute
    event macro 17 0
;======================================================
; S Goto Target Snake
;======================================================
FindSnake:
  finditem %snakes G_10
  set #ltargetid #findid
  set #ltargetkind 1
  set %snake #findid
 ; if %snakes <> #ltargetid
  ;   event exmsg %snakes 3 30 Pick
  target
  event macro 22    ;  Last Target
;   event exmsg %snakes 3 30 Pick
  wait 5
  click %lootx %looty d
  wait 1s
   gosub TM_AdvJournalScan snake VALID_ADVANCE to_persuade_that_to_move it_to_recharge
   if #RESULT = #TRUE
   {
    gosub TM_AdvJournalSync snake
;    pause
   wait 6s
   goto UseFlute
   }
  gosub TM_AdvJournalScan snake VALID_ADVANCE The_animal_walks already_taming where_it_was_instructed_to.
  if #RESULT = #TRUE
   {
    gosub TM_AdvJournalSync snake
   ignoreitem %snake
;   pause
   wait 6s
    goto UseFlute
   }
goto UseFlute
;======================================================
; Sub Ignor snake
;======================================================
sub ignore
  ignoreitem reset  ;Reset all snake
return
;============
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on July 13, 2013, 11:29:46 PM
I would definitely start by removing the ADVANCE modifier from all your subroutine calls and see how that works.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Grandewd on August 10, 2013, 07:48:02 PM
I'm pullin my hair out...

I've successfully used your awesome TM_AdvJournalScan sub before and it always worked perfectly.  I'm currently looking for gains while training, but it wouldn't see what was clearly a journal entry.
So I decided to see what it was returning.  So I did this:

Code: [Select]
gosub TM_AdvJournalScan detect ADVANCED Detecting_Hidden
MSG #result $

It returns a 0.  What's up?
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 10, 2013, 07:59:28 PM
Do you have some more code to post?  If not, then try changing "ADVANCED" to "ADVANCE"
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Grandewd on August 11, 2013, 08:48:57 AM
Hi TM,

Sorry for not adding the script.  Here's what I'm using to see what #RESULT is when using the (always in the past, perfect) TM_AdvJournalScan

Code: [Select]
finditem IS G_5 ;friend's char type IS
if #findkind <> -1
set #lobjectid #findID
event macro 17 ;last object
wait 25
set #lobjectid UYNKSND ; friend's backpak id
Event Macro 17 0
wait 1s
gosub TM_AdvJournalScan snoop ADVANCE Snooping
wait 10
if #RESULT = #FALSE
msg #result $
if #RESULT = #TRUE
msg #result $
halt

No matter if I've gained or not, it always returns a 0.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 11, 2013, 10:05:16 AM
I'm assuming you're including the subroutines at the end of your code?  Also, what is the trigger text values you're looking for?  I see you're looking for "snooping", but what's the full text?

Finally, you should initialize the routine at the beginning of your script.  Include this line:

Code: [Select]
gosub TM_AdvJournalSync snoop 100
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Grandewd on August 11, 2013, 03:11:37 PM
I'm assuming you're including the subroutines at the end of your code?  Also, what is the trigger text values you're looking for?  I see you're looking for "snooping", but what's the full text?

Finally, you should initialize the routine at the beginning of your script.  Include this line:

Code: [Select]
gosub TM_AdvJournalSync snoop 100

Oops, forgot to do that... Txh TM   :-[
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 01:30:15 AM

I just can't get this to work

I want to add this to Raziel's BOD gathering script.

I added these two lines at the beginning of the script;

Code: easyuo
  1. gosub TM_AdvJournalSync travel 100
  2. gosub TM_AdvJournalSync bod 100


Then this in the BOD collecting subroutine;

Code: easyuo
  1. gosub TM_AdvJournalScan bod VALID_ADVANCE An_offer_may be_available
  2. if #result = #true
  3. {
  4.   namespace pop
  5.   return #true
  6. }

I want it to move on to the next !bodType if too early to get another same type of BOD.  I have it set to gather three BODs at a time currently.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 08:24:23 AM

I just can't get this to work

I want to add this to Raziel's BOD gathering script.

I added these two lines at the beginning of the script;

Code: easyuo
  1. gosub TM_AdvJournalSync travel 100
  2. gosub TM_AdvJournalSync bod 100


Then this in the BOD collecting subroutine;

Code: easyuo
  1. gosub TM_AdvJournalScan bod VALID_ADVANCE An_offer_may be_available
  2. if #result = #true
  3. {
  4.   namespace pop
  5.   return #true
  6. }

I want it to move on to the next !bodType if too early to get another same type of BOD.  I have it set to gather three BODs at a time currently.

Instead of "VALID_ADVANCE" just try "ADVANCE"
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 09:48:21 AM

I just can't get this to work

I want to add this to Raziel's BOD gathering script.

I added these two lines at the beginning of the script;

Code: easyuo
  1. gosub TM_AdvJournalSync travel 100
  2. gosub TM_AdvJournalSync bod 100


Then this in the BOD collecting subroutine;

Code: easyuo
  1. gosub TM_AdvJournalScan bod VALID_ADVANCE An_offer_may be_available
  2. if #result = #true
  3. {
  4.   namespace pop
  5.   return #true
  6. }

I want it to move on to the next !bodType if too early to get another same type of BOD.  I have it set to gather three BODs at a time currently.

Instead of "VALID_ADVANCE" just try "ADVANCE"

Thanks for the quick response TM unfortunately it still doesn't return #true.

Just FYI, the old style scanJournal 1/2 isn't working either.  The NPC speaks these words and they are definitely in the journal.  I'm baffled.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 10:03:18 AM
This is the original code;

Code: easyuo
  1. sub bod
  2. namespace push
  3. namespace local bod
  4. set !NPC %1
  5. BOD:
  6. finditem !npc
  7. if #findkind = -1
  8. {
  9.         namespace pop
  10.         return #false
  11. }
  12. gosub useVendor !npc %option
  13. if ! #result
  14. {
  15.         namespace pop
  16.         return #false
  17. }
  18. set !timeOut #scnt + 30
  19. _acceptBodLoop:
  20. scanjournal 1
  21. if an_offer_may in #journal
  22.         {
  23.         deletejournal
  24.         wait 60s
  25.         goto BOD
  26.         }
  27. if #scnt > !timeOut
  28.         goto BOD
  29. if #contname <> generic_gump
  30.         goto _acceptBodLoop
  31. str pos #contsize _
  32. str del #contsize 1 #strres
  33. set !y 20 + #strres
  34. _bodRetry:
  35. click 165 !y
  36. wait 10
  37. if #contname = generic_gump
  38.         goto _bodRetry
  39. namespace pop
  40. return #true


This is my modified subroutine;

Code: easyuo
  1. sub bod
  2. namespace push
  3. namespace local bod
  4. set %bodCount 0
  5. set !NPC %1
  6. BOD:
  7. finditem !npc
  8. if #findCnt = 0
  9. {
  10.         namespace pop
  11.         return #false
  12. }
  13. gosub useVendor !npc %option
  14. if ! #result
  15. {
  16.         namespace pop
  17.         return #false
  18. }
  19. set !timeOut #scnt + 30
  20. _acceptBodLoop:
  21. gosub TM_AdvJournalScan bod ADVANCE An_offer_may be_available
  22. if #result = #true
  23. {
  24.   namespace pop
  25.   return #true
  26. }
  27. if #scnt > !timeOut
  28.         goto BOD
  29. if #contname <> generic_gump
  30.         goto _acceptBodLoop
  31. str pos #contsize _
  32. str del #contsize 1 #strres
  33. set !y 20 + #strres
  34. _bodRetry:
  35. click 165 !y
  36. wait 10
  37. if #contname = generic_gump
  38.         goto _bodRetry
  39. set %bodCount %bodCount + 1
  40. scanjournal 2
  41. if %bodCount < 3 && an_offer_may notin #journal
  42.   goto BOD
  43. namespace pop
  44. return #true


This also doesn't work;

Code: easyuo
  1. sub bod
  2. namespace push
  3. namespace local bod
  4. set %bodCount 0
  5. set !NPC %1
  6. BOD:
  7. finditem !npc
  8. if #findCnt = 0
  9. {
  10.         namespace pop
  11.         return #false
  12. }
  13. gosub useVendor !npc %option
  14. if ! #result
  15. {
  16.         namespace pop
  17.         return #false
  18. }
  19. set !timeOut #scnt + 30
  20. _acceptBodLoop:
  21. set %jrnl #jindex
  22. while #true
  23. {
  24.   if #jindex > %jrnl
  25.   {
  26.     set %jrnl %jrnl + 1
  27.     scanjournal %jrnl
  28.     if An_offer_may in #journal
  29.     {
  30.       namespace pop
  31.       return #true
  32.     }
  33.   }
  34. }
  35. if #scnt > !timeOut
  36.         goto BOD
  37. if #contname <> generic_gump
  38.         goto _acceptBodLoop
  39. str pos #contsize _
  40. str del #contsize 1 #strres
  41. set !y 20 + #strres
  42. _bodRetry:
  43. click 165 !y
  44. wait 10
  45. if #contname = generic_gump
  46.         goto _bodRetry
  47. set %bodCount %bodCount + 1
  48. scanjournal 2
  49. if %bodCount < 3 && an_offer_may notin #journal
  50.   goto BOD
  51. namespace pop
  52. return #true
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 11:52:53 AM
Obvious question....  Have you tacked the two subs of mine to the end of your code somewhere?
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 11:55:54 AM
Obvious question....  Have you tacked the two subs of mine to the end of your code somewhere?

Yep

Hehe.  I know.  You had to ask. 
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 11:56:40 AM
And I downloaded them fresh too. 
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 11:57:57 AM
Yep

Hehe.  I know.  You had to ask.

Heh, yes.  One never knows.

You'll probably need to put a "pause" somewhere and start single stepping through the code and investigate what's in #JOURNAL as you loop through your code.  Something is odd just not sure where.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:05:27 PM
Did you mean for this:
Code: easyuo
  1. gosub TM_AdvJournalScan bod ADVANCE An_offer_may be_available
  2.  

to be 2 entires?  An_off_may and be_available

Did you mean:
Code: easyuo
  1. gosub TM_AdvJournalScan bod ADVANCE An_offer_may_be_available
  2.  
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:06:31 PM
Did you mean for this:
Code: easyuo
  1. gosub TM_AdvJournalScan bod ADVANCE An_offer_may be_available
  2.  

to be 2 entires?  An_off_may and be_available

Did you mean:
Code: easyuo
  1. gosub TM_AdvJournalScan bod ADVANCE An_offer_may_be_available
  2.  
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:07:23 PM
Did you mean for this:
Code: easyuo
  1. gosub TM_AdvJournalScan bod ADVANCE An_offer_may be_available
  2.  

to be 2 entires?  An_off_may and be_available

Did you mean:
Code: easyuo
  1. gosub TM_AdvJournalScan bod ADVANCE An_offer_may_be_available
  2.  

I've tried it both ways.  As all one statement or as two and also as just An_offer_may by itself
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:08:35 PM
Yeah I've been doing that since last night and all morning.   Here's what I've got so far.

Code: easyuo
  1. AdvJournalScan_loop1:
  2.     str pos !charname #SPC
  3.     if #STRRES <> 0
  4.     {
  5.       set !val #STRRES - 1
  6.       str left !charname !val
  7.       set !left #STRRES
  8.       set !val !val + 1
  9.       str del !charname 1 !val
  10.       set !charname !left , _ , #STRRES
  11.       goto AdvJournalScan_loop1
  12.     }
  13.   }
  14.   set !index !first_arg
  15.   repeat
  16.     set !temp_jindex !_jindex
  17.     set !text % . !index
  18.     while !temp_jindex <= !sampled_jindex
  19.     {
  20.       scanjournal !temp_jindex
  21.       str pos #JOURNAL !charname 1
  22.       set !namepos #STRRES
  23.       str count #JOURNAL !charname
  24.       set !namecnt #STRRES
  25.       str pos #JOURNAL :_ 1
  26.       set !smcpos #STRRES
  27.       str pos #JOURNAL !text 1
  28.       set !textpos #STRRES
  29.       if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
  30.         set !pass #TRUE
  31.       else
  32.         set !pass #FALSE
  33.       if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
  34.       {
  35.         set !temp_jindex !temp_jindex + 1
  36.         if ADVANCE in !args
  37.           set !_jindex !temp_jindex
  38.         set !trigger !text
  39.         set #LPC !temp_lpc
  40.         namespace pop
  41.         set !TM_FunctionCalled #TRUE
  42.         return #TRUE
  43.       }
  44.       set !temp_jindex !temp_jindex + 1
  45.     }
  46.     set !index !index + 1
  47.   until !index - !first_arg > !num_args - !first_arg
  48.   set %10 !sampled_jindex - !_jindex
  49.   set %10 %1 , _ , %10 ; for debugging purposes
  50.   set #LPC !temp_lpc
  51.   set TM_AdvJournalGetTrigger #FALSE
  52.   namespace pop
  53.   set !TM_FunctionCalled #TRUE
  54. return #FALSE

It loops thru lines 18 - 47 numerous times.  I noticed that it never executes line 37 after the "if ADVANCE".  It should shouldn't it?  I have that in the !args
Then it eventually returns and when it gets to what is line 22 of my modified subroutine, it doesn't execute it.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:11:05 PM
Are you seeing the value of #JOURNAL change as it loops?
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:13:19 PM
I've watched it some.

But no not that I've noticed.  I'll go thru it and pay close attention to it.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:14:28 PM
I've watched it some.

But no not that I've noticed.  I'll go thru it and pay close attention to it.

I ask because I see you play a freeshard and I'm not sure what era your shard does.  Not sure if journal scanning works on your shard like it does on later era shards and OSI.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:16:55 PM
I've watched it some.

But no not that I've noticed.  I'll go thru it and pay close attention to it.

I ask because I see you play a freeshard and I'm not sure what era your shard does.  Not sure if journal scanning works on your shard like it does on later era shards and OSI.

Oh, I bet my profile still says I play ABCUO.  I'm on EA again.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:20:28 PM

Oh, I bet my profile still says I play ABCUO.  I'm on EA specifically Siege Perilous and Pacific occasionally.

Should definitely work on EA.  Check that #JOURNAL values change.  I can't verify on EA; I haven't had an account there for several years now.  I do know it works just fine on Lexia.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:26:08 PM
Here's a quick test script.  Just type "hello" in your chat and it should pop up with "hello" everytime you type hello

I just tested this on Lexia, so I know it works.

Code: easyuo
  1. gosub TM_AdvJournalSync test 100
  2.  
  3. repeat
  4.   gosub TM_AdvJournalScan test ADVANCE hello
  5.   if #RESULT = #TRUE
  6.   {
  7.     display ok Hello
  8.   }
  9. until #FALSE
  10. ;-------------------------------------------------------------------------------
  11. ; %1 - Journal Name
  12. ; %2 - #LPC setting (optional)
  13. ; Brings !_jindex up to the most recent #journal entry
  14. sub TM_AdvJournalSync
  15.   namespace push
  16.   namespace local TM_AdvJS_ , %1
  17.   set !_jindex #jindex + 1
  18.   if %0 > 1
  19.     set !lpc_set %2
  20.   namespace pop
  21.   set !TM_FunctionCalled #TRUE
  22. return
  23. ;-------------------------------------------------------------------------------
  24. ; %1 - Journal Name
  25. ; %2 - NONE, ADVANCE , ( _VALID ) - advances jindex pointer, anything else
  26. ; %3, %4, %5, etc strings to match
  27. ; returns #TRUE for match, #FALSE for no match
  28. ;  Will not advance !_jindex pointer to allow for scanning journal history for more than one search.
  29. ;  Also searches for : , #SPC in journal entry to be sure someone isn't spamming the text
  30. ;  About %2 arguments:
  31. ;    NONE: defaults to basic journal scan (no SPAM checking, no #jindex pointer copy advancing)
  32. ;    ADVANCE: no spam checking, advances #jindex copy
  33. ;    VALID: invokes SPAM filtering, no advance of #jindex copy
  34. ;    VALID_ADVANCE, VALIDADVANCE, ADVANCE_VALID, etc.: invokes SPAM filtering, advances of #jindex copy
  35. sub TM_AdvJournalScan
  36.   namespace push
  37.   namespace local TM_AdvJS_ , %1
  38.   set !args %2
  39.   set !temp_lpc #LPC
  40.   if !lpc_set = N/A
  41.     set #LPC 1000
  42.   else
  43.     set #LPC !lpc_set
  44.   set !num_args %0
  45.   set !first_arg 3
  46.   set !sampled_jindex #JINDEX
  47.   if !_jindex = N/A
  48.     set !_jindex !sampled_jindex
  49.   if !charname = N/A
  50.   {
  51.     set !charname #CHARNAME
  52. AdvJournalScan_loop1:
  53.     str pos !charname #SPC
  54.     if #STRRES <> 0
  55.     {
  56.       set !val #STRRES - 1
  57.       str left !charname !val
  58.       set !left #STRRES
  59.       set !val !val + 1
  60.       str del !charname 1 !val
  61.       set !charname !left , _ , #STRRES
  62.       goto AdvJournalScan_loop1
  63.     }
  64.   }
  65.   set !index !first_arg
  66.   repeat
  67.     set !temp_jindex !_jindex
  68.     set !text % . !index
  69.     while !temp_jindex <= !sampled_jindex
  70.     {
  71.       scanjournal !temp_jindex
  72.       str pos #JOURNAL !charname 1
  73.       set !namepos #STRRES
  74.       str count #JOURNAL !charname
  75.       set !namecnt #STRRES
  76.       str pos #JOURNAL :_ 1
  77.       set !smcpos #STRRES
  78.       str pos #JOURNAL !text 1
  79.       set !textpos #STRRES
  80.       if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
  81.         set !pass #TRUE
  82.       else
  83.         set !pass #FALSE
  84.       if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
  85.       {
  86.         set !temp_jindex !temp_jindex + 1
  87.         if ADVANCE in !args
  88.           set !_jindex !temp_jindex
  89.         set !trigger !text
  90.         set #LPC !temp_lpc
  91.         namespace pop
  92.         set !TM_FunctionCalled #TRUE
  93.         return #TRUE
  94.       }
  95.       set !temp_jindex !temp_jindex + 1
  96.     }
  97.     set !index !index + 1
  98.   until !index - !first_arg > !num_args - !first_arg
  99.   set %10 !sampled_jindex - !_jindex
  100.   set %10 %1 , _ , %10 ; for debugging purposes
  101.   set #LPC !temp_lpc
  102.   set TM_AdvJournalGetTrigger #FALSE
  103.   namespace pop
  104.   set !TM_FunctionCalled #TRUE
  105. return #FALSE
  106. ;-------------------------------------------------------------------------------
  107.  
  108.  
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:29:21 PM
I stepped thru it several times.

It loops thru the while/until section like 20+ times and #JOURNAL is N/A always never changes.

Each time it returns and asks for a BOD again and your scanner is called #JINDEX does increase +1

Here's a screenie of my journal

Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:32:14 PM
Are you running EasyUO as administrator?
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:33:31 PM
Are you running EasyUO as administrator?

Pretty sure I am.

I'll dbl check.
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:35:01 PM
#JOURNAL should be changing constantly, especially with that test code.  If not, then EasyUO isn't connecting correctly to your client. 
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 12:36:01 PM
Your TEST works perfectly.

Shows "hello"  in #journal too

Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 12:38:13 PM
Your TEST works perfectly.

I guess you can just take and try to expand that test code and see if you can make it work from within your own code.  Shouldn't be much different, but at least you have a working platform to leap from.  :)
Title: Re: TrailMyx's Advanced Journal Handler
Post by: Tommy Boy on January 06, 2020, 01:03:48 PM
Are you running EasyUO as administrator?

Holy crap!

So I have two shortcuts to easyuo on my desktop and both are setup in compatibility mode to "run as administrator."
I used one of those shortcuts to put a link in my startmenu.  I use that most of the time as my desktop is always covered.
Apparently that startmenu shortcut was NOT running as administrator.  I right clicked it and manually chose to Run as Admin and the damn thing works now.
I've been Fing with this for 15 hours now.  Damn!
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on January 06, 2020, 02:08:08 PM
When you said that #JOURNAL was returning "N/A", I was pretty sure that's the problem.  It's really the first thing I check now when I start up EasyUO.  Just check your character stats and if they aren't returning anything that you'd expect, there's a good chance that you didn't get admin rights applied.

No worries, I do it from time to time myself.  But after you get hit by the same bus a few times, one tends to try and step aside.  :) 
Title: Re: TrailMyx's Advanced Journal Handler
Post by: lit2fly on August 21, 2020, 02:30:15 AM
My char has Lord title, while #CHARNAME will return Lord XXX, in journal the title Lord doesn't show up so the Journal scanning missed the detection. (actually I hit this issue when using your own full-auto fisherman script, in which it can't detect "the fish doesn't seem to be biting here" and keep fishing the same spot)

I made a quick dirty fix and the journal scan works again:


  if !charname = N/A
  {
    if lord in #charname || lady in #charname
    {
       str len #charname
       str mid #charname 6 #strres
    }
    set !charname #strres
Title: Re: TrailMyx's Advanced Journal Handler
Post by: TrailMyx on August 25, 2020, 01:37:23 PM
Quick and dirty, but perfect for those with the same Lord or Lady problem.  Thanks for sharing that.