[EasyUO]KaianaCorpseCheck

If you make a Client-side script you can publish it here for other players to use
Locked
User avatar
Kaiana
Elder Scribe
Posts: 148
Joined: Mon Jul 13, 2009 3:07 pm

[EasyUO]KaianaCorpseCheck

Post by Kaiana »

This script will likely be updated later, but it's ready for testing. :)

This script is not intended as a looting script, but rather as a [claim (not claimall) script. It is primarily for quickly collecting gold and ointments. When used with my UberLooter script (not yet released), it will also place the claimed items in bags that you specify. For now, you'll have to do that yourself.

Known issue: It can be hard to cast a spell mid-battle while this script is running. The script will pause automatically if you are in war mode, but if you are in peace mode and for example are healing your pets, the script may mistake that target cursor for a claim cursor. It's supposed to prevent that automatically, but there is a way it happens that I need to think of a workaround for. It's pretty technical, so I'll explain after the script.

Code: Select all

;------------------------+
;Kaiana's CorpseCheck    |
;(for getting oints/gold)|
;------------------------+
set %version 1.8b
set %build 10.01.06
;INSTRUCTIONS                                           |
;                                                       |
;The script pretty much runs itself, but there are a few|
;things to be aware of:                                 |
;                                                       |
;1.  The script will pause itself if a targeting cursor |
;    is brought up for any reason, until a target has   |
;    been chosen.  This is to help prevent the script   |
;    from interrupting other game functions.            |
;2.  You can pause the script at any time by going into |
;    war mode.  I recommend this if you are going into  |
;    an intense battle.  You wouldn't want (by some     |
;    fluke) the program to interrupt your heals or      |
;    something.                                         |
;3.  The only way your targeting will be messed up by   |
;    this script is through one bug I have not yet      |
;    worked out.  This occurs when your target cursor   |
;    comes up at the EXACT moment the [claim target     |
;    cursor comes up.  The script mistakes this for the |
;    [claim targeter, and that's bad.  This is pretty   |
;    rare now though with my recent modifications.      |
;                                                       |
;Other than that, all you have to do is walk around     |
;killing things and the script will auto-[claim all     |
;corpses.  If a corpse can't be seen or is out of range |
;(the latter only occuring when you walk out of range as|
;the script targets the corpse), the script will inform |
;you with a message over the corpse.  Remember, this is |
;a CLAIM script, not a claimall script, although if you |
;wish you can go to line 110 to change it.  I don't     |
;recommend it, though...your bag will be full in no time|
;flat.                                                  |
;                                                       |
;Thanks, and enjoy!  Any questions, comments, bugs...   |
;PM me on the Excelsior Forums.    ~Kaiana              |
;-------------------------------------------------------+

;Set up runtime variables
set %iCount 0
set %currentJournal 0

;Announce
event exmsg #CHARID 2 13 Script started.
event SysMessage Thanks for using Kaiana's Corpse-Look.
event SysMessage This is version %version and build %build

;clmainloop - this is the main loop for the script

clmainloop:
    ;Check for war mode, ghost, existing target cursor
    if #TARGCURS <> 0 || #CHARGHOST = YES || A in #CHARSTATUS || G in #CHARSTATUS
    {
       wait 2
       if %iCount = 0
          event ExMsg #CHARID 2 13 Paused...
       set %iCount %iCount + 1
       if %iCount = 30
          set %iCount 0
       goto clmainloop
    }
    ;Else start searching
    else
    {
      if %iCount <> 0
      {
         set %iCount 0
         event ExMsg #CHARID 2 13 Unpaused...
      }
      ;Searches closer areas first.
      findItem YFM G_4
      if #FINDCNT > 0
         goto readytopick
      findItem YFM G_10
      if #FINDCNT > 0
      {
         ;Item found, check again for interruptions
         readytopick:
         if #TARGCURS <> 0 || #CHARGHOST = YES || A in #CHARSTATUS
         {
            wait 2
            set %iCount %iCount + 1
            goto clmainloop
         }
         ;No interruptions, begin claim
         event ExMsg #FINDID 2 13 Claiming...
         set #LTARGETID #FINDID
         set #LTARGETKIND #FINDKIND
         event Macro 1 0 [claim
         target
         event Macro 22 0
         ;Set journal point as claim is processed
         set %currentJournal #JINDEX
         target
         if #TARGCURS <> 0
         {
            ;cancel target cursor after claim
            key ESC
         }
         ;Check journal for problems
         while #JINDEX <> %currentJournal - 1
         {
           scanjournal %currentJournal

           ;Ignore pet corpses, other players' kills
           if corpses_of_bonded_pets in #journal || did_not_earn_the_right in #journal || may_not_loot_player_corpses in #journal
              ignoreitem #FINDID

           ;Make sure corpse wasn't out of sight
           if cannot_be_seen in #journal || too_far_away in #journal
              event ExMsg #FINDID 2 33 Out of sight...
           set %currentJournal %currentJournal + 1
         }
      )
    }
goto clmainloop
;Pete and Repeat were on a boat.  Pete fell out.  Who was left?
Now here's the issue. The script checks to make sure that no target cursor is up prior to the script beginning a claim. However, if you are casting a spell and the cursor has not yet come up, the script will arrive at the point where it waits for a target cursor and when your spell cursor comes up first, it will attempt to use that target to claim the corpse. Obviously casting Sacred Boon or Touch of Life on a corpse won't do anything, so it's a problem. If I could think of a way to make the script discern whether you're casting a spell or not, I'd throw that in, but since the way you're supposed to be able to detect that is broken in EasyUO and will never be fixed....yeah. (You're supposed to be able to check for a certain letter in the #CHARSTATUS variable...but for some reason whenever you check for that letter EasyUO does not detect it even if it is present. Don't ask me why.
♥Kaiana♥ - Administrator of the Heart

Yay for scripting and programming! :)
public bool EasyUOMastery = true;
private double CSharpSkillz = 30.0; //and rising!
Locked