Can't get this to keep going. What is wrong?

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

The_Sage
orc pawn
orc pawn
Posts: 11
Joined: Wed Oct 30, 2002 5:23 am

Can't get this to keep going. What is wrong?

Post by The_Sage » Wed Dec 18, 2002 2:00 am

Why is this only enchanting ONE bar...then stopping?

Code: Select all

|Enchant Platinum Bars
|EnchantPlat.mac
|Author: The Sage
|Description: Should be obvious BUT...It enchants platinum and auto-equips it.
|Usage "/macro EnchantPlat.mac

#include routines.mac
#Event OOM "Insufficient Mana to cast this spell!"
#Event BMB "Buy More Bars!"

Sub Main
	
/finditem "Platinum Bar"
	/if $find()==FALSE /echo "Buy More Bars!"
	/if $cursor()==TRUE /click left auto
	/goto :Enchant

:Enchant
	
	/cleanup
	/stand
	/cast 8
		/delay 75
	/click left auto
		/delay 23
	/return

Sub Event_OOM
	/cleanup
	/press i
	/sit
		/delay 180s
	/stand
/return

Sub Event_BMB
	/endmacro

/return
New code...Loops...but skips the OOM event. I know why too its because of the /goto :Start at the end of Sub Enchant. Problem is I dunno how to get it to loop without that..otherwise i am stuck with the problem named above..it enchants one and stops.

Code: Select all

|Enchant Platinum Bars
|EnchantPlat.mac
|Author: The Sage
|Description: Should be obvious BUT...It enchants platinum and auto-equips it.
|Usage "/macro EnchantPlat.mac

#include routines.mac
#Event OOM "Insufficient Mana to cast this spell!"
|#Event BMB "Buy More Bars!"

Sub Main
	
:Start
/finditem "Platinum Bar"
|/if $find()==FALSE /echo "Buy More Bars!"
	/if $cursor()==TRUE /click left auto
	/goto :Enchant

:Enchant
	/cleanup
	/stand
	/cast 8
		/echo Debug 1
		/delay 75
	/click left auto
		/delay 23
	/echo Debug 2
	/goto :Start
/return

Sub Event_OOM
	/cleanup
	/press i
	/sit
		/delay 180s
	/stand
/return

...

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Wed Dec 18, 2002 4:38 am

you need to put a /doevents inside the loop, maybe before /cleanup. The doevents command tells MQ to process any events that may have been triggered.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

lifewolf
a ghoul
a ghoul
Posts: 143
Joined: Fri Oct 18, 2002 6:29 pm

Post by lifewolf » Thu Dec 19, 2002 10:41 am

I'd fix it for you but im at school and dont have the manual and am tired.. so tired.. so nah sorry...

hint though set up the main loop like

:PlatCall
/doevent EncantPlat
/doevent OOM
/doevents flush
/goto :PlatCall

Has to streighten things out some

lifewolf
a ghoul
a ghoul
Posts: 143
Joined: Fri Oct 18, 2002 6:29 pm

Re: Can't get this to keep going. What is wrong?

Post by lifewolf » Thu Dec 19, 2002 10:56 am

Oh nevermind, iv got nothing better to do

Should work

Code: Select all


|Usage "/macro EnchantPlat.mac

|#include routines.mac
#Event OOM "Insufficient Mana to cast this spell!"

Sub Main
:Loop
   /varset l0 0  | [0/1] I had to med, dont wait for enchant/Inv drop of enchanted.
   /cleanup
   /finditem "Platinum Bar"
   /if $find()==FALSE { 
      /echo "Buy More Bars!"
      /goto :End
   }
   /if $cursor()==TRUE {
      /click left auto
      /cleanup
      /stand
      /cast 8
      /doevents
|     /echo Debug -1- 
      /if n $l0>0 /goto :Loop
      /delay 7.5s
      /click left auto
      /delay 2.3s
|     /echo Debug -2-
   }
   /goto :Loop
:End

/return

Sub Event_OOM
   /varset l0 1
   /cleanup
   /press i
   /sit
   /delay 3m
   /stand
/return