looping check

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Riven
a lesser mummy
a lesser mummy
Posts: 68
Joined: Sat Jan 31, 2004 12:14 pm
Location: Missouri

looping check

Post by Riven » Sat Aug 07, 2004 7:47 pm

Well im at a lost and im turning to you all. Im makeing a macro to buy and sell and make a item. But im haveing a bit of trouble with a part of it. First im cant seem to get this statement to work.

Code: Select all

/if (${FindItemCount[${Chain jointingl}]}<=10) /goto :Done
I looking for this statement to search my inventory for a certian item and if it has 10 of then to do somthing. that just being an example.

heres part of my macro that im makeing and i just want it to do a check and then make a certain number of items. Forsome reason it just does one and then stops.

Code: Select all

#include move.inc 
#include Travel.inc 
#Event busy "Someone else is using that#*#" 
#Event nomore "#*#you don't have everything you need for this recipe#*#" 
#Event DoneLoading "#*#You have entered#*#" 
Sub Main 

/deletevar finish 
/deletevar failure 
/deletevar busy 
/deletevar LoadingBit 
/deletevar NumberToMakeAtATime 
/declare finish int global 
/declare failure int global 
/declare busy int global 
/declare LoadingBit int global 
/declare NumberToMakeAtATime int global 
/varset failure 0 
/varset finish 0 
/varset busy 0 
/varset LoadingBit 0 

|--- Set the number of Chain Jointing to make at a time ---| 
/varset NumberToMakeAtATime 10 
|------------------------------------------------ 
/echo Making ${NumberToMakeAtATime} Chain Jointing at a time 
/call OpenForge
/return




|------------------------------------------------
Sub OpenForge 
/echo Combineing Items to Make Forged Pick 
:Forge 
/itemtarget forge 
/face fast nolook 
/click left item 
/delay 2s 
   /if (!${Window[TradeskillWnd].Open}) { 
      /echo Someone is using the Forge waiting 10seconds then trying again 
      /delay 10s 
      /goto :Forge 
   } 
/notify COMBW_RecipeListArea COMBW_RecipeList listselect ${Window[COMBW_RecipeListArea].Child[COMBW_RecipeList].List[=Chain Jointing]} 

:CombineLoop 
/notify COMBW_CombineArea COMBW_CombineButton leftmouseup 
/delay 5 
/autoinventory 
/doevents 
/if (${finish}==1) { 
   /varset finish 0 
   /return 
} 
/goto :CombineLoop 
/delay 15 
/keypress esc 
/delay 5 
/keypress esc 
/return 


|============================================= 
Sub Event_busy 
/varset busy 1 
/return 
|============================================= 
Sub Event_nomore 
/varset finish 1 
/return 
|============================================= 

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Sat Aug 07, 2004 10:08 pm

I looking for this statement to search my inventory for a certian item and if it has 10 of then to do somthing.
${stuff} always indicates an MQ2 data variable. Unless you have "Chain jointingl" defined somewhere, they syntax you probably want is.

Code: Select all

${FindItemCount[chain jointing]}
The rest of your /if seems ok

Why all the global variables? They're not being used outside of the macro (I wouldn't think) so all you're doing is making extra work as you /deletevar them all.


Code: Select all

:CombineLoop 
/notify COMBW_CombineArea COMBW_CombineButton leftmouseup 
/delay 5 
/autoinventory 
/doevents 
/if (${finish}==1) { 
   /varset finish 0 
   /return 
} 
/goto :CombineLoop 
/delay 15 
/keypress esc 
/delay 5 
/keypress esc 
/return 
You know the code after the /goto will never be reached, right?

Riven
a lesser mummy
a lesser mummy
Posts: 68
Joined: Sat Jan 31, 2004 12:14 pm
Location: Missouri

thanks

Post by Riven » Sun Aug 08, 2004 10:09 am

Thanks for the help, just before you posted i found the error causeing it not towork.

That was just part of the macro you were seeing. the macro im makeing is kinda of the afk kind. Didnt want to post all of it.