combine two macro's to make one, How to>

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

Moderator: MacroQuest Developers

User avatar
unknownerrors
a ghoul
a ghoul
Posts: 133
Joined: Tue Oct 12, 2004 7:00 am
Location: Las vegas USA

combine two macro's to make one, How to>

Post by unknownerrors » Sat Feb 05, 2005 9:12 pm

hello, i'm attempting to make a new macro from two current works by others, at first i was thinking maybe i can just paste one into the other and blamO its done yay,.. but no. only the first runs. this is no good.

so if any one could tell me how this is done so that in the furure i can do it myself, you would make me a happy bard, or at lest give some info on where to find out how to do it.

the 2 macro's are here.

macro A:

Code: Select all

| - twist.mac -
|
| Modified from Colonel's Macro by ml2517
|
| Modified to current form 5/3/2004
|
|  Combat Twist Order (Optional) --+   <- If you don't feed it a second
|  NonCombat Twist Order -----+    |      spell set it works with just
|                             |    |      one set.
| Usage:                      v    v
|           /macro twist.mac ### [###]
| # represents the spell gem number you'd like to sing
|
| Example:
| /macro twist.mac 4567 123456
| /macro twist.mac 123458


Sub Main(NonCombatGems,CombatGems)
    /if (!${Defined[NonCombatGems]}) /endmacro

|
|  Variable Declarations
|
    /declare CombatCurSong int outer
    /declare NonCombatCurSong int outer
    /declare NNonCombatSongs int outer
    /declare NCombatSongs int outer
    /declare NonCombatSongList string outer
    /declare CombatSongList string outer
    /declare TwistI int outer
    /declare DynamicBuffer int outer
    /declare NonCombatSongArray[30] int outer
    /declare CombatSongArray[30] int outer

|
|  Timer Declarations
|
    /declare SingTime timer outer


    /varset CombatCurSong 1
    /varset NonCombatCurSong 1
    /varset NNonCombatSongs ${Int[${String[${NonCombatGems}].Length}]}
    /if (${Defined[CombatGems]}) /varset NCombatSongs ${Int[${String[${CombatGems}].Length}]}
    /varset NonCombatSongList ${NonCombatGems}
    /if (${Defined[CombatGems]}) /varset CombatSongList ${CombatGems}
    /varset DynamicBuffer 5

    /for TwistI 1 to ${NNonCombatSongs}
        /varset NonCombatSongArray[${TwistI}] ${String["${NonCombatSongList}"].Mid[${TwistI},1]}
    /next TwistI

    /if (${Defined[CombatGems]}) {
        /for TwistI 1 to ${NCombatSongs}
            /varset CombatSongArray[${TwistI}] ${String["${CombatSongList}"].Mid[${TwistI},1]}
        /next TwistI
    }
    :Loop
    /if (${Me.Standing}) {
        /if (${Defined[CombatGems]}) /if (${Me.Combat}) /call CombatSing ${CombatSongArray[${CombatCurSong}]}
        /if ((!${Me.Combat})||(!${Defined[CombatGems]})) /call NonCombatSing ${NonCombatSongArray[${NonCombatCurSong}]}
    }
   /if (${Me.State.Equal["DUCK"]}) /keypress DUCK
   /if (!${Me.Standing}) /stand
   /goto :Loop
/return


Sub CombatSing(Song)
     /declare Buffer int local
     /declare Duration int local
     /varset Duration 0
 
  :CombatSing1
    /call CheckSong ${Song}
    /varset Duration ${Macro.Return}
    /varset SingTime 30
    /varset Buffer 0   
    /cast "${Me.Gem[${Song}]}"
  :CombatSing2
    /delay 1
    /if (${Me.Casting.ID}) {
        /if (${SingTime}<=0) /goto :CombatSingBreak
        /goto :CombatSing2
    }
    :CombatSingBreak
    /if (${SingTime}>0) /goto :CombatSing1
    /if (${Duration}==0) {
        /delay ${DynamicBuffer}
        /stopsong
    } else {
      :CombatSing3
        /varcalc Buffer ${Buffer}+1
        /delay 1
        /if (${Buffer}>8) {
        /stopsong
        /goto :CombatSing1
        }
        /if ((!${Me.Song["${Me.Gem[${Song}]}"].ID})&&(!${Me.Buff["${Me.Gem[${Song}]}"].ID})) /goto :CombatSing3
        /if ((${Me.Song["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})&&(${Me.Buff["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})) /goto :CombatSing3
        /varset DynamicBuffer ${Buffer}
        /stopsong
    }
|    /echo Dynamic Buffer: ${DynamicBuffer}
    /varcalc CombatCurSong ${CombatCurSong}+1
    /if (${CombatCurSong}>${NCombatSongs}) /varset CombatCurSong 1
/return


Sub NonCombatSing(Song)
     /declare Buffer int local
     /declare Duration int local
     /varset Duration 0
 
  :NonCombatSing1
    /call CheckSong ${Song}
    /varset Duration ${Macro.Return}
    /varset SingTime 30
    /varset Buffer 0   
    /cast "${Me.Gem[${Song}]}"
  :NonCombatSing2
    /delay 1
    /if (${Me.Casting.ID}) {
        /if (${SingTime}<=0) /goto :NonCombatSingBreak
        /goto :NonCombatSing2
    }
    :NonCombatSingBreak
    /if (${SingTime}>0) /goto :NonCombatSing1
    /if (${Duration}==0) {
        /delay ${DynamicBuffer}
        /stopsong
    } else {
      :NonCombatSing3
        /varcalc Buffer ${Buffer}+1
        /delay 1
        /if (${Buffer}>8) {
        /stopsong
        /goto :NonCombatSing1
        }
        /if ((!${Me.Song["${Me.Gem[${Song}]}"].ID})&&(!${Me.Buff["${Me.Gem[${Song}]}"].ID})) /goto :NonCombatSing3
        /if ((${Me.Song["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})&&(${Me.Buff["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})) /goto :NonCombatSing3
        /varset DynamicBuffer ${Buffer}
        /stopsong
    }
|    /echo Dynamic Buffer: ${DynamicBuffer}
    /varcalc NonCombatCurSong ${NonCombatCurSong}+1
    /if (${NonCombatCurSong}>${NNonCombatSongs}) /varset NonCombatCurSong 1
/return

Sub CheckSong(GemNumber)
/if (${Me.Gem[${GemNumber}].SpellType.Find["Beneficial"]}) {
    /if (${Me.Gem[${GemNumber}].TargetType.Find["Group"]} || ${Me.Gem[${GemNumber}].TargetType.Find["Self"]} || ${Me.Gem[${GemNumber}].TargetType.Find["PC"]}) {
        /if ((${Me.Gem[${GemNumber}].Name.Equal[Cassindra`s Chant of Clarity]}) || (${Me.Gem[${GemNumber}].Name.Equal[Cassindra's Chorus of Clarity]})) {
            /return 3
        }
        /return ${Me.Gem[${GemNumber}].Duration}
    } else {
        /return 0
    }
} else {
    /return 0
}
/return
macro B

Code: Select all

| - fluffychant.mac - By Fluffy
#event GetTar "You must first select a target for this spell!"
#Event Exp       "#*#You gain#*#experience#*#"
|#event Died       "You have entered"

#turbo 10

Sub Main()
/declare Exper int outer
/declare AAExp int outer
/declare LDExp float outer ${Me.PctGroupLeaderExp}
/declare AAAExp float outer ${Me.PctAAExp}
/declare Exp float outer ${Me.PctExp}

/varset Exper ${Me.Exp}
/varset AAExp ${Me.AAExp}

/echo Fluffy's Chant Kite Macro

:Loop

/doevents
/if (!${Target.ID}) {
|No target get one
  /echo No target, getting one!
  /call GetTarget
  }
 
/if (${Target.Distance}>150) {
  /echo Target Warped... Getting a new target; id was ${Target.ID}
  /call GetTarget
  /delay 2
}

/goto :Loop
:Done
echo Fluffy's Chant Kite Macro Completed
/return

Sub Event_Exp
  /call Exp
/return

Sub Exp
   /varset AAExp ${Math.Calc[${Me.AAExp}-${AAExp}]}
   /varset Exper ${Math.Calc[${Me.Exp}-${Exper}]}

   /echo **      EXP: ${Exper}:${Me.PctExp}% - AAXP: ${AAExp}:${Me.AAExp}% - ${Math.Calc[${Macro.RunTime}/60]} minutes

   /varset Exper ${Me.Exp}
   /varset AAExp ${Me.AAExp}

  | More information
  |- Ignore leadership experience event triggers (redundant trigger)
  /if (${Line.Find[leadership]}) /return
  |- Experience calculation and reporting
  /echo ** XP-Delta: REG (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%)
  /varset LDExp ${Me.PctGroupLeaderExp}
  /varset AAAExp ${Me.PctAAExp}
  /varset Exp ${Me.PctExp}

/return

Sub Event_GetTar
  /call GetTarget
/return


Sub GetTarget
/target ID ${NearestSpawn[2, npc].ID}
/if (${Target.ID}) {
  /echo Found one!
  }

/return 
thanks

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Sat Feb 05, 2005 11:43 pm

So, what you are asking for is for someone here to show you how to make this into an AFK macro.

Shall I start selling popcorn now?
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

eqjoe
a grimling bloodguard
a grimling bloodguard
Posts: 984
Joined: Sat Sep 28, 2002 12:26 pm

Post by eqjoe » Sun Feb 06, 2005 12:45 am

There is no easy way to do what you want. You need to learn how to write macros. Its not that hard, really. If you can't figure out how to write your own macros, well, maybe you are too stupid to use MQ2.

If you are not too stupid to use MQ2, prove it. Figure out what you want to do and work on it. You will find that its easier to ask for help when you are helping yourself.

Your choice. Step up or get lost.

-j

EDIT: wtf? no spell checker!!
Last edited by eqjoe on Sun Feb 06, 2005 12:49 pm, edited 2 times in total.

Zeus
a hill giant
a hill giant
Posts: 180
Joined: Wed Feb 19, 2003 10:03 am
Contact:

Post by Zeus » Sun Feb 06, 2005 10:43 am

Go read up (a lot) about the basics of programming and then ask again after you understand what the code actually does.

Devious_D
a lesser mummy
a lesser mummy
Posts: 30
Joined: Wed Jan 05, 2005 2:59 pm

Re: combine two macro's to make one, How to>

Post by Devious_D » Tue Feb 08, 2005 3:38 pm

unknownerrors wrote:...at first I was thinking maybe I can just paste one into the other and blamO its done, but no, only the first runs. This is no good.
Well, I am still very much an amateur at this, but it sounds like you just pasted one mac at the end of the other mac. Even I know that wouldn't work. While I do not know for certain exactly how to do what you are asking, I do have one suggestion based on a little common sense. At least that should start you down the correct path. Trial and error can probably get you closer to the point where you can ask intelligent questions here after you have more specific questions.

My suggestion, based more on common sense than knowledge about MQ2 mind you, is simply to group similar tasks together where they belong. First I would suggest that you group all the "#Event..." items in the same place, before the Sub Main. Next, I would suggest you put all the general "/declare" and "/varset" text together within the Sub Main along with all the Subs which you call in the macro. Finally, I would suggest you group all the "Sub Event_" actions at the end of the macro where they belong. Maybe this will fix your problem, and maybe it wont, but it will get you closer than just pasting all the code from macro B at the end of all the text from Macro A.

If you try this and it still doesnt work, obviously I am wrong. Oh well, I tried. Better to try some things yourself and fail than to sit around waiting to be spoon-fed all the info you want. You cannot learn by having others do everything for you, and you will never be self-sufficient without learning.

Think of it like reading a book. If the writer arranged his sentences and paragraphs in a seemingly random fasion, it would make the book very difficult for you to read. The idea here is similar, keep things in a logical order from start to finish. If you refer to a variable at the start of a macro that isnt defined until the middle of the macro, of course it will not run correctly.

One last piece of advice; if this is in fact an AFK macro, you may be better off just not asking for help. I have only been a part of this community for a short while, mostly watching and trying to learn so far. From what I have seen, when you ask for help with things like AFK macros, you will usually be met with little to no help if you are lucky, and some serious insults if you are not so lucky.

User avatar
unknownerrors
a ghoul
a ghoul
Posts: 133
Joined: Tue Oct 12, 2004 7:00 am
Location: Las vegas USA

thnak you.

Post by unknownerrors » Wed Feb 09, 2005 1:04 am

thank you for the reply i was looking for, wasn't really looking for the spoon feed data, i want to be able to make macro's for myself, this information will can in handy in the future for just that reason. i have made a number of attempts at RTFM, but when i Ctrl F for a large number of things i come up emepty handed as to what their role in a macro are. is this its very own lang. or can i find resources in other places for this type of code? maybe a book? or a good online resource that explains each coomand and it Var's in detail as to what they do? and the way it should be formated (such as the grouping)

again thank you, i found a work around for making this macro for the time being, just installed the bard twist pluggin instead of using the macro version. luckily MQ will run more then one pluggin at a time just not more then one macro. so i cut out macro A now i only use Macro B, along a pluggin to run me in a nice circle the size of my choosing all awhile twisting my 70 DoTs. on target after target. i sit here and watch it while i attempt to learn the macro code on my other box, Never Never EVER afk.. that would just be stupid, bring heat on my accounts and on you fine people for making this godly app work.

thanks again

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Feb 09, 2005 6:33 am

Best way to learn is to find some of the easier to understand macros. Very simple ones and go through them line by line and seeing how they work.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

User avatar
SukMage
a ghoul
a ghoul
Posts: 88
Joined: Fri Jun 04, 2004 5:08 pm

Post by SukMage » Wed Feb 09, 2005 4:29 pm

Another thing is that you can't have 2 SubMain... Think of SubMain as the preface of the book... SubSing, SubAttack, SubLoot would be kinda like chapters or at least paragraphs. Can you effectively read 2 books at once? Hope that analogy helps a little. That's how I started writing my macros. You set the scene (events) then tell what's going to happen.

I'm going to look for something to kill.
I found something to kill.
I'm going to kill it.
This is how I'm going to kill it.
I'm going to loot it.
I'm going to sing happy songs to heal me up.
I'm going to look for something to kill..........

eqjoe
a grimling bloodguard
a grimling bloodguard
Posts: 984
Joined: Sat Sep 28, 2002 12:26 pm

Post by eqjoe » Wed Feb 09, 2005 8:25 pm

Look at the macros that are already written. Tons of good info there....


-j

User avatar
Fuergrissa
a grimling bloodguard
a grimling bloodguard
Posts: 607
Joined: Mon Dec 08, 2003 3:46 pm
Location: UK

Post by Fuergrissa » Thu Feb 10, 2005 4:38 am

I would recommend you use the plugin MQ2Twist and use the second macro as is.
[quote]"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."[/quote]

User avatar
unknownerrors
a ghoul
a ghoul
Posts: 133
Joined: Tue Oct 12, 2004 7:00 am
Location: Las vegas USA

yep.

Post by unknownerrors » Thu Feb 10, 2005 10:16 am

thats what i did.

instead of posting a whole new topic, if i wanted to make use of a sub such as

Code: Select all

Sub GMCheck

   /if (${Spawn[gm].ID}) {
      /beep
      /beep
      /beep
     
      /echo GM has entered the zone!
      /echo FUCK HIM but ending the macro...

      /keypress forward
      /keypress back

      /quit
      /endmacro
   }
   
/return
pulled from the nice hunter.mac btw. but instead of calling
/keypress forward
/keypress back

/quit
/endmacro
just unloading macroquest all together, would be my goal. so i'm going to remove /endmacro and replace with /unload ? problem is there not really much of a way i can test to ensure its working because of the lack of GM's these days, but just in case i would like to have that safe faulted into my macro's. also the /quit .. is that the same as /q'ing in normal chat, just going to log me compeletly out?

ok now i want to make this GM check a stand alone macro for my bots. with a delay of about 120 seconds, so every 2 minutes the macro will check for a GM in zone loop or quit MQ2 and logout me out if need be.

also does macroquest work with eqEMU? that would be a great testing ground.
Last edited by unknownerrors on Thu Feb 10, 2005 10:57 am, edited 1 time in total.

ztrike
a ghoul
a ghoul
Posts: 83
Joined: Fri Mar 26, 2004 1:17 pm
Contact:

Post by ztrike » Thu Feb 10, 2005 10:30 am

also does macroquest work with eqEMU?
Yes,

Just make sure you have the correct ver. of MQ... havent seen any EMU serveres using the newest eq.exe
Ztrike out

User avatar
unknownerrors
a ghoul
a ghoul
Posts: 133
Joined: Tue Oct 12, 2004 7:00 am
Location: Las vegas USA

sweet !

Post by unknownerrors » Thu Feb 10, 2005 11:00 am

nice, i'll work on getting a testing ground of EMU running and have free raine to screw up as badly as i can with out fear. this works nicely.
may our enemys shed tears of crimson apon the field of battle.
- vicious, of cowboybeop

everyone is a potential enemy, everywhere is a potential battlefield.
-zensunni wisdom, of Dune.

lastly - I'll be your huckleberry
-Doc Holliday
webmaster of:
http://unknownerrors.net
http://insideeq.com
http://alphapirates.com
http://reviewthis.info

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Feb 10, 2005 12:39 pm

One problem with the GM indicator is that by the time you "see" one it is very likely, too late now. Quite some time back they made a change that allows them to watch the game without logging in at a character; sort of a remote viewing thing.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

User avatar
unknownerrors
a ghoul
a ghoul
Posts: 133
Joined: Tue Oct 12, 2004 7:00 am
Location: Las vegas USA

sneaky little bastages.

Post by unknownerrors » Thu Feb 10, 2005 10:04 pm

so since the GM check doesn't really help all that much, let me explain the way my botting works.

i live with two other gammers, who each have two toons. we each work differant hours, so when ones at work one of the other is maning the exp grind for all of us though the bards swarming. when one of the other gets home he takes over while we try and get some sleep in before our next work day, so effectively our toons are logged in grinding though MQ2 24-7, in theroy. we give it 8 hour breaks here and there for bar time, on days off. every 15 minutes or so we have to end the macro, pluggins ect, to pull another swarm, but i am becomming more and more worried that we maybe taking advantage of this too much. what would be considered a reasonable amount of time to leave the toons up macroing? again this isn't afk macroing, and if it were it would be no more then about 15 minutes at a time.
may our enemys shed tears of crimson apon the field of battle.
- vicious, of cowboybeop

everyone is a potential enemy, everywhere is a potential battlefield.
-zensunni wisdom, of Dune.

lastly - I'll be your huckleberry
-Doc Holliday
webmaster of:
http://unknownerrors.net
http://insideeq.com
http://alphapirates.com
http://reviewthis.info