help with cleaning this up

For questions regarding conversion of scripts from the old, parm style to the new MQ2Data format. Conversion questions only!

Moderator: MacroQuest Developers

elkcit
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Aug 31, 2002 3:20 pm

help with cleaning this up

Post by elkcit » Fri Apr 30, 2004 1:49 am

here is a macro that works, (based on the fishing macro in the depot many thanks for that nice code) but only if keep the bag with the fishing poles open on screen and can someone tell me how to get the finditem working so can avoid the cludgy loop?

i was using this in cobalt scar near the othmir pup at shore so can build begging at same time hehe

(edited for various minor bugs- and edited again to avoid un-needed turnings towards the NPC before begging))

Code: Select all

| - Fisher.mac - 
| MQ2Data and MQ2DataVars ready 
| Use with regular poles or a fisherman's companion in an inventory slot for this macro to work properly. 

#event PrimaryHand "You need to put your fishing pole in your primary hand." 
#event OutOfBait "You can't fish without fishing bait, go buy some." 
#event NeedPole "You can't fish without a fishing pole, go buy one." 
#event Skillup "You have become better at Begging"

Sub Main 
   /echo Starting up ${Macro} 
   /declare PoleToUse int outer
   /declare DAS int outer 
   /declare LC int outer 
   /declare DA[5] string outer 
   /varset DA[1] "Tattered Cloth Sandal" 
   /varset DA[2] "Rusty Dagger" 
   /varset DA[3] "Fish Scales" 
   /varset DA[4] "Dragon Bay" 
   /varset DA[5] "Fresh Fish" 
   /varset DAS 5 
   /varset LC 1 
   /varset PoleToUse 0 | This sets macro to various sources for poles, 
|                        Use 0 to use Fishing Pole
|                        Use 1 to use Fisherman's Companion

:Fish 
/if (${Cursor.ID}) /call ItemSub 
   /if (${Me.AbilityReady[Begging]}) {
       /target NPC
       /if (${Target.Distance.Precision[0]}>15) { 
          | if the lil bugger has run off to play look at him to bring him back
          /delay 2s  | wait a couple second in case we just cast our line, landsharks are a pain!
          /face
          /delay 2s  | and wait a couple seconds for him to get himself inrange
       }
       /doability Begging 
       /face heading 45  | and turn back to the water so we are ready to cast again
   }
   /if (${Cursor.ID}) /call ItemSub 
      /if (${Me.AbilityReady[Fishing]})  {
         /delay 1s
         /if (${Cursor.ID}) /call ItemSub  
         | just be sure we don't have anything on the cursor
         /doability Fishing 
|         /delay 1s
   }
   /doevents 
   /goto :Fish 
/return 

Sub ItemSub 
   /for LC 1 to ${DAS} 
      /if (${Cursor.Name.Find[${DA[${LC}]}]}) { 
         /drop 
         /delay 1s
         /return 
      } 
      /if (${LC}==${DAS}) { 
         /echo ----->  ${Cursor.Name} going into inventory
         /autoinv 
         /delay 1s
         /return 
      } 
   /next LC 
/return 

Sub GetPole(TypeofPole)
| By end of the sub there should be a pole of some kind on the cursor
| TypeofPole - 0 for regular pole, 1 for Fisherman's companion
   /declare iPack int local
   /declare iSlot int local
   /varset iPack 0
   /varset iSlot 0

   /if (${TypeofPole}==0) {
      /for iPack 1 to 8
         /for iSlot 1 to ${Me.Inventory[Pack${iPack}].Container}
            /if (${String[${Me.Inventory[Pack${iPack}].Item[${iSlot}].Name}].Equal[Fishing Pole]}) {
               /echo Found Fishing Pole in Pack ${iPack} Slot ${iSlot}
               /itemnotify ${Me.Inventory[Pack${iPack}].Item[${iSlot}].InvSlot} leftmouseup
               /delay 1s
               /goto :FoundItem
            }
         /next iSlot
      /next iPack
   } else  /if (${TypeofPole}==1) {
      /cast item "Fisherman's Companion" 
      /delay 11s 
      /goto :FoundItem
   }
   :NotFoundItem
   /echo No Way to equip a Fishing Pole
   /endmacro
   :FoundItem
/return

Sub Event_NeedPole 
   /call GetPole ${PoleToUse}
   /autoinv 
/return 

Sub Event_PrimaryHand 
   /call GetPole ${PoleToUse}
   /autoinv 
/return 

Sub Event_OutOfBait 
   /Echo Ran out of Bait. 
   /sit off 
   /sit on 
   /camp 
   /endmacro 
/return 

Sub Event_Skillup 
   /Echo Begging is now at ${Me.Skill[Begging]} 
/return 
Last edited by elkcit on Fri Apr 30, 2004 11:56 pm, edited 1 time in total.

User avatar
Dentist
*insert drilling noises here*
Posts: 52
Joined: Mon Jan 26, 2004 2:48 pm

Post by Dentist » Fri Apr 30, 2004 5:01 pm

Looking at the idea of your macro, you musn't forget to take into account that Begging can cause mobs to aggro on you.
Basically you would need to watch the macro to make sure you could kill the mob when it aggroed you, or have a class that can riposte the mob from the position it attacks somehow. Eitherway not foolproof :)

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Fri Apr 30, 2004 5:13 pm

Code: Select all

${FindItem[=Name].InvSlot.ID}
gives the slot number directly usuable by /itemnotify.

Code: Select all

    /varset PackNum ${InvSlot[${FindItem[=Name].InvSlot.ID}].Pack}    
    /varset SlotNum ${Math.Calc[${FindItem[=Name].InvSlot.Slot}+1]}
Gives the Packnum for opening that pack and the slot inside said pack that the item is located.

This what you are looking for?

Virtuoso65
a hill giant
a hill giant
Posts: 150
Joined: Wed Oct 15, 2003 2:29 pm

Post by Virtuoso65 » Fri Apr 30, 2004 7:34 pm

I am a bit confused as to why you would want to take poles out of your bag if you have a fishermans companion. When you /autoinv the newly summoned pole should go into your primary hand.

elkcit
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Aug 31, 2002 3:20 pm

Post by elkcit » Fri Apr 30, 2004 10:30 pm

first i am only 54 so not able to get a companion yet.. (grin otherwise i would use the macro from the Depot.. not trying to be sarcastic here btw thanks for that macro Virtuoso65 is what i based this on)

second the othmir pup is lvl 28 and i have good faction with them so chances exist that it could agro on me but they are fairly low... luckily lower than the chance of skillups begging from him hehe made 30 points almost last night..

about ${FindItem[=Name].InvSlot.ID} .. when i put Fishing Pole instead of Name the results are NULL.. regardless of if bags are open or closed (using the 04/29/04 16:34 release zip and compliled using VS6 with SP6) but i will double check the code i was using to be sure it matches your example...

oh and also the /itemnotify command gives unable to notify unless the window for that particular bag is open.. gonna add code to open the bag if not already open to be sure and avoid this.. of course once i can get a companion this will be moot, but am sure there are those who lower level who fish who still need the ability to use regular fishing poles etc..
Last edited by elkcit on Sat May 01, 2004 12:01 am, edited 1 time in total.

Garrik
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 18, 2003 4:04 pm

Post by Garrik » Fri Apr 30, 2004 11:59 pm

You can buy the fish bones for the quest at level 1 and get the companion.

elkcit
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Aug 31, 2002 3:20 pm

Post by elkcit » Sat May 01, 2004 12:02 am

you can? say what? i thought the items were no drop.. ARGH!!!! ok gonna go check bazaar lol

Virtuoso65
a hill giant
a hill giant
Posts: 150
Joined: Wed Oct 15, 2003 2:29 pm

Post by Virtuoso65 » Sat May 01, 2004 1:53 am

The bones are not nodrop and he will give you the quest at level 1.

Garrik
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 18, 2003 4:04 pm

Post by Garrik » Sat May 01, 2004 6:50 am

Remember to get 2 of each.

elkcit
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Aug 31, 2002 3:20 pm

Post by elkcit » Mon May 03, 2004 3:43 am

btw thanks got the companion now =) works wonderfully.. only ever ned to worry about buying biat.. unless there a bait item that never gets used up lol... think i gonna start using virtuoso's fishing macro stock now.. thanks for the input ans suggestions =) am sure will help me in future macros to have gone through this one