My first (half) macro, would love comments/suggestions :)

Need help running MacroQuest 1? Too bad! Use MQ2.

Moderator: MacroQuest Developers

skysurf
a lesser mummy
a lesser mummy
Posts: 52
Joined: Fri Aug 15, 2003 1:54 am

My first (half) macro, would love comments/suggestions :)

Post by skysurf » Thu Aug 28, 2003 1:56 am

This is my first attempt at making my own macro. I started with what I "thought" was a simple idea. Just put a batwing, and a frosting in a spit and combine them.

What I have so far took me about 3 hours.

I started getting tangled up when it came to getting the ingredients and putting them in the spit.

Anyway, if anyone would be willing to spend 5 minutes looking it over and makeing comments/suggestion, I sure would appreciate it. :)

NO LAUGHING! :wink:

And here is the masterpiece:

Code: Select all

|This is just a simple practicemacro that "hopefully" will take batwings and frosting
|and put them in a spit in inv7 of your inventory, then click combine, and continue
|until you run out of eaither ingredient.  It will then end.
|Bag 7 in inventory is spit



#define InvPacks v1
#define Ingredient1 v2 "Batwing"
#define Ingredient2 v3 "Frosting"



Sub MAIN

/call ClearKeys
/call OpenPacks
/call CheckInventory
/Call GetIngredient

|===============================================
|Makes sure that these keys aren't still down from a previous macro
Sub ClearKeys
	/press CTRL
	/press shift
	/press alt
/return	

|===============================================
|Cleans up screen by closing everything, then opening inventory and all bags.
Sub OpenPacks 
  
    /press esc
    /press esc
    /press esc
    /press i
    /for $v1 0 to 7
    /if $pack ($v1,open) !=TRUE /click right inv $v1
    /next $v1
/return
|===============================================
|Checks Inventory to make sure needed components are there.  Ends macro if they are not.
Sub CheckInventory  

	/if n $count ($v2)==0
	/if n $count ($v3)==0
	/endmacro  
|===============================================   
|Picks up each ingredient and places it in your spit in inv7
Sub GetIngredient
	/sendkey down ctrl
	/finditem "$v2" 
	
{Bah, this is as far as I could get in one night.  I have a bunch of macro's in front
of me that have ways to get an item and put it in a set bag, but they use $p0 and $p1 and 
I don't understand what those are, or how you define them or anything.  Learning how to place
items in a specified pack and then click combine will be my project for tommorow.}

Sky

edit: Valerian likes code brackets

boredom
a lesser mummy
a lesser mummy
Posts: 49
Joined: Thu Jun 19, 2003 3:45 pm

Post by boredom » Thu Aug 28, 2003 9:56 am

Code: Select all

#define InvPacks v1
#define Ingredient1 v2 "Batwing"
#define Ingredient2 v3 "Frosting"
#defining a name to a variable can not be mixed with assigning that variable a value. these #defines are only used so that we have a human friendly name to use for the variables rather than v2, v77 . . . You don't have to do this if you can remember that v59 stores the value for your next heal and v13 is your combat status. To assign a vallue to a variable -

Code: Select all

#define Ingredient1 v2
and somewhere in a function -

Code: Select all

/varset Ingredient1 "Batwing"

Code: Select all

Sub MAIN

/call ClearKeys
/call OpenPacks
/call CheckInventory
/Call GetIngredient
also, all subs must end with a

Code: Select all

/return
/Bored

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Re: My first (half) macro, would love comments/suggestions :

Post by wassup » Thu Aug 28, 2003 1:27 pm

Code: Select all

|===============================================
|Cleans up screen by closing everything, then opening inventory and all bags.
Sub OpenPacks 
  
    /press esc
    /press esc
    /press esc
    /press i
    /for $v1 0 to 7
    /if $pack ($v1,open) !=TRUE /click right inv $v1
    /next $v1
/return
That space between$pack and ( and between ($v1,open) and != will cause problems.

Code: Select all

/if $pack($v1,open)!=TRUE /click right inv $v1
/if statements can act strange sometimes, so I always try to nest multiple /if statements, also no space in $count between the t and the (.

Code: Select all

|===============================================
|Checks Inventory to make sure needed components are there.  Ends macro if they are not.
Sub CheckInventory  

    /if n $count($v2)==0 {
        /if n $count($v3)==0 {
            /endmacro 
        }
    }
|===============================================
You also might need to add in some /delay statements to keep the server synched with the client.