Help on this macro

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Help on this macro

Post by seph_yaro » Thu Oct 16, 2003 7:56 pm

I'm trying to make a macro that checks if I am full hp when I, say, press a hotbutton, and if I'm not, uses my velious BP to heal to full.
This is what I have, I got what I do from looking at drag.mac, sits.mac, and info.mac... but it doesn't loop -

Code: Select all

#turbo
Sub Main
  /press i
  /if n $char(hp,pct)<100 /goto loop
:Loop
  /if n $char(hp,pct)<100
  /cast item "brigand's chestguard"
  /if n $char(hp,pct)=100 /goto end else /goto loop

:end
/endmacro
It's prolly something dumb, but this is my first attempted macro :(

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Oct 16, 2003 8:00 pm

You need a colon before the label like this:

Code: Select all

/goto :loop
Took me some time to get used to :)

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Oct 16, 2003 8:10 pm

I was a bit quick with my previous reply, I missed some other stuff.

Changed the /endmacro to /return. /return'ing from the main loop will end the macro.

Changed /if n $char(hp,pct)=100 to /if n $char(hp,pct)==100 (double ='s is the comparison operator).

Removed the /if statement in the loop and made the one outside the loop jump to :end if hp is full.

Code: Select all

#turbo 
Sub Main 
  /press i 
  /if n $char(hp,pct)==100 /goto :end

:Loop 
  /cast item "brigand's chestguard" 
  /if n $char(hp,pct)==100 /goto :end else /goto :loop 

:end 
/return

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Thu Oct 16, 2003 8:58 pm

you dont have to have inventory open for /cast item to work btw...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Thu Oct 16, 2003 9:08 pm

Thanks :)
I didn't know about the colon, or that inven didn't need to be open :)

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Thu Oct 16, 2003 9:12 pm

Justtried it, still doesn't loop

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Thu Oct 16, 2003 9:21 pm

Code: Select all

#turbo 
Sub Main 
  /press i 
  /if n $char(hp,pct)==100 /goto :end 

:Loop 
  /cast item "brigand's chestguard" 
  /if n $char(hp,pct)==100 /return
  /goto :loop 

:end
/return 

seph_yaro
a lesser mummy
a lesser mummy
Posts: 72
Joined: Sat Jul 26, 2003 1:12 pm

Post by seph_yaro » Thu Oct 16, 2003 10:31 pm

Thanks insanitywiz, that one works :)

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

Post by wassup » Fri Oct 17, 2003 12:47 am

Code: Select all

#turbo 
Sub Main 
  /press i
  :Loop
  /if n $char(hp,pct)==100 /goto :end 
    /cast item "brigand's chestguard" 
  /goto :loop 
:end 
/return