New to MQ, first project

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Odious
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Oct 06, 2003 5:07 am

New to MQ, first project

Post by Odious » Mon Oct 06, 2003 5:42 am

Well, I hope you are all doing well today.

I just wanted to say that the people on this board have way to much free time ;-) just like me we like to mess around within things to see what we can get it to do.

Well just a little background from me, I have dabbed in Basic, Pascal, C+, HTML, and a little J+, now I am not saying I know nearly as much as some of you do, but I do know a little, and want to learn more.

I have just made my first macro, its a very simple Macro I used to get some SPELL skills up, now I know most of you work on trade skill macros, or hunting macros, but playing a hybrid class sucks because if you don't use your spells (and even if you do) You are pretty much never up to par with your new spell levels and your fizzling your mind out.

Yes I know, this macro looks like crap :-)

Code: Select all

#turbo
Sub Main
   :Loop
      /if n $char(mana,cur)<20 /sit
      /if n $char(mana,cur)<20 /delay 3000
      /stand
      /if n $target(distance)>60 /sendkey down up
      /if n $target(distance)<40 /sendkey up up
      /face fast
      /delay 0
      /cast 8
      /delay 55
      /echo Current Mana $char(mana,cur)	
   /if "$target()"=="TRUE" /goto :Loop

/return
Now this code is really crude, and it could probably be cleaned up really easily, but I'm new at this, and finding the right commands within MQ is somewhat difficult. As you can see this macro will get close enough to your currently select target to cast spells on them if they are range spells, otherwise I don't think the target distance will matter if you have yourself targeted.

It casts the spell in gem 8, or slot 8. Then it delays... now you have to manually put in the delay time after the spell cast, and the delay time you want to med. I havn't figured out how to compare the $char(mana,cur) to $char(mana,max) and make the ajustments. Maybe someone can help? This might be useful if you want to combine this with something else (Maybe this is just useless? who knows)

Things I want to improve on

1. I want to be able to automatically adjust the spell delay by using the spell info winthin eq and calculating it for cast time and recast time.

2. I want this macro to check the cur mana to the max mana after you have gone oom and med to full mana and precede to cast intill oom again.

3. I noticed MQ macros won't run if eq is windowed and not being used. maybe eqw will fix it?

Lots to do, so little time.

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 » Mon Oct 06, 2003 6:57 am

$char(gem,"$char(gem,8)") will return -2 if the spell is memmed but not ready to cast, so I used that to wait until it's ready.

I removed your mana check in the beginning and added an event that triggers on the "Insufficient mana.." message and sits down until it has 100% mana.

Also, I'd try eqw, it works for me and I've heard others say the same thing.

Code: Select all

#turbo 
#event OutOfMana "Insufficient Mana to cast this spell!"

Sub Main 
   :Loop 
      /if n $target(distance)>60 /sendkey down up 
      /if n $target(distance)<40 /sendkey up up 
      /face fast 
      /delay 0 

      :WaitForSpellGem
          /delay 1
      /if n $char(gem,"$char(gem,8)")==-2 /goto :WaitForSpellGem

      /cast 8
      /doevents OutOfMana
      /echo Current Mana $char(mana,cur)    
   /if "$target()"=="TRUE" /goto :Loop 

/return 

Sub Event_OutOfMana
   /sit
   :MedLoop  
      /delay 1s
   /if n $char(mana,pct)<100 /goto :MedLoop
   /stand
/return

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Mon Oct 06, 2003 8:24 am

Try something along the lines of:

Code: Select all

Sub Main
  | make sure we are standing
  /stand
:CastLoop
  | cast the spell in question
  /cast "@Param0"

  | delay for the cast time
  /delay $spell("@Param0", casttime)
  | and then delay for the recast time
  /delay $spell("@Param0",recasttime)
 
  | check to see if we have enough mana to cast again
  | if not, sit and med to full
  /if n $char(mana,cur)<$spell("@Param0",mana) /call MedToFull
 
  | and cast again!
  /goto :CastLoop
/return

Sub MedToFull
  /sit
:MedLoop
  /delay 0
  /if n $char(mana,pct)<100 /goto :MedLoop
  /stand
/return

You would use this macro by passing in the name of the spell that you want to cast as a parameter to the macro. e.g. /macro pracspell "Minor Shielding". Don't forget the quotes around the spell name, especially for multi-word spells. This macro assumes that you have the spell memorized already and does not account for fizzling.

I wrote this at work and wasn't able to test it, also note that it will only work with a version of MQ with the new variable name changes.[/code]

Odious
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Oct 06, 2003 5:07 am

Post by Odious » Mon Oct 06, 2003 9:34 am

I have the newest version, and the new code works great, You guys really kick them out eh?

Lord Yei
orc pawn
orc pawn
Posts: 24
Joined: Mon Jan 27, 2003 9:48 am
Contact:

Here are some code snippets

Post by Lord Yei » Mon Oct 06, 2003 3:05 pm

I am currently working on a Mage hunting/grouping macro now and here are a few snippets that may help your casting mac

Code: Select all

| ============================================================== 
#define FizzleFlag          v62 

| used to echo debugging messages.  set to 1=1 if you want to see them, 0==1 if you dont 
#define DEBUG               1==1 

#event Fizzle            "Your spell fizzles!" 


Sub NoFizzleCast 
   | make sure we dont get passed a null spell name 
   /if "$p0"!="" { 
:NoFizzleCastStart 
      /varset FizzleFlag 0 
      | check to make sure we have mana to cast this spell 
      /if n $char(mana,cur)<$spell("$p0",mana) /goto :NoFizzleCastEnd 
       
      /cast "$p0" 
      /doevents Fizzle 
       
      | if we fizzled, try to cast again 
      /if n $FizzleFlag==1 /goto :NoFizzleCastStart 
   } 
:NoFizzleCastEnd 
/return 

Sub Event_Fizzle 
   /varset FizzleFlag 1 
/return

| ============================================================== 
And this is the Delay:

Code: Select all

| ============================================================== 
| check to see if we need to buff2 our pet 
      /if n $PetShieldStatus==0 { 
         /if DEBUG /echo Trying to cast "PetBuffSpell2". 
         /target id $char(pet) 
         /call NoFizzleCast "PetBuffSpell2" 
         /if DEBUG /echo Delay time is: $int($calc($spell("PetBuffSpell2",casttime)*10+5)) 
         /delay $int($calc($spell("PetBuffSpell2",casttime)*10+5)) 
         /varset PetShieldStatus 1 
         /goto :StartSpells 
      } 
| ============================================================== 
This comes from Scrime w/ some ideas borrowed from GrimJack

Hope this is helpful
Lord Yei -- Mage and Scholor
I think there is a world market for maybe five computers.
- [i]Thomas Watson, chairman of IBM, 1943.[/i]