ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Combat/Healing/Looting => Topic started by: TrailMyx on June 09, 2008, 12:20:32 PM

Title: ScriptUO Healing Commander
Post by: TrailMyx on June 09, 2008, 12:20:32 PM
Code: [Select]
;=================================================================
; Script Name: ScriptUO Healing Commander
; Author: TrailMyx/Cerveza
; Version: 2.94
; Shard OSI / FS: OSI / FS OK
; Revision Date: 9/29/2007
; Purpose: Manages your healing needs by using journal scanning.
; Globals:
;   *TM_HEAL = #TRUE if healing targeting in progress.
; Namespaces:
;   TM_heal(local)
;   TM_AdvJS_*
;
; Special Thanks:
;   Cerveza for all his input and prompting me to get off my butt and finish this
;   This is a showcase for the new journal handling subs.
;=================================================================

Probably a little explanation is in order for this script.  It will maintain your health using the following methods:

* Bandages
* Magery
* Chivalry
* Necromancy

(yes, no potions, sorry)

Other features of this allow you:
* Heal when low on health
* Cure when poisoned
* Aware of mortal strike attack and bleeding attacks
* Motion sensing to be sure you don't try and cast when you are on the run.
* Configurable thresholds for healing levels
* Stores setup for each character in persistent memory
* Integrates seamlessly with the CLAw autolooter
* Doesn't require OCR; everything is handled with the journal.
Title: Re: ScriptUO Healing Commander
Post by: Cerveza on October 25, 2008, 07:39:18 PM
There's a couple flaws with Necromancy healing.

1 - It tries twice and you get the "you must wait"

2 - It's not setting !TM_HEAL to true.

I'm running this little snip script to test times:

Code: [Select]
TM:
repeat
namespace copy TM_HEAL from global TM_HEAL
event sysmessage #sCnt2

gosub Check_Status
if #RESULT = #TRUE
  event sysmessage *** TRUE TRUE TRUE TRUE ***

until #CharGhost = YES
while #CharGhost = YES
  wait 0
GoTo TM

sub Check_Status
if #targCurs = 1 || #lLiftedKind = 1 || !TM_HEAL = #TRUE
  return #TRUE
return

It works for Chiv heals, but I never see *** TRUE when I use Necro heals.

*Actually, it must be something slowing down the recognition.... The bandage status is accurately displayed on both the Commander and the Bandage Status menus, but not making it to my script above.
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 25, 2008, 07:42:10 PM
There's a couple flaws with Necromancy healing.

1 - It tries twice and you get the "you must wait"

2 - It's not setting !TM_HEAL to true.

I'm running this little snip script to test times:

*snip*

It works for Chiv heals, but I never see *** TRUE when I use Necro heals.

Heh, well I think I never even tested it.  I'd fall over dead in shock if it worked actually... :)
Title: Re: ScriptUO Healing Commander
Post by: Cerveza on October 25, 2008, 07:47:24 PM
I see something....

Code: [Select]
sub TM_GetHealStatus
  namespace push
  namespace global TM_healer
  set #RESULT !TM_HEAL
  namespace pop
return #RESULT
But searching I didn't see a gosub for it?

OH and is it

namespace copy TM_HEAL from global TM_HEAL
or
namespace copy TM_HEAL from global TM_Healer

I use the first, but I noticed the Bushido trainer uses "TM_Healer". The Healing Commander says TM_HEAL in the header, but all the globals in the script are Healer?
Title: Re: ScriptUO Healing Commander
Post by: Cerveza on October 25, 2008, 07:56:40 PM
It's TM_Healer, working fine. Please to notify the author to correct his header in his script  :P
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 25, 2008, 08:09:38 PM
lool, nerd.
Title: Re: ScriptUO Healing Commander
Post by: Cerveza on October 25, 2008, 08:13:24 PM
still having issues.

It's not releasing after !TM_HEAL goes true. Should the Healing Commander release it back to !TM_HEAL = #FALSE?
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 25, 2008, 08:39:22 PM
Not for Necro, the healing busy was mainly for bandages.
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 25, 2008, 08:40:20 PM
However, if I read your question correctly, I don't think the Necromancy sub should be setting !TM_HEAL to #FALSE.....
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 25, 2008, 11:23:18 PM
And yes that's a bug.  :)

What the heck are you doing healing with Necro anyway?
Title: Re: ScriptUO Healing Commander
Post by: Cerveza on October 26, 2008, 06:24:41 AM
It's not so much healing with a necro as ensuring the !TM_Healer is working correctly with other scripts. I was using my Whammy to test it and tried SS to heal.

I found something else that is very serious, not with the commander, but EUO in general. I'll put it up for your evaluation later today.

In a nutshell....

Loop checks for !TM_Healer, has a Journal scan in the loop, loop runs at #sCnt2 of 2 per loop.
Once !TM_Healer goes #TRUE the loop detects it.
Once !TM_Healer goes back to #FALSE, that SAME Journal scan is slowing the loop time to over 20.
Title: Re: ScriptUO Healing Commander
Post by: Cerveza on October 26, 2008, 07:17:13 AM
It's the LPC with the journal scanner.

Why doesn't it return to whatever the LPC of the script is?

gosub TM_AdvJournalSync paralyzed 100

That works great until the script recognizes a !TM_Healer = #TRUE, after that it slows way down.

gosub TM_AdvJournalSync paralyzed 1000

Works the whole time?

Run the healing commander and this test script. Then hurt yourself with a trapped box. You'll see that the time between counters BEFORE a !TM_Healer is really fast, but *AFTER* it slows waaaaay down. It's the JournalScanner thats doing it.

Code: [Select]
gosub TM_AdvJournalSync paralyzed 100

TM:
repeat
event sysmessage #sCnt2 1
namespace copy TM_HEAL from global TM_Healer
wait 10 ; just so it doesn't spam-a-lot

gosub Check_Status
if #RESULT = #TRUE
{
  event sysmessage *** TRUE TRUE TRUE TRUE ***
  goto TM
}

; ***** rem out this section and test again *****

gosub TM_AdvJournalScan paralyzed VALID you_cannot_move the_attack_has_temporarily
if #result = #TRUE
  gosub ParaCrate

; ***** rem out the above section and test again *****

event sysmessage #sCnt2 2

until #CharGhost = YES
while #CharGhost = YES
  wait 0
GoTo TM

sub Check_Status
if #targCurs = 1 || #lLiftedKind = 1 || !TM_HEAL = #TRUE
  return #TRUE
return

;**************************************
; This sub doesn't matter, it shouldn't
; get called because the text shouldn't
; ever be recognized
;**************************************

sub ParaCrate
  set #lobjectid %crateID
  event macro 17
  wait 5
return

;=================================================================
; 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.
;=================================================================
;------------------------  Call interface  -----------------------
;=================================================================
set !TM_FunctionCalled #FALSE
if %0 = 1
  gosub %1
if %0 = 2
  gosub %1 %2
if %0 = 3
  gosub %1 %2 %3
if %0 = 4
  gosub %1 %2 %3 %4
if %0 = 5
  gosub %1 %2 %3 %4 %5
if %0 = 6
  gosub %1 %2 %3 %4 %5 %6
if %0 = 7
  gosub %1 %2 %3 %4 %5 %6 %7
if %0 = 8
  gosub %1 %2 %3 %4 %5 %6 %7 %8
if %0 = 9
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9
if %0 = 10
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
if %0 = 11
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
if %0 > 11
{
  display ok Too many arguments for "call", edit file.
  stop
}

if !TM_FunctionCalled = #TRUE
  exit
if %0 = N/A
  display ok You may not run this script directly.
else
  display ok Function " , %1 , " not found.
stop
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; %1 - Journal Name
; %2 - #LPC setting (optional)
; Brings !_jindex up to the most recent #journal entry
sub TM_AdvJournalSync
  namespace push
  namespace local TM_AdvJS_ , %1
  set !_jindex #jindex + 1
  if %0 > 1
    set !lpc_set %2
  namespace pop
  set !TM_FunctionCalled #TRUE
return
;-------------------------------------------------------------------------------
; %1 - Journal Name
; %2 - NONE, ADVANCE , ( _VALID ) - advances jindex pointer, anything else
; %3, %4, %5, etc strings to match
; returns #TRUE for match, #FALSE for no match
;  Will not advance !_jindex pointer to allow for scanning journal history for more than one search.
;  Also searches for : , #SPC in journal entry to be sure someone isn't spamming the text
;  About %2 arguments:
;    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
sub TM_AdvJournalScan
  namespace push
  namespace local TM_AdvJS_ , %1
  set !args %2
  set !temp_lpc #LPC
  if !lpc_set = N/A
    set #LPC 1000
  else
    set #LPC !lpc_set
  set !num_args %0
  set !first_arg 3
  if !_jindex = N/A
    set !_jindex #jindex
  if !charname = N/A
  {
    set !charname #CHARNAME
AdvJournalScan_loop1:
    str pos !charname #SPC
    if #STRRES <> 0
    {
      set !val #STRRES - 1
      str left !charname !val
      set !left #STRRES
      set !val !val + 1
      str del !charname 1 !val
      set !charname !left , _ , #STRRES
      goto AdvJournalScan_loop1
    }
  }
  set !index !first_arg
  repeat
    set !temp_jindex !_jindex
    set !text % . !index
    while !temp_jindex <= #jindex
    {
      scanjournal !temp_jindex
      str pos #JOURNAL !charname 1
      set !namepos #STRRES
      str count #JOURNAL !charname
      set !namecnt #STRRES
      str pos #JOURNAL :_ 1
      set !smcpos #STRRES
      str pos #JOURNAL !text 1
      set !textpos #STRRES
      if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
        set !pass #TRUE
      else
        set !pass #FALSE
      if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
      {
        set !temp_jindex !temp_jindex + 1
        if ADVANCE in !args
          set !_jindex !temp_jindex
        set #LPC !temp_lpc
        namespace pop
        set !TM_FunctionCalled #TRUE
        return #TRUE
      }
      set !temp_jindex !temp_jindex + 1
    }
    set !index !index + 1
  until !index - !first_arg > !num_args - !first_arg
  set #LPC !temp_lpc
  namespace pop
  set !TM_FunctionCalled #TRUE
  return #FALSE
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 26, 2008, 12:05:28 PM
Ok, the problem you are having isn't with the journal scanner, but how you are using it.  Remember, you are in control of the ADVANCE pointer with the way you have coded it.  So at the end of your loop (your UNTIL), you need to put a:

Code: [Select]
gosub TM_AdvJournalSync paralyzed

The version you posted lets the pointer run away in the journal scanner, so every time you spam your debug information, you start filling up the journal and since you aren't synchronizing the pointer to text you have already scanned, you are scanning the entire journal again.

If you plan to not have another journal search for that information, you can just do:

Code: [Select]
gosub TM_AdvJournalScan paralyzed VALID_ADVANCE you_cannot_move the_attack_has_temporarily


Your test code was helpful, because even just sitting there, I could watch the number start to print out slower and slower.  EasyUO is a VERY slow interpreter so large loops get obvious rather quickly.

To convince yourself that the journal scanner is keeping the pointers under control, use this version of TM_AdvJournalScan:

Code: [Select]
sub TM_AdvJournalScan
  namespace push
  namespace local TM_AdvJS_ , %1
  set !args %2
  set !temp_lpc #LPC
  if !lpc_set = N/A
    set #LPC 1000
  else
    set #LPC !lpc_set
  set !num_args %0
  set !first_arg 3
  if !_jindex = N/A
    set !_jindex #jindex
  if !charname = N/A
  {
    set !charname #CHARNAME
    AdvJournalScan_loop1:
      str pos !charname #SPC
      if #STRRES <> 0
      {
        set !val #STRRES - 1
        str left !charname !val
        set !left #STRRES
        set !val !val + 1
        str del !charname 1 !val
        set !charname !left , _ , #STRRES
        goto AdvJournalScan_loop1
      }
  }
  set !index !first_arg
  repeat
    set !temp_jindex !_jindex
    set !text % . !index
    while !temp_jindex <= #jindex
    {
      scanjournal !temp_jindex
      str pos #JOURNAL !charname 1
      set !namepos #STRRES
      str count #JOURNAL !charname
      set !namecnt #STRRES
      str pos #JOURNAL :_ 1
      set !smcpos #STRRES
      str pos #JOURNAL !text 1
      set !textpos #STRRES
      if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
        set !pass #TRUE
      else
        set !pass #FALSE
      if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
      {
        set !temp_jindex !temp_jindex + 1
        if ADVANCE in !args
          set !_jindex !temp_jindex
        set #LPC !temp_lpc
        namespace pop
        return #TRUE
      }
      set !temp_jindex !temp_jindex + 1
    }
    set !index !index + 1
  until !index - !first_arg > !num_args - !first_arg
  if ADVANCE in !args
    set !_jindex !temp_jindex
  set #LPC !temp_lpc
  set %10 #JINDEX - !_jindex
  set %10 %1 , _ , %10
  namespace pop
return #FALSE

If you monitor the %10 variable, you should see the journal name followed by a small number, i.e. paralyzed_0.

Now there was a bug like this a long time ago in the journal scanner back on uocoders, but that was fixed.  You made me think that some older code crept back in....
Title: Re: ScriptUO Healing Commander
Post by: Cerveza on October 26, 2008, 01:33:32 PM
Thats exactly it. I had updated the journal scanner from an earlier version that worked great. I got the syntax wrong on it this time.


Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 26, 2008, 09:43:34 PM
Then all is good in scripting land.  :)
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on November 08, 2008, 08:25:46 PM
Posted version 2.95

New to version 2.95:

.  Cerveza found an error with healing with Necromancy.
Title: Re: ScriptUO Healing Commander
Post by: kevdog1842 on July 01, 2009, 07:22:37 AM
This script works really nice. I use it a bunch. The only problem i've had with it, is if you get mobbed by monsters, they interrupt healing, and I die. But so long as I just make sure and watch out for packs of monsters, it works great. I use this with the cLAW looter, they work really good together.
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on July 01, 2009, 07:26:38 AM
Ya, that's going to be pretty much the same for anything.  The best combination for this script is to have Chivalry as well as bandages so if you do fail your bandage, you can still heal yourself if things get critical.  Plus chivalry is a great addition to your fighting skill.  With Enemy of One and Consecrate Weapon, it's great to get 200+ hits!

Also if you have low healing skill, you will get interrupted more.  You'll find this script works much better as your healing skill increases.
Title: Re: ScriptUO Healing Commander
Post by: jjbean on September 19, 2009, 07:19:51 PM
Looks useful. hope it works. Checking it out.

Post Merge: September 19, 2009, 07:33:16 PM
OK so i dont get how to actually download the scripts. Seem there is no link in the forum area pages where they have them listed. Cant find what to click to start the download. HELP!!!
Title: Re: ScriptUO Healing Commander
Post by: cgeorgemo on September 19, 2009, 09:26:14 PM
I be replying to your earlier introduction post matey......you should be studying the horizon for any other storms that blow in.....
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on October 13, 2010, 12:29:26 AM
This script should be very easy to convert; I may give that a whirl this weekend.
Title: Re: ScriptUO Healing Commander
Post by: camotbik on February 03, 2011, 02:43:03 PM
if you would add potions to this script, it would be just perfect.
Title: Re: ScriptUO Healing Commander
Post by: Kalaka on February 03, 2011, 08:27:06 PM
Godrick has a good one over on Easyuo where it includes pots.
Title: Re: ScriptUO Healing Commander
Post by: UOMaddog on June 07, 2011, 12:15:34 AM
Well I used this one finally today just for bandage healing on my new thrammy...works great! although sometimes it misses the "complete" message I think because it would be slow to apply another bandage...usually only happens when there's a ton of things on my screen which makes me think it's an issue with the journal lagging or something...of course it could all be in my head too....
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on June 07, 2011, 08:19:18 AM
Ya, there is a failsafe in there to reset the bandaging in the event that the journal scan overflows.  I need to check the specific version of the journal scanner included in this because I did find a corner-case where you could miss occasionally a journal entry because of a race condition.
Title: Re: ScriptUO Healing Commander
Post by: UOMaddog on June 07, 2011, 09:56:07 AM
That could possibly be (I actually think I was reading the thread where you found that issue yesterday). I know I had the exact same issues when I used your journal scanning subs for my own bandage healer with regards to a race condition and waiting for it to just timeout.
Title: Re: ScriptUO Healing Commander
Post by: Pearls on May 04, 2014, 03:16:19 AM
Have been using this for training up healing (bandages). Just what i was looking for thx.
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on May 04, 2014, 09:47:57 AM
Kewl, another use for a script not originally intended.  I love that!  heh.  Glad it helps!
Title: Re: ScriptUO Healing Commander
Post by: The Ghost on May 04, 2014, 10:17:28 AM
TM have some build that can teach you  a thing or two.  I learn how to utilize menu better with this build.   
Title: Re: ScriptUO Healing Commander
Post by: TrailMyx on May 04, 2014, 10:59:35 AM
TM have some build that can teach you  a thing or two.  I learn how to utilize menu better with this build.   

Very true.  it's a small script with a very straight forward way to do menuing.  Really, most of my menu scripts (big or small) use exactly the same method.  Just a button handling loop in your main loop.  Easy peasy.
Title: Re: ScriptUO Healing Commander
Post by: olo on April 22, 2018, 12:20:52 PM
How can i download scripts to see if they work?
thk for reply
Title: Re: ScriptUO Healing Commander
Post by: Crisis on April 22, 2018, 01:37:02 PM
You need to go to the new member introductions and introduce yourself. I would look at the stickies before posting one.
Title: Re: ScriptUO Healing Commander
Post by: danimard on May 03, 2018, 07:01:14 PM
hello im tried tested it and update if it necesary my brothers