pile of crap loosely based on a pile of shit

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

Xathullu
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jan 30, 2011 10:13 pm

pile of crap loosely based on a pile of shit

Post by Xathullu » Tue Feb 08, 2011 1:41 pm

So I'm working on my first macro here and I have no training in this so I'm doing it all from info that ive gathered from forums and google so bare with me. (my googlefu is strong so don't assume I can't RTFM!)
I know that my two basic problems are A that I don't know what I'm doing and that B im trying to cut and paste a macro that should be based heavily on VIP plugins that I dont have access to. Because I do not have access to them I'm trying to use the built-in stuff that came with fresh compile. So its rather difficult. I'm sure thats why ppl have made those VIP plugins but atm, I wish to learn to do this stuff myself before I try to get VIP access. It would be pointless if I'm still this lost. Anywho here is the nasty macro "code" that Ive managed to piece together.

Code: Select all

#turbo
Sub Main
/declare FollowWho string outer
/if (!${Target.ID}) {
   /echo You must select a target to follow
   /return
}
/varset FollowWho ${Target.Name}
/echo Following ${FollowWho}
   :Loop
      /if (${Target.Distance}>35) /keypress up hold
      /if (${Target.Distance}<30) /keypress up
      /face fast
      /delay 2
   /if (${Target.ID} && ${Target.Name.Equal[${FollowWho}]}) /goto :Loop
   /keypress down
/return
   |------------------------------------------------------------ 
   |How far is the combat range? 
   |------------------------------------------------------------ 
   /declare RV_Range            int outer 10 
   |------------------------------------------------------------ 
   |Should I loot all items? 
   |------------------------------------------------------------ 
   /declare RV_LootAllItems     int outer  1
   |------------------------------------------------------------ 
   |Loot Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterLoot.ini "${Zone.Name}" Loot 
   /if (!${Defined[RV_LootArray]}) { 
      /echo No Loot Array Created... 
|-------------------------------------------------------------------------------- 
|SUB: Combat 
|-------------------------------------------------------------------------------- 
Sub CombatSub 
	/declare targID			int local 0
   /echo Attacking Mob NOW! 
   /varset RV_Fighting 1 
   /varset RV_TargetDead 0 
    
   :CombatLoop 
   /doevents 
   /attack on

   
    
   /call MoveToMob 
   /call SpecialIT 

	 /if (${targID} && ${Spawn[${targID}].Type.Equal[Corpse]}) {
	 	/if (${Target.ID}!=${targID}) {
	 		/squelch /target ID ${targID}
	 		/delay 1s ${Target.ID}==${targID}
	 	}
    /attack off 
    /keypress forward 
    /keypress back 
    
    /varset RV_TargetDead 1 
    /varset RV_Fighting 0 
    /delay 1s 

	 	/face fast
	/return	 	
	 }
   /if (!${Target.ID} || ${Target.Type.NotEqual[NPC]} ) { 
      /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 fast 
   } else {
   	/varset targID ${Target.ID}
  }
   /if (!${RV_TargetDead}) { 
      /goto :CombatLoop 
   } 
/return
|-------------------------------------------------------------------------------- 
|SUB: Special Combat 
|-------------------------------------------------------------------------------- 
Sub SpecialIt 

/return 
 
|-------------------------------------------------------------------------------- 
|SUB: Looting 
|-------------------------------------------------------------------------------- 
Sub LootMob 
   /declare LootSlot    int inner  0 
   /declare LootCheck   int inner  0 
   /declare LootTotal   int inner  0 
 
   /face fast 
 
   /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.Equal[${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: 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 (!${KeySet.Arg[${nValues},|].Length}) { 
      /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 
It doesn't work. Obviously. I suspect it is for two reasons, 1 there is a good chance that the looting stuff might be based on moveutils. I know that moveutils is VIP but ive found some stuff on google that would let me compile it but because Im not VIP and cant ask for help with it Ive chosen to avoid moveutils. My other suspicion is that I'm just a newb and dont know to put this stuff in order.
I know that flames are inevitable and when I read this post it makes no sense to me and it probably wont make sense to you, but someone out there might have tiny ray of insight that could lead me to a new and more successful avenue...

toomanynames
a grimling bloodguard
a grimling bloodguard
Posts: 1844
Joined: Mon Apr 11, 2005 11:10 am

Re: pile of crap loosely based on a pile of shit

Post by toomanynames » Tue Feb 08, 2011 1:54 pm

VIP is only like 30 bucks, just saying . . .

/teehee
Last edited by toomanynames on Thu Feb 10, 2011 12:49 pm, edited 2 times in total.
[quote="DKAA"]You cant. Only the server knows.[/quote]

Xathullu
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jan 30, 2011 10:13 pm

Re: pile of crap loosely based on a pile of shit

Post by Xathullu » Tue Feb 08, 2011 2:47 pm

sweet i thought they wanted more than that. VIP here I come!!!

dewey2461
Contributing Member
Contributing Member
Posts: 1759
Joined: Sun Apr 17, 2005 1:53 am

Re: pile of crap loosely based on a pile of shit

Post by dewey2461 » Tue Feb 08, 2011 11:42 pm

I didn't read the whole code block but when you ask a question you should provide at least the following things.

#1. Start with what it is the code SHOULD do. Quick glance says its got some loot code and some move code so its probably a farming type macro but who knows.

#2. Explain what the code *IS* doing that you don't want, or *IS NOT* doing that you do want.

#3. If you want folks to test it and it requires an ini file like this might ... ( based on the sub ReadINI ) you should provide the data your using.

Now I'd like to say hats off for taking the time to learn how to read/write your own macros. Read the whole manual from start to finish at least once. Even if you don't understand it, its good to have at least seen it once.

Then pick a simple macro you like. Sprinkle it with debugging using lines like /echo At line 13 , or /echo nValues = ${nValues} until you get a feel for the flow of the code. Programming is like a learning a language. It takes time and practice.

Good luck!

caj
a hill giant
a hill giant
Posts: 244
Joined: Tue Sep 12, 2006 9:35 am

Re: pile of crap loosely based on a pile of shit

Post by caj » Wed Feb 09, 2011 8:14 pm

i thought i reconized part of that macro. Something a guy named Robdawg did in the hayday of eq/mq2.

viewtopic.php?f=43&t=7135&hilit=robdawg

IMHO, if you want to learn how to write a macro. get vip first and then reseach/search for a macro that fits your needs. Play around with it, adjust it to your needs and before you know it your learning a new skill set that cant be used any place else but here. :mrgreen:

Jastur
a lesser mummy
a lesser mummy
Posts: 39
Joined: Sun Apr 23, 2006 4:55 pm
Location: Rhode Island

Re: pile of crap loosely based on a pile of shit

Post by Jastur » Fri Feb 11, 2011 4:28 pm

caj wrote: IMHO, if you want to learn how to write a macro. get vip first and then research/search for a macro that fits your needs. Play around with it, adjust it to your needs and before you know it your learning a new skill set that cant be used any place else but here. :mrgreen:
I wouldn't say that it can't be used anywhere else. The syntax and implementation might only work with macroquest, but one also learns the basics of scripting and how to take a problem and divide it into several smaller problems in order to effectively create a solution to said problem. These are skills that can be applied anywhere scripting is used. Additionally, you'll learn some about troubleshooting which is valuable in many fields. Might as well have some fun while you learn new things.

Xathullu
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jan 30, 2011 10:13 pm

Re: pile of crap loosely based on a pile of shit

Post by Xathullu » Sun Feb 13, 2011 10:06 pm

I appreciate the positive feed back...