• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Hi ok seen this and ... (1 Viewer)

illslim

Member
Joined
Sep 21, 2005
RedCents
158¢
It has peeked my interested.


everdead said:
What are you trying to learn for C++ programming? Macros are not written in C++ they are all in macro language though it has similar nuiances(sp).


Now I been trying to learn how to read these macros, using C++ and C+ books I got.
What book or anything can I find that I can sit down and read till I can beat this into my head.
Like everdead says they are similiar. But all I can understand so far when looking at a mac is the basic idea of what something is doing.

Like in hunter mac I am still trying to get it modified to run in certain range cast a spell and go back to anchor.
I have found in other macs go to anchor but can not seem to merge the action into the programing.
So any help find materials to help understand the macro language used in making these macro's would be great. I would be thankful and redcenting my tush off.
 
To be honest, the best way to learn is to keep looking at examples. But...if you want a head start, here's a quote from my guide on MQing...

EQ data and MQ data is made available through a set of TLO's, or Top Level Objects. These are things like Me, NearestSpawn, etc. The TLO's available with the basic MQ are:

*


* AltAbility
* Bool
* Corpse
* Cursor
* Defined
* DisplayItem
* FindItem
* FindItemBank
* FindItemBankCount
* FindItemCount
* Float
* GameTime
* Ground
* Group
* Heading
* If
* Ini
* Int
* InvSlot
* LastSpawn
* LineOfSight
* Macro
* MacroQuest
* Math
* Me
* Merchant
* NearestSpawn
* Plugin
* Raid
* Select
* SelectedItem
* Skill
* Spawn
* SpawnCount
* Spell
* Switch
* Target
* Time
* Type
* Window
* Zone


To use these TLO's, you must "couch" them between brackets ( {TLO here} ) with a $ in front of the brackets. Example: ${Me}, ${Zone}, ${Spell}.

When dealing with MQ data, capitalization is EXTREMELY important. If I were to type ${Me}, I would get my name. But if I were to type ${ME} or ${mE}, I would get a "Null", or a message that there is no such TLO as ME or mE.

Every TLO has "access" to one or more "Data types". These data types would be specific piece of information that you wanted from the TLO. For example, ${Zone.ID}, or ${Me.Surname}. To find out what pieces of data you can find from each TLO, you must look at the MQ2 Wiki, because, to be honest, there is so much data available that I'd spend hours posting it over here. To find out what each TLO has available, go HERE and click on the name of the TLO, then look under the "Access to Types" section of the page. For example, the "Me" TLO has access to the "character" and "spawn" data types.
 
thez said:
To be honest, the best way to learn is to keep looking at examples.


Best advice ever. Start with simple macros. Look at what they do and how they do it. Then move up to more complex macros.

Also don't ask for help on MQ2 site forums. Most those people will flame hard over the simplest of things.
 
Thank you guys very much. I am in process of moving right now. So my comps are a part. It hurts to see my babies in pieces. They need to be alive and breathing hehe. Ok I owe some redcents. soon as I figure out why this comp I am using when I can will not let me redcent anyone. I owe you guys. Plus Mantis -- MQ2 boards, I use to go read them and try and pick up what I can but after 3 threads realized that
1 if you go there and do not read their rules in their house for their party you will be subject to their ways of life.
2 they are very highly inteligent as are you guys. Now I have grown up in pool rooms and bars since I was 5. I have traveled around and gamble with some of the greatest pool players/dart players/foosball players in the world. And all of them and I do mean all of them took the time and practice to get were they are. So they know without those steps you will not be great. But they forget the nice guy somewhere that helped them along their way to reach their goals.
So MQ borads I still browsed till the VIP thing went into effect. Now I hardly go there. I have gone through this site cut and pasted every macro I could find. Then printed out some took to work and sat there trying to digest it. I forgot when but one day I started understanding bits of stuff. Like I can alter a macro very slightly.
 
Well, if you need any help trying to figure out a macro, or even how a macro does something, feel free to post it and i'll go through it bit by bit, add comments to the commands so that you'll get the hang of how different things eventually gets everything done.
 
Ok well still do not have my comps together but...
I know this is the copy of hunter.mac I have.
It is from robdawg I do believe I got it off this site.

lets start at the beginning I guess.


|------------------------------------------------------------
|Loot Array Information.
|------------------------------------------------------------
/call ReadINI HunterMob.ini "${Zone.Name}" Mob
/if (!${Defined[RV_MobArray]}) {
/echo Mob Array Creation Error, ending macro...
/endmacro
}

I think this is a check to see if the toon will loot preset mobs in certain zones. It is telling the progam to check huntermob.ini for zone name in line 1.
2nd line I am lost. Sorry I did warn you my understanding of this language is simpleton at best.
So I would think it should check if mobs name is in .ini then it would check the mob for preset loot in the other .ini that you need for this mac.

But I do not see that if it is doing that. I see thought it has power to end the macro but do not know why it would end it. I know there is something I am missing here so please be gentle to me. I think maybe there is some code futher in the program that compliments this somehow. I just do not see how it seeks it out if it does. Or is this a check for the mob array in the .ini file?

Ok next piece and last for now do not wish to bother you guys to much.



|------------------------------------------------------------
|Variables that you don't need to worry about.
|------------------------------------------------------------
/declare RV_FailCounter int outer 0
/declare RV_MyTargetID int outer 0
/declare RV_MyTargetName string outer
/declare RV_MyTargetDead int outer 0
/declare RV_InvalidTargetID int outer 0
/declare RV_HasTarget int outer 0
/declare RV_RandomWait int outer 0
/declare RV_LootSlot int outer 0
/declare RV_CheckLook int outer 0
/declare RV_Fighting int outer 0
/declare RV_TargetDead int outer 0
/declare RV_MyXLOC int outer 0
/declare RV_MyYLOC int outer 0

/declare RV_FastRange int outer
/declare RV_RangeMax int outer
/declare RV_RangeMin int outer
/varcalc RV_FastRange ${RV_Range}+3
/varcalc RV_RangeMax ${RV_Range}+1
/varcalc RV_RangeMin ${RV_Range}-1

/declare MyXLOCA int outer 0
/declare MyYLOCA int outer 0
/declare BreakLoop int outer 0
/declare xDistance int outer 0

Ok it says you do not have to worry about them. But I would like to understand them. It has been a while since I played with c code but.
int is an interger I do believe if I recall right. Forgot outer but it is something.
Now I know these are declares that are used later in the program or throughout it. Well looking forward to your replies. Redcented the Z got this crappy comp I am on cleaned up was riddled with problems.
Soon will have my comp up and will start three boxing again. I am on Drinal been there since wow to long lol.

Well do enjoy this forum and the people who populate it. It is always a good read. Plus very helpful and filled with good info.
 
Okay, going to post the entire macro (well, my slightly modified version, but it works) for reference.

Rich (BB code):
| Hunter Macro
| Hunter.mac
| Author      : robdawg
| Version     : v1.2 2004-05-13 10:06pm PST
| Useage      : /macro Hunter
| Description : This macro will run your character around killing any mobs in your
|      RV_MobArray.  Then it will attempt to loot all items in your
|      RV_LootArray.  This is definitely a work in progress and I am sure
|      someone can think of plenty of upgrades for this.
|------------------------------------------------------------------------------------

#turbo 10
#include spell_routines.inc

Sub Main

   |------------------------------------------------------------
   |How many times should aquire target fail before delaying?
   |------------------------------------------------------------
   /declare RV_FailMax          int outer  3
   |------------------------------------------------------------
   |How far would you like to target a mob?
   |------------------------------------------------------------
   /declare RV_MaxRadius        int outer  3000
   |------------------------------------------------------------
   |How far is the combat range?
   |------------------------------------------------------------
   /declare RV_Range            int outer 10
   |------------------------------------------------------------
   |What is the minimum Z Value of mobs I should target?
   |------------------------------------------------------------
   /declare RV_MinZRange        int outer  -1000
   |------------------------------------------------------------
   |What is the maximum Z Value of mobs I should target?
   |------------------------------------------------------------
   /declare RV_MaxZRange        int outer  1000
   |------------------------------------------------------------
   |Should I loot all items?
   |------------------------------------------------------------
   /declare RV_LootAllItems     int outer  0
   |------------------------------------------------------------
   |Should I display stats?
   |------------------------------------------------------------
   /declare RV_DisplayStats     int outer  1

   |------------------------------------------------------------
   |Loot Array Information.
   |------------------------------------------------------------
   /call ReadINI HunterMob.ini "${Zone.Name}" Mob
   /if (!${Defined[RV_MobArray]}) {
      /echo Mob Array Creation Error, ending macro...
      /endmacro
   }

   |------------------------------------------------------------
   |Mob Array Information.
   |------------------------------------------------------------
   /call ReadINI HunterLoot.ini "${Zone.Name}" Loot
   /if (!${Defined[RV_LootArray]}) {
      /echo No Loot Array Created...
   }

   |------------------------------------------------------------
   |Variables that you don't need to worry about.
   |------------------------------------------------------------
   /declare RV_FailCounter      int outer  0
   /declare RV_MyTargetID       int outer  0
   /declare RV_MyTargetName     string outer
   /declare RV_MyTargetDead     int outer  0
   /declare RV_InvalidTargetID  int outer  0
   /declare RV_HasTarget        int outer  0
   /declare RV_RandomWait       int outer  0
   /declare RV_LootSlot         int outer  0
   /declare RV_CheckLook        int outer  0
   /declare RV_Fighting         int outer  0
   /declare RV_TargetDead       int outer  0
   /declare RV_MyXLOC           int outer  0
   /declare RV_MyYLOC           int outer  0
   
   /declare RV_FastRange        int outer
   /declare RV_RangeMax         int outer
   /declare RV_RangeMin         int outer
   /varcalc RV_FastRange ${RV_Range}+3
   /varcalc RV_RangeMax ${RV_Range}+1
   /varcalc RV_RangeMin ${RV_Range}-1

   :Start
   /doevents
   /call GMCheck
   /call Dead
   /call GetTarget

   :KillAdds
   /if (${RV_HasTarget}) /call MoveToMob
   /if (${RV_HasTarget}) /call CombatSub
   /if (${RV_HasTarget}) /call MoveToMob
   /if (${RV_HasTarget} && (${Defined[RV_LootArray]} || ${RV_LootAllItems})) /call LootMob
   /if (${RV_DisplayStats}) /call DisplayStats
   /call ResetSub

   /varset RV_RandomWait ${Math.Rand[5]}
   /varcalc RV_RandomWait ${RV_RandomWait}+1
   /echo Paranoia - Waiting ${RV_RandomWait} seconds before resuming
   /delay ${RV_RandomWait}s
   
   /if (${Target.ID}) {
      /echo Looks like something is attacking us, killing it...
      /delay 1s
      /varset RV_HasTarget 1
      /varset RV_Fighting 1
      /goto :KillAdds
   }
   
   /goto :Start
   
/return

|--------------------------------------------------------------------------------
|SUB: Aquire Target
|--------------------------------------------------------------------------------
Sub GetTarget

   /declare RV_CurrentRadius   int local
   /declare RV_TargetSub   int local
   :Acquire
   /for RV_CurrentRadius 100 to ${RV_MaxRadius} step 100
      /for RV_TargetSub 1 to ${RV_MobArray.Size}
         /squelch /target radius ${RV_CurrentRadius} nopcnear notid ${RV_InvalidTargetID} npc "${RV_MobArray[${RV_TargetSub}]}"
         /varset RV_MyTargetID ${Target.ID}
         /varset RV_MyTargetDead 0
         /if (${Target.ID}) {
            /if (${Int[${Target.PctHPs}]}<100) {
               /echo Mob NOT a Full Health, picking another...
               /varset RV_InvalidTargetID ${Target.ID}
               /call ResetSub
               /goto :Acquire
            }
            /if (${Int[${Target.Z}]}<${RV_MinZRange}) {
               /echo Mob is BELOW Min Z Range, picking another...
               /varset RV_InvalidTargetID ${Target.ID}
               /call ResetSub
               /goto :Acquire
            }
            /if (${Int[${Target.Z}]}>${RV_MaxZRange}) {
               /echo Mob is ABOVE Max Z Range, picking another...
               /varset RV_InvalidTargetID ${Target.ID}
               /call ResetSub
               /goto :Acquire
            }
            /varset RV_HasTarget 1
            /varset RV_MyTargetName ${Target.CleanName}
            /echo Acquired ${Target.CleanName} at range ${Int[${Target.Distance}]}
            /return
         }
      /next RV_TargetSub
      /delay 2
   /next RV_CurrentRadius

   /if (!${Target.ID}) {
      /delay 2s
      /varcalc RV_FailCounter ${RV_FailCounter}+1
      /echo Failed to Acquire Target in Range ${RV_MaxRadius} ${RV_FailCounter} Time(s)
      /if (${RV_FailCounter}>=${RV_FailMax}) {
         /echo Waiting for Respawns, Resetting Failure Counter...
         /delay 60s
         /varset RV_FailCounter 0
      }
      /goto :Acquire
   }
/return

|--------------------------------------------------------------------------------
|SUB: Moving
|--------------------------------------------------------------------------------
Sub MoveToMob

   /varset RV_MyXLOC ${Int[${Me.X}]}
   /varset RV_MyYLOC ${Int[${Me.Y}]}
   /declare RV_DistanceTimer timer 15
   
   /doevents
   
   :MovementLoop

   /if ((!${RV_Fighting})&&(!${RV_TargetDead})&&(${Target.PctHPs}<100)) {
      /echo Mob not at full health, picking another...
      /varset RV_InvalidTargetID ${Target.ID}
      /varset RV_HasTarget 0
      /call ResetSub
      /return
   }

   /if (${Target.ID}) {
      /face
   }
   /if (${Int[${Target.Distance}]}>${RV_FastRange}) {
      /keypress forward hold
   }
   /if (${Int[${Target.Distance}]}<${RV_FastRange}&&${Int[${Target.Distance}]}>${RV_RangeMax}) {
      /keypress forward
   }
   /if (${Int[${Target.Distance}]}<${RV_RangeMin}) {
      /keypress back
   }
   /if (!${RV_DistanceTimer}) {
      /if ((${RV_MyXLOC}==${Int[${Me.X}]})&&(${RV_MyYLOC}==${Int[${Me.Y}]})) /call HitObstacle
      /varset RV_MyXLOC ${Int[${Me.X}]}
      /varset RV_MyYLOC ${Int[${Me.Y}]}
      /varset RV_DistanceTimer 15
      /goto :Movementloop
   }
   /if (${Int[${Target.Distance}]}>${RV_FastRange}) /goto :MovementLoop

/return

|--------------------------------------------------------------------------------
|SUB: Combat
|--------------------------------------------------------------------------------
Sub CombatSub

   /echo Attacking Mob NOW!
   /varset RV_Fighting 1
   /varset RV_TargetDead 0
   /pet attack
   
   :CombatLoop
   /doevents
   /attack on
   
   
   /call MoveToMob
   /call SpecialIT

   /if (!${Target.ID}) {
      /attack off
      /keypress forward
      /keypress back
     
      /varset RV_TargetDead 1
      /varset RV_Fighting 0
      /delay 1s
      /target radius 30 corpse
      /delay 1s
      /if (!${Target.ID}) {
         /call ResetSub
         /return
      }
      /face
   }
   /if (!${RV_TargetDead}) {
      /goto :CombatLoop
   }
   
/return

|--------------------------------------------------------------------------------
|SUB: Special Combat
|--------------------------------------------------------------------------------
Sub SpecialIt

   /declare TempID    int inner  0

   /if ((${Target.Distance}<11)&&(${Me.AbilityReady["Bash"]})) /doability "Bash"
   
   /if ((${Int[${Me.PctHPs}]}<50)&&(${Me.Gem["Light of Nife"]})&&(${Me.SpellReady["Light of Nife"]})) {
      /varset TempID ${Target.ID}
      /keypress forward
      /keypress back
      /keypress F1
      /echo Casting Heal Spell because of low health...
      /cast "Light of Nife"
      /delay 3s
      /target id ${TempID}
   }
   
/return

|--------------------------------------------------------------------------------
|SUB: Looting
|--------------------------------------------------------------------------------
Sub LootMob

   /declare LootSlot    int inner  0
   /declare LootCheck   int inner  0
   /declare LootTotal   int inner  0
   
   /face
   
   /keypress forward
   /keypress back
   
   /fastdrop on
   /lootn never
   /delay 2s
   /loot
   /delay 2s
   /if (!${Corpse.Items}) {
      /echo NO LOOT! Cheap Bastard!
      /return
   }

   /varset LootTotal ${Corpse.Items}
   /for LootSlot 1 to ${LootTotal}
      /itemnotify loot${LootSlot} leftmouseup
      /delay 1s
      /if (${RV_LootAllItems}) {
         /echo Keeping a ${Cursor.Name}... WOOT!
         /autoinventory
         /delay 1s
      } else {
         /for LootCheck 1 to ${RV_LootArray.Size}
            /if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) {
               /echo Keeping a ${Cursor.Name}... WOOT!
               /varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1
               /autoinventory
               /delay 1s
            }
         /next LootCheck
      }
      /if (${Cursor.ID}) {
         /echo Destroying a ${Cursor.Name}...
         /destroy
         /delay 1s
      }
   /next LootSlot
   
   /notify LootWnd DoneButton leftmouseup
   /delay 2
   
/return

|--------------------------------------------------------------------------------
|SUB: Reset
|--------------------------------------------------------------------------------
Sub ResetSub

   /keypress esc
   /keypress esc
   /keypress esc
   /keypress esc
   
   /varset RV_HasTarget 0
   /varset RV_TargetDead 0
   /varset RV_Fighting 0
   
/return

|--------------------------------------------------------------------------------
|SUB: Obstacle Avoidance
|--------------------------------------------------------------------------------
Sub HitObstacle

   /echo Obstacle hit, moving around it...
   /keypress forward
   /keypress back hold
   /delay 3
   /keypress back
   /if (${Math.Rand[100]}+1>50) {
     /keypress strafe_right hold
   } else {
     /keypress strafe_left hold
   }
   /delay 5
   /keypress strafe_right
   /keypress strafe_left
   /keypress forward hold
   
/return

|--------------------------------------------------------------------------------
|SUB: GM Check
|--------------------------------------------------------------------------------
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

|--------------------------------------------------------------------------------
|SUB: Reading from an INI File
|--------------------------------------------------------------------------------
Sub ReadINI(FileName,SectionName,ArrayType)

   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}...
   /delay 1s
   
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) {
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro...
      /delay 1s
      /return
   }
   /declare nValues     int local  1
   /declare nArray      int local  0
   /declare KeySet      string local  ${Ini[${FileName},${SectionName}]}

   :CounterLoop
   /if (${String[${Ini[${FileName},${SectionName},${ArrayType}${nValues}]}].Equal[null]}) {
      /varcalc nValues ${nValues}-1
      /goto :MakeArray
   }
   /varcalc nValues ${nValues}+1
   /goto :CounterLoop 

   :MakeArray
   /if (!${nValues}) /return
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) {
      /echo Declaring Mob Array...
      /declare RV_MobArray[${nValues}]   string outer
      /declare RV_MobStats[${nValues}]   string outer
   }
   /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) {
      /echo Declaring Loot Array...
      /declare RV_LootArray[${nValues}]  string outer
      /declare RV_LootStats[${nValues}]  string outer
   }
   /for nArray 1 to ${nValues}
      /if (${FileName.Equal["HunterMob.ini"]}) {
         /varset RV_MobArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
         /varset RV_MobStats[${nArray}] 0
      }
      /if (${FileName.Equal["HunterLoot.ini"]}) {
         /varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
         /varset RV_LootStats[${nArray}] 0
      }
   /next nArray
   
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}...
   /delay 1s
   
/return

|--------------------------------------------------------------------------------
|SUB: Display Stats
|--------------------------------------------------------------------------------
Sub DisplayStats

   /declare nArray  int local
   
   /if (${Defined[RV_LootArray]}) {
      /for nArray 1 to ${RV_LootArray.Size}
         /echo ${Int[${RV_LootStats[${nArray}]}]} ${RV_LootArray[${nArray}]}'s
      /next nArray
   }
   
/return

Sub Dead
/if (${String[${Zone.ShortName}].Find["Tranquility"]}>0) {
		/delay 5s
		/echo You died, WTG . . .
		/camp desktop
		/endmac
		}
		
/return
 
Or we could not paste snippets of this and that, and say "Read the manual written specifically for this program, and how to write anything macro-wise

www.macroquest2.com
And C++ code books won't help you much for macros. They'll help with plugins for sure. For macros the only thing that is really the same is the structure.
 
Alrighty. So the first section you have question on:

|------------------------------------------------------------
|Loot Array Information.
|------------------------------------------------------------
/call ReadINI HunterMob.ini "${Zone.Name}" Mob
/if (!${Defined[RV_MobArray]}) {
/echo Mob Array Creation Error, ending macro...
/endmacro
}

Okay. So I'm going to deal with the second line first.

Rich (BB code):
/if (!${Defined[RV_MobArray]}) {

The /if is obvious. Now comes the fun part. In the MQ2 scripting language, ${}, with stuff inside the {}, means that you are accessing data that MQ2 has made available. MQ2 replaces the stuff inside with values.

For every "/if" statement, you need to have the determing factor (the value, true or false, that determines what the statement will do) in parentheses (). Within those parentheses is your statement. If you do /if (${}), then that means that "If your statement is true, do this". If you do /if (!${}), then that means that "If your statement is not true, do this". The ! means false, or wrong, etc., while the lack means true.

So now, here's what's happening. The line is trying to determine if the variable "RV_MobArray" (which is the name defined earlier in the macro, then later assigned a value) has actually been defined. If it has, then the INI file has been read correctly, and the macro can continue. If it hasn't, then something went wrong with the INI file, and the macro won't run correctly.

So now we go back to the first line. When it does the "/call ReadINI", we travel down to "Sub ReadINI" to see what happens. What ReadINI does is take the data from the INI file, and make it available to macro by saving it as "strings", or lines of text that MQ holds in its memory. And wait! Lo and behold...in our Sub ReadINI, we find:
Rich (BB code):
      /declare RV_MobArray[${nValues}]   string outer

Ignore the nValues for now. The important thing is that when the INI is read successfully, RV_MobArray is defined.

Okay, so the [${nValues}] means that RV_MobArray is being saved as an array. Think of an array like a "table", or a spreadsheet...with a bunch of values saved under RV_MobArray, that can be accessed like this: "RV_MobArray[3]", etc.
 
Mochila, if you aren't going to be helpful, then just ignore this thread. I'm willing to teach anyone who really tries to learn, since this shit is complicated for a beginner.

Now, on to the second part of your question.

Rich (BB code):
|------------------------------------------------------------
|Variables that you don't need to worry about.
|------------------------------------------------------------
/declare RV_FailCounter int outer 0
/declare RV_MyTargetID int outer 0
/declare RV_MyTargetName string outer
/declare RV_MyTargetDead int outer 0
/declare RV_InvalidTargetID int outer 0
/declare RV_HasTarget int outer 0
/declare RV_RandomWait int outer 0
/declare RV_LootSlot int outer 0
/declare RV_CheckLook int outer 0
/declare RV_Fighting int outer 0
/declare RV_TargetDead int outer 0
/declare RV_MyXLOC int outer 0
/declare RV_MyYLOC int outer 0

/declare RV_FastRange int outer
/declare RV_RangeMax int outer
/declare RV_RangeMin int outer
/varcalc RV_FastRange ${RV_Range}+3
/varcalc RV_RangeMax ${RV_Range}+1
/varcalc RV_RangeMin ${RV_Range}-1

/declare MyXLOCA int outer 0
/declare MyYLOCA int outer 0
/declare BreakLoop int outer 0
/declare xDistance int outer 0

These are all variables that the macro uses within itself to automate usage. You really *don't* need to worry about them. But if you want to figure out what they do, then search through the macro for them. Just look for ${RV_RangeMin}, ${RV_RangeMax}, etc, and see how the macro uses them, changes their values, and reacts them.
 
First off, learn C++ programming, it'll help you possibly in real life as well as in making macros. A lot of people learn html/web "programming" without knowing how to program, that is possible because you're basically telling the computer what to put and where to put it. When it comes to writing macros, you have to learn how a computer thinks.

One example is, it would be easy to teach you how to hunt an npc, (not all of it is code)...

Rich (BB code):
| this first part will target an npc and run to it
:begin
/target npc next
:loop1
/face
/keypress forward hold
if (Target.Range > 15) /goto :loop1

| stop running
/keypress back 
// now the pc is within 15 of you, so face it, turn attack on, kick until he dies =b
/attack on
/stick 15
:checkdead
/if (${String[${Target}].Find["corpse"]}>1) /goto :begin
/delay 5s
/goto :checkdead

So this will look for the closest npc, go to it, attack it until it's dead, then repeat. I hope you understand the code. The last bit checks to see if your target has "corpse" somewhere in its name, if so the macro assumes the npc is dead and moves onto a new one...

It has some glaring problems. First, someone else can be already killing it, second of all, if it's a static mob, and there is a rock directly between you and it, chances are you get stuck in an endless loop running to it... so now you have to worry about collision detection, other players, what if you get attacked otw there, what if you're low on health, how to loot etc etc..

So I encourage you to learn c++ and use this as motivation. You may be making some decent money as a structural welder or making nothin at mcdonalds, and then find that you enjoy this stuff so much that you become a programmer!
 
Just have to realize that a computer will read from top down in your code, and if there is no way to get back to the top, it will terminate at the end.

Some functions only need to be run once, and are still considered a macro.

Organize your code into very specific Subs (Sub routines) in the main body of the code. That way if you want to perform a function, all you have to do is /call (subsname).

When the Sub is done running, it will return to the next line after the /call line in the original code. Sort of like a detour on a road, that eventually leads to the same spot.

Learning from snippets of code is great, and the variables macroquest2 uses are inherently logical. The best way to get an idea of whats what though is to do this:

1. Imagine what you need your code to do. Simple smith combines? Or hunt in a dangerous area with ledges that aren't friendly?

2. Now that you have an idea of what you need to do, think code wise how it *might* be done. Use your logic. Mq2 can accomplish a hell of a lot. Your logic will almost always giving you a coding solution...though it may not be the easiest one :)

3. Look to see if any of those variables exist or how they might have to be sued . (Sort of tedious but easier using the Ctrl+F feature on Mozilla Firefox..on the Macroquest2.com manual section.

4. Even if you don't understand the variables usage or how to setup comparisons or checks between them, now you have a gist of what to look for...heading, health, mana, whatever.

5. Rip off other peoples code, or see if there is something coded already for it, that you can just tweak. Should be easier to do this now that you know command names and variable names to look for. MQ2's website has code for nearly every situation.

6. Last thing....splice it together, and betatest. MQ2 tells you what line it receives an error on, so just go back and look at that line. Compare it to other code you found and see if you're missing something from a bracket, parenetheses , capitlization, and equal sign..whatever.


PS: Wheres my precompile thez? Whats taking so long !
 
Hi ok seen this and ...

Users who are viewing this thread

Back
Top