ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Coragin on November 02, 2009, 11:51:30 PM

Title: Tell me what is wrong here...
Post by: Coragin on November 02, 2009, 11:51:30 PM
Okay I got it to keep slayers, but I cannot get 100% elemental damage to work.  It is saving everything now with this syntax.  I cant figure this out, you can see which ones I commented out that were working to make sure it was all correct.  But when I try to make it ONLY save 100% Fire, Cold, Energy or Poison weapons it saves ALL weapons no matter what.  I am thinking I might just have to have it unravel anything with physical damage in it then sift through what is left.

Its supposed to make buktos and look for 100% elemental dmg and if it has it, will store the weapon.

Someone please help.

Code: [Select]
Event Macro 8 7
Display Ok Select the Resource Container.
  set #targcurs 1
      while #targcurs = 1
         wait 1
         set %ResourceBag #ltargetID
      set #lobjectID #ltargetID
      set #nextcposx 200
      set #nextcposy 0
      event macro 17
      wait 10
Display Ok Select your storage Bag in Resource Container.
  set #targcurs 1
      while #targcurs = 1
         wait 1
      set %StorageBag #ltargetID
      set #lobjectID #ltargetID
      set #nextcposx 400
      set #nextcposy 0
      event macro 17
      wait 20


set %residue TKR_WKR
set %weapon KDP
set %Wood TLK
set %elemental Poison_Fire_Cold_Energy
set %percent 100%
set %runic ZFG_
set %slayer Elemental_Reptile_Undead_Arachnid_Demon_Slayer
set #nextcposx 0
set #nextcposy 0
set %imain 520_250           ; Imbuing Main menu size
set %isec 520_440            ; Imbuing secondary menus for properties and value
set %cwin 530_507            ; Crafting window size
set %gumpwait 5 ; Increase number to slow down clicks on menus.  20 = 1 second.

MainLoop:
Gosub GetTools
Gosub MakeWeapon
Gosub CheckWeapon1
Goto MainLoop

sub GetTools
    finditem %runic C_ , #backpackid
      if #findcnt < 1
         {
         finditem %runic C_ , %ResourceBag
         if #findkind = -1
            {
            display You are out of runics.
            halt
            }
         exevent drag #findid 1
         wait 10
         exevent dropc #backpackid
         wait 20
         }
    finditem %Wood C_ , #backpackid
         if #findstack < 200
         {
         set %quantityinpack 200 - #findstack
         finditem %Wood C_ , %ResourceBag
         if #findstack < %quantityinpack
            {
            display You need more wood.
            halt
            }
         else
            {
            exevent drag #findid %quantityinpack
            wait 10
            exevent dropc #backpackid
            wait 20
            }
         }
         Return

Sub MakeWeapon
    finditem %Weapon C_ , #BackPackid
    If #findcnt = 1
       {
       set %MadeWeapon #findid
       gosub CheckWeapon1
       Return
       }
    finditem %runic C_ , #BackPackid
    set #lobjectid #findid
    event macro 17
    gosub waitforgump %cwin
    Click 335 500 f    ;Make Last
    gosub waitforgump %cwin
    Click 77 505 f    ;exit
    wait 20
    finditem %Weapon C_ , #BackPackID
    set %MadeWeapon #findid
Return

sub CheckWeapon1
         finditem %MadeWeapon C_ , #backpackid
         if #findcnt 1
            {
            event property #findid
            if %elemental in #Property && Damage in #property && %percent in #property
            ;if Slayer in #property
            ;if Physical_Damage_100% in #property || %slayer in #property || Energy_Damage_100% in #property || Fire_Damage_100% in #property || Cold_Damage_100% in #property || Slayer in #property
               {
               gosub StoreWeapon
               Return
               }
            Gosub Unravel
Return

Sub StoreWeapon
    finditem %Weapon C_ , #backpackid
    exevent drag #findid #findstack
    wait 10
    exevent dropc %StorageBag
    wait 20
    finditem %MadeWeapon C_ , #backpackid
    exevent drag #findid #findstack
    wait 10
    exevent dropc %StorageBag
    wait 20
Return

Sub StoreResidue
    finditem %Residue C_ , #backpackid
    if #findcnt < 1
              return
    exevent drag #findid #findstack
    wait 10
    exevent dropc %ResourceBag
    wait 20
Return

Sub Unravel
Repeat
    finditem %MadeWeapon C_ , #BackPackid
    If #findcnt = -1
       {
       Return
       }
    Event Macro 13 56
    gosub waitforgump %imain
          if ! #result
          {
          display ok Problems opening the imbue menu.  Dble Click fletcher tool and click play
          pause
          }
    Click 228 248 f
    wait 30
    set #ltargetID %MadeWeapon
    event macro 22 0
    ;gosub waitforgump %imain
          if ! #result
          {
          display ok Problems with imbue unravel menu.  Dble Click fletcher tool and click play
          pause
          }
    Click 50 250 f
    wait 30
    gosub StoreResidue
Return

;================== Wait for gump ======================

sub waitforgump
set %timeout #scnt + 30
while #contsize <> %1
      {
      wait 1
      if #scnt > %timeout
         {
          return #false
         }
      }
wait %gumpwait
return #true

sub CheckWeapon1
         finditem %MadeWeapon C_ , #backpackid
         if #findcnt 1
            {
            event property #findid
            if %elemental in #Property && Damage in #property && %percent in #property
            ;if Slayer in #property
            ;if Physical_Damage_100% in #property || %slayer in #property || Energy_Damage_100% in #property || Fire_Damage_100% in #property || Cold_Damage_100% in #property || Slayer in #property
               {
               gosub StoreWeapon
               Return
               }
            Gosub Unravel
Return
Title: Re: Tell me what is wrong here...
Post by: Alpha on November 03, 2009, 01:22:33 AM
OK  a couple of things...

The underscore your using in setting your string variables isn't the same thing as a space...  You'd need to do something like this...

Code: [Select]
set %slayer Elemental , #spc , Demon , #spc , Repond , #spc , Undead , #spc , Reptile
Also you can't search to see if your %Slayer string is in your #property variable bc the WHOLE string would have to be in there for it to return True...

If you use concantenation and #spc you can make strings for search through #property..

Lastly... you'll have to search for a single super slayer being in the #property but include an extra check for all the various crap elementals etc..


Code: [Select]
Sub Check_for_slayer

If Demon in #property || Repond in #property || Undead in #property || Reptile in #property
  {
     Gosub Save_Item
  }
If Elemental in #property && Water notin #property && Earth notin #property && Fire notin #property && Air notin #property && Blood notin #property
  {
    Gosub Save_Item
  }

Return

Anyway hope that helps a bit
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 03, 2009, 01:28:26 AM
Thank you that did teach me a bit, but the problem I am having is getting it to save 100% Damage Weapons... i.e. Poison Damage 100%, Fire Damage 100%, Cold Damage 100%, Energy Damage 100%.  I dont know what Im doing wrong.
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 03, 2009, 01:36:38 AM
Wait I think I got it...

Code: [Select]
set %elemental Fire , #spc , Poison , #spc , Cold , #spc , Fire
set %percent 100%

Sub Check_for_dmg

If %elemental in #property && Damage in #property && %percent in #property
  {
     Gosub Save_Item
  }
If %elemental in #property && Damage in #property && Physical notin #property
  {
    Gosub Save_Item
  }

Return

Effectively the first part of the check sub is checking for %elemental i.e. Fire, Cold, Poison, Energy and making sure there is also 100% and Damage.

While the second part is looking for fire, cold, poison, energy AND damage, but making sure Physical is NOT in it.  I guess getting the 100% part is the tricky part.
Title: Re: Tell me what is wrong here...
Post by: Scrripty on November 03, 2009, 03:08:34 AM
I believe that would be Fire , Poison, Cold, Energy... just sayin. :)
Title: Re: Tell me what is wrong here...
Post by: Endless Night on November 03, 2009, 06:56:52 AM
that wont work...  you are asking if the string "Fire  Poison  Cold  Fire" is in the items property. And the answer will always be no.  Those word may exist but not as specifically written.  what you need to do is

Code: [Select]
if Damage in #property && 100 in #property &&
 (  fire in #property || poison in #property  ||  cold in #property )
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 03, 2009, 09:16:50 AM
that wont work...  you are asking if the string "Fire  Poison  Cold  Fire" is in the items property. And the answer will always be no.  Those word may exist but not as specifically written.  what you need to do is

Code: [Select]
if Damage in #property && 100 in #property &&
 (  fire in #property || poison in #property  ||  cold in #property )

Word.
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 03, 2009, 05:08:55 PM
Parenthesis! 
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 06, 2009, 10:48:52 AM
that wont work...  you are asking if the string "Fire  Poison  Cold  Fire" is in the items property. And the answer will always be no.  Those word may exist but not as specifically written.  what you need to do is

Code: [Select]
if Damage in #property && 100 in #property &&
 (  fire in #property || poison in #property  ||  cold in #property )

Word.

Been talking in PM's to En about this.  The above code will work so long as it dont have...

Poison Resist %
Fire Resist %
Cold Resist %
Energy Resist %

Hit X Area

Ect....

So it could be a Physical Damage 100% but if it has Poison Resist 7% it will pick it up as a 100% Poison Damage Weapon.

Is there a way to check if Poison, Fire, Cold, Energy are on the Same LINE as DAMAGE and 100%? 

I know aClaw lite can pick it up perfect.  So I am sure TM can give me the simple answer/solution to this problem, I tried easyuo.com, cant find anything on this.

I made the following script to test things.  And commented on what it does and does not pick up and if it picks up the wrong item.

This was tested using a 100% Cold Damage Weapon and a 100% Physical Damage weapon with Hit Cold Area 2%, swapping them in and out.

Code: [Select]

set %energy Cold Damage 100% ;=====not right
set %poison Cold_Damage_100%  ;=====not right
set %cold Cold Damage 100
set %fire Cold_Damage_100

set %Weapon XFR

Mainloop:
gosub CheckWeapon1
goto mainloop

sub CheckWeapon1
   gosub CheckEnergy100
   gosub CheckPoison100
   gosub CheckCold100
   gosub CheckFire100
   gosub CheckManual
   gosub FoundNothing
Return

Sub CheckEnergy100    ;===================================Finds Cold Damage in a weapon 100% Physical with hit cold area
         finditem %Weapon C_ , #BackpackID
         if #findcnt >= 1
            {
            event property #findid
            if %energy in #property
               {
               wait 5
               set %weapon %storeweapon
               display Ok Recognize Cold Sub 1
               Halt
               }
            }
Return

Sub CheckPoison100       ;===============================Dont pickup anything
         finditem %Weapon C_ , #BackpackID
         if #findcnt >= 1
            {
            event property #findid
            if %poison in #property
               {
               wait 5
               display Ok Recognize Cold Sub 2
               Halt
               }
            }
Return

Sub CheckCold100   ;===================================Finds Cold Damage in a weapon 100% Physical with hit cold area
         finditem %Weapon C_ , #BackpackID
         if #findcnt >= 1
            {
            event property #findid
            if %cold in #property
               {
               wait 5
               display Ok Recognize Cold Sub 3
               Halt
               }
            }
Return

Sub CheckFire100     ;===============================Dont pickup anything
         finditem %Weapon C_ , #BackpackID
         if #findcnt >= 1
            {
            event property #findid
            if %fire in #property
               {
               wait 5
               display Ok Recognize Cold Sub 4
               Halt
               }
            }
Return

Sub CheckManual       ;=======================Finds 100 Physical w/2% HCA as 100% Cold Damage
         finditem %Weapon C_ , #BackpackID
         if #findcnt >= 1
            {
            event property #findid
            if Damage in #property && 100 in #property && Cold in #property
               {
               wait 5
               display Ok Recognize Cold Sub Manual
               Halt
               }
            }
Return

Sub FoundNothing
  Display Ok Didnt find it.
  Halt[/cold]
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 11:05:23 AM
Unfortunately, I do things a bit differently in the CLAw, so there's not a real way to compare.  I'm not sure what you are trying to do, so it's kinda hard to add anything at the moment.  Are you just trying to find weapons with 100% elemental damage?
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 06, 2009, 11:22:57 AM
Unfortunately, I do things a bit differently in the CLAw, so there's not a real way to compare.  I'm not sure what you are trying to do, so it's kinda hard to add anything at the moment.  Are you just trying to find weapons with 100% elemental damage?

Yes in my own script.  And well the rest is explained above.  If its 100% Physical but has "Hit Fire, Cold ect Area" it will also pick that out as being 100% Elemental.  The only work around is if I include

%Physical notin #property && Resist notin %property && Area notin #property

Problem with that is, it could be a 100% elemental damage weapon but if it has Resist, Physical, Area in the property it will destroy it.
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 11:36:07 AM
So I guess one of the problems is you are calling out a very generic "100" and looking for that in the #PROPERTY.  If it finds a 100 ANYWHERE in the #PROPERTY value, it'll return true (could find in durability, another elemental value, etc).  So you'll need to specifically look for the full strings like "Physical_Damage_100%", etc.

The CLAw actually looks for the attribute name and also computes the intensity values (the percentages% and the +pluses).  But that's a bit more complex.
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 06, 2009, 11:39:57 AM
TM if you look in the script I wrote to test, it has

set %energy Cold Damage 100% ;=====not right
set %poison Cold_Damage_100%  ;=====not right
set %cold Cold Damage 100
set %fire Cold_Damage_100

So none of those are being picked up, the ones that are (not right) pick up the words no matter where they appear.
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 12:02:17 PM
Well you have to remember that the #PROPERTY variable uses "spaces" instead of undeerscores.  So you really need to be looking for this:

Code: [Select]
set %cold Cold , #SPC , Damage , #SPC , 100

Property works reverse from the journal which uses "_" as spaces.
Title: Re: Tell me what is wrong here...
Post by: Scrripty on November 06, 2009, 12:04:59 PM
Well you have to remember that the #PROPERTY variable uses "spaces" instead of undeerscores.  So you really need to be looking for this:

Code: [Select]
set %cold Cold , #SPC , Damage , #SPC , 100

Property works reverse from the journal which uses "_" as spaces.

Just explained a couple things to me I didn't quite understand correctly too.  Now I'm going to beef up my powerscroll stealer! :)
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 06, 2009, 12:37:23 PM
Well you have to remember that the #PROPERTY variable uses "spaces" instead of undeerscores.  So you really need to be looking for this:

Code: [Select]
set %cold Cold , #SPC , Damage , #SPC , 100

Property works reverse from the journal which uses "_" as spaces.

Thank you!  If this works, I will post my 4yr old holding a pic of "TM ROCKS!" lol
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 12:39:26 PM
I feel an avatar coming on!  lol
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 06, 2009, 01:20:48 PM
Tested, Works, Perfect, pic will be up soon as soon as I can get the munchkin to not be a prissy little creep.

Thank you TM, that has been bugging me for awhile now.  Now, all I need to do to do fire is the obvious.  And change words for other things like elemental slayer would be...

Code: [Select]
set %elementalslayer Elemental , #SPC , Slayer

Now, if this is as easy of an answer as the last one.  Is there a simple way to check for minimum values OR greater for my crafting script?  Example:

Code: [Select]
set %cold Cold , #SPC , Damage , #SPC , >= 80

or more specific...

set %HLD Hit , #SPC , Lower , #SPC , Defense , #SPC , >=51

Is that possible?  Or is there more specific addition in the code to evaluate numbers +/-?
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 01:23:49 PM
Yes it's possible,  but you'll have to split up the line itself.  So you'll want to determine the first part which is the attribute, and then the second part which is the intensity.
Title: Re: Tell me what is wrong here...
Post by: Endless Night on November 06, 2009, 01:46:11 PM
Bingo .. i had forgotten about that.  Nice catch TM
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 06, 2009, 01:54:05 PM
Yes it's possible,  but you'll have to split up the line itself.  So you'll want to determine the first part which is the attribute, and then the second part which is the intensity.

So like this?

Code: [Select]
set %HLD Hit , #SPC , Lower , #SPC , Defense
set %intensity >= 51

if %HLD in #property && %intensity in #property
     gosub StoreWeapon

Did I get that right?  Or will the %intensity scan for ANYTHING >=51 ?  If so, how do I get it to scan the same line of the property?
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 02:40:57 PM
Yes, but you'll have to parse out the intensity that's at the end of each attribute.  You have to strip off the percentage by hand; there's no automatic method for that.
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 02:41:34 PM
Bingo .. i had forgotten about that.  Nice catch TM

Yeh, that's one of those annoying inconsistencies.
Title: Re: Tell me what is wrong here...
Post by: Coragin on November 06, 2009, 02:45:41 PM
Yes, but you'll have to parse out the intensity that's at the end of each attribute.  You have to strip off the percentage by hand; there's no automatic method for that.

Okay, we will wait till I am more adept for that, I have no clue how to do that, unless you feel like posting a detailed example with say Hit Life Leech 51+.  But that is not high on my priority list, when I make my armor script the uses powder of fort and imbuing, I will need to learn that.  But not now, but would be nice for reference later, but not a big deal.
Title: Re: Tell me what is wrong here...
Post by: TrailMyx on November 06, 2009, 03:02:35 PM
Best I can tell you is to take a look at the CLAw; there's a routine in there that breaks everything up into attributes with leading intensities (100%), and trailing intensities.
Title: Re: Tell me what is wrong here...
Post by: Endless Night on November 06, 2009, 07:05:39 PM
Look up the STR command and all its options. Thats how you do it.

str pos 
str del
str mid
etc