LoY Cultural Tailoring Swatch macro

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

LoY Cultural Tailoring Swatch macro

Post by MacroFiend » Mon Sep 08, 2003 10:12 pm

This little gem will scribe all LoY cultural tailoring swatches based on the available research items in the researcher's inventory. There are a few swatches left off (as the components are used for rare researched spells) but there are over 2 dozen possible combines included.

The scribing requires the class specific LoY research book found in Dulak Harbor and will not run without it. It will dynamically look for the researcher's proper book (though it has not been tested with any other than Enchanter).

Code: Select all

| LoYSwatch.mac
| Scribe research items for LoY cultural tailoring swatches
| Version 1.0
| MacroFiend

#turbo
#event FailedComb "You lacked the skills"
#event SuccessComb "You have fashioned"
#event TrivComb "You can no longer advance your skill"

#define CombStr v1 
#define CombInt v2 

#define SwatchArraySize v3

#define cmbSuccess v80
#define cmbFailed v81
#define cmbTrivial v82

Sub Main
   /varset a(1,0) "Words of Abatement"
   /varset a(1,1) "Words of Abrogation" 
   /varset a(1,2) "Rune of the Astral" 
   /varset a(1,3) "Words of Asylum" 
   /varset a(1,4) "Breath of Ro"
   /varset a(1,5) "Words of Burnishing" 
   /varset a(1,6) "Words of Capacity" 
   /varset a(1,7) "Rune of Concussion"
   /varset a(1,8) "Rune of the Cyclone"
   /varset a(1,9) "Rune of Ellipse"
   /varset a(1,10) "Words of the Ethereal"
   /varset a(1,11) "Words of Expertise"
   /varset a(1,12) "Words of Misery"
   /varset a(1,13) "Words of Neglect"
   /varset a(1,14) "Words of Obligation"
   /varset a(1,15) "Words of Obliteration"
   /varset a(1,16) "Words of Requisition"
   /varset a(1,17) "Essence of Rathe"
   /varset a(1,18) "Tears of Prexus"
   /varset a(1,19) "Rune of Tempest"
   /varset a(1,20) "Words of Tenancy"
   /varset a(1,21) "Words of Virtue"
   /varset a(1,22) "Wing of Xegony"
   /varset a(1,23) "Nilitim's Grimoire Pg. 115"
   /varset a(1,24) "Salil's Writ Pg. 90"
   /varset a(1,25) "Salil's Writ Pg. 64"
   /varset a(1,26) "Keris's Dissertation Pg. 5"
   /varset a(1,27) "Part of Yaeth's Compendium Pg. 78 "
   /varset a(1,28) "Part of Toharon's Memoir Pg. 15"

   /call CountArraySize 1 
   /varset SwatchArraySize $int($return) 

   /cleanup 
   /varset a(2,0) "Research ENC"
   /varset a(2,1) "Research MAG"
   /varset a(2,2) "Research NEC"
   /varset a(2,3) "Research WIZ"

   /for v19 0 to 3
|     /echo Attempting to locate "$a(2,$int($v19))"
     /call CombFind "$a(2,$int($v19))"
     /if n $CombInt<99 /varset v19 3
   /next v19

   /if $CombInt<=7 /call OpenInv 

   /call HandlePacks open 

   /for v20 0 to $SwatchArraySize
	/if n $count("$a(1,$v20)")>0 /call CombineAll "$a(1,$v20)"
   /next v20

   /cleanup
/return

sub CombineAll
  /if n $strlen("$p0")<=0 /return
  
  :CombineLoop
  /call CombineOne "$p0"
  /if n $count("$p0")>0 /goto :CombineLoop
/return

sub CombineOne
  /if n $strlen("$p0")<=0 /return

  /call PutItem "A Piece of Parchment" 0
  /call PutItem "A Quill" 1
  /call PutItem "$p0" 2
  /call DoCombine 
/return

Sub PutItem
	/sendkey down ctrl
	/finditem "$p0"
	/if $find()!=TRUE {
	  /call CleanPack
	  /endmacro
	}
	
	:PutWait1
	/delay 1
	/doevents
	/if $cursor()!=TRUE /goto :PutWait1
	/sendkey up ctrl
	
        /click left $CombStr $p1 

	:PutWait2
	/delay 1
	/doevents
	/if $cursor()==TRUE /goto :PutWait2
/return

Sub DoCombine 
      /varset cmbSuccess 0
      /varset cmbFailed 0

      /delay 3
      /click left $CombStr combine

      :WaitCombine 
      /doevents
      /if n $cmbFailed==1  /goto :WaitDrop 
      /if n $cmbSuccess==1 /goto :WaitDrop
      /goto :WaitCombine
      
      :WaitDrop
      /doevents
      /autoinventory 
      /if $cursor()==TRUE /goto :WaitDrop
      
      /if $pack($CombInt,empty)==FALSE /call EndCombines 
/return 

Sub CombFind 
   /varset CombInt 99 
   /if "$p0"~~"#" { 
      /varset l1 "$right($calc($strlen("$p0")-1),"$p0")" 
      /varset l2 0 
   } else { 
      /varset l1 "$p0" 
      /varset l2 1 
   } 
   /for l3 0 to 7 
      /if n $l2==0 /if "$pack($l3,name)"~~"$l1" /varset CombInt $int($l3)
      /if n $l2==1 /if "$pack($l3,name)"=="$l1" /varset CombInt $int($l3)
      /if n $l2==1 /if "$pack($l3,combine)"=="$l1" /varset CombInt $int($l3)
   /next l3 
   /if n $CombInt==99 { 
      /itemtarget $p0 
      /if n $ground(id)==0 /varset CombInt 99 
      /if n $distance(item)>20 /varset CombInt 98 
      /if n $ground(id)>0 /if n $distance(item)<=20 /varset CombInt 8 
   } 
/return $CombInt 

Sub OpenInv 
   /varset CombStr "pack $CombInt" 
   /if "$pack($int($CombInt),open)"=="FALSE" /click right inv $int($CombInt) 
   /delay 4
   /if $pack($CombInt,empty)==FALSE /call CleanPack 
/return 

Sub HandlePacks 
   /varset l0 0 
   /if "$p0"=="open" /goto :Open 
   /if "$p0"=="close" /goto :Close 
   /if "$p0"=="" /goto :Syntax 
   :Open 
      /for l0 0 to 7 
         /if "$pack($l0)"=="TRUE" /if "$pack($l0,open)"=="FALSE" /click right inv $l0
         /delay $dly 
      /next l0 
      /goto :End 
   :Close 
      /for l0 0 to 7 
         /if "$pack($l0)"=="TRUE" /if "$pack($l0,open)"=="TRUE" /click right inv $l0
         /delay $dly 
      /next l0 
      /goto :End 
   :Syntax 
      /echo Syntax: /call HandlePacks <open|close> 
      /endmacro 
   :End 
/return 

Sub CleanPack 
   /press ctrl 
   /sendkey down shift 
   /if "$CombStr"=="enviro" { 
      /varset l0 10 
   } else { 
      /varcalc l0 $pack($CombInt,slots)-1 
   } 

   /for l1 0 to $l0 
      /click left $CombStr $l1 
      /delay 4
      
      /autoinventory 

      :CleanDelay1
      /doevents
      /if $cursor()==TRUE /goto :CleanDelay1

   /next l1 

   /sendkey up shift 
   /press shift 
/return 

sub CountArraySize 
   /varset l0 0 
   :CountArrayLoop 
    /if n $strlen("$a($p0,$l0)")<=0 { 
       /goto :CountArrayEnd 
   } 
   /varadd l0 1 
   /goto :CountArrayLoop 
   :CountArrayEnd 
/return $l0 

Sub EndCombines 
   /call CleanPack 
   /cleanup 
   /endmacro 
/return 

Sub Event_FailedComb
  /varset cmbFailed 1
/return

Sub Event_SuccessComb
  /varset cmbSuccess 1
/return

Sub Event_TrivComb
  /varset cmbTrivial 1
/return

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Tue Sep 09, 2003 3:31 am

Code: Select all

varset a(1,27) "Part of Yaeth's Compendium Pg. 78 "
Extra space may cause problems, just casually looking at it.
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Tue Sep 09, 2003 5:50 am

Aren't there pages that can be made into more than one spell? Maybe I am not understanding the point of this macro :)

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

LoY Cultural Tailoring Swatch Scribing

Post by MacroFiend » Tue Sep 09, 2003 11:50 am

The macro isn't to make spells ... it is to make the swatches used in the LoY cultural tailoring.

Some of the research components used for the swatches are used in rare spells, so those were left out of the combine array.