Beyond Simple Macro... Please help....

Have a macro idea but not sure where to start? Ask here.

Moderator: MacroQuest Developers

Lordsora
decaying skeleton
decaying skeleton
Posts: 4
Joined: Wed Nov 12, 2003 11:55 am

Beyond Simple Macro... Please help....

Post by Lordsora » Tue Aug 17, 2004 11:09 am

This is going to sound dumb and noobish but I need a very simple macro which will take no more than 2 min to make. Can someone please post a compelted macro that follows these guidelines....

AFK bot is a mage. If a tell is received by the mage saying "help" the mage will cast "Call of Hero" on whoever he is targetting. Checks for fizzles and recasts.

Thats all! Please don't flame me too bad :( . Thanks in advance!

User avatar
Kambic
a lesser mummy
a lesser mummy
Posts: 74
Joined: Fri May 28, 2004 11:48 am

Post by Kambic » Tue Aug 17, 2004 2:11 pm

This is probably the simplest of all macro's to write, while actually learning some stuff about coding.

I'm not going to write it for you, but I'll tell you how to write it. First of all, go RTFM and check out the section on custom events. Then you will want to set up the macro so that anytime someone sends him a tell with the word "help", he will target the person sending the tell, and then cast CotH. You will probably want to include spellcast.inc or spell_routines.inc, found in the Snippets forum.

This is not terribly difficult, and an amateur should be able to do it. I would highly look at some other macro's in the Macro Depot that make good use of the #event command.

Lordsora
decaying skeleton
decaying skeleton
Posts: 4
Joined: Wed Nov 12, 2003 11:55 am

Post by Lordsora » Tue Aug 17, 2004 2:18 pm

Thanks, I will have a look there. One thing that I do not understand is how to include the spellcast.inc.

Do I have to download it and put it in my macros or anything? And if I use that it will automatically check for fizzles and recast?? Thanks

Mimatas
a hill giant
a hill giant
Posts: 262
Joined: Wed Mar 10, 2004 4:22 pm

Post by Mimatas » Tue Aug 17, 2004 2:24 pm

yes.

Copy the code from the spellcast.inc thread and paste it into a file called spellcast.inc in your /macros directory.

Lordsora
decaying skeleton
decaying skeleton
Posts: 4
Joined: Wed Nov 12, 2003 11:55 am

Post by Lordsora » Tue Aug 17, 2004 2:29 pm

Would this work???

#include spellcast.ini
#event CoH "#1# tells you, '#2#'"
#event Join "#1# has joined your group."

Sub Main
:loop
/doevents
/delay 1s
/goto :loop
/return

Sub Event_CoH(string line, string who, string what)
/if (${what.Equal[MySecretPassword]}) {
/target ${who}
/delay 1s
/if (${Target.Name.Equal[${who}]}) {
/invite
}
}
/return

Sub Event_Join(string line, string who)
/target ${who}
/delay 1s
/if (${Target.Name.Equal[${who}]) {
/call cast Call of the Hero
/delay 12s
/disband
}
/return

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Tue Aug 17, 2004 5:38 pm

That looks at least 90% right :)

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Tue Aug 17, 2004 6:17 pm

1) Lords, put [ code ] ... [ /code ] tags (without the spaces) around all the code you post on the boards.

2) Couple untested suggestions:

Code: Select all

| Cothbot.mac

#include spellcast.inc
#define MySecretPassword <whatever you want it to be>

#event CoH "#1# tells you, '#2#'" 
#event Join "#1# has joined the group." 

Sub Main 
   /echo CotH Bot Active

   :loop 
      /doevents
      /delay 1 
   /goto :loop 

/endmacro

Sub Event_CoH(string line, string who, string what) 
   /if (${what.Find[MySecretPassword]}) { 
      /target ${who} 
      /delay 1
      /if (${Target.Name.Equal[${who}]}) /invite 
   } 
/return 

Sub Event_Join(string line, string who) 
   /target pc ${who}
   /delay 1 
   /if (${Target.Name.Equal[${who}]) { 
      /call cast Call of the Hero
      /delay 1
      /if (${Macro.Return.Equal[CAST_SUCCESS]}) /disband 
   } 
/return
Changes:
-1 used #define up top so you can set your secret password there, without having to dig through code.
-2 corrected your join event text.
-3 added the little echo up top to remind you when the bot is running.
-4 Shortened your delays. You will find MQ targets for you hella fast =)
-5 Took out the delay after casting CotH. SpellCast takes care of this for you.
-6 Added it a check to make sure Coth casted before disbanding the person.
-7 Indented for readability

Nice first macro. I hope my suggestions help, but I also think its good that you wrote it yourself first.

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

Post by SukMage » Tue Aug 17, 2004 8:48 pm

Ok I'm not very experienced in the writing of macros yet... but could he not:

Code: Select all

 /declare MySecretPassword int outer 
 /varset MySecretPassword ${Param0}
Then /mac cothbot <password>? I might be a bit off but those that write them more often could help me out a tad. This way you could change the password on the fly easily at the begining of the macro instead of going in and editing it when you want to change 'help' to 'coh me' or 'im-a-yoyo' or whatever.

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Tue Aug 17, 2004 9:00 pm

Sure, or he could put it in an ini file, or make it a global variable, or write a module to exchange pgp keys over an ssh session...how often do you REALLY need to change the password for this? :P

devestator
a ghoul
a ghoul
Posts: 121
Joined: Thu Feb 27, 2003 4:25 pm

Post by devestator » Wed Aug 18, 2004 10:13 am

I dont know the Macroquest language at all, havn't picked it up yet. But just from what I know about programming and scanning the code, it dosn't seem like the above will work for what he wants.

Code: Select all

| Cothbot.mac

#include spellcast.inc
#define MySecretPassword <whatever you want it to be>

#event CoH "#1# tells you, '#2#'"
#event Join "#1# has joined the group."

Sub Main
   /echo CotH Bot Active

   :loop
      /doevents
      /delay 1
   /goto :loop

/endmacro

Sub Event_CoH(string line, string who, string what)
   /if (${what.Find[MySecretPassword]}) {
      /target ${who}
      /delay 1
      /if (${Target.Name.Equal[${who}]}) /invite
   }
/return

Sub Event_Join(string line, string who)
   /target pc ${who}
   /delay 1
   /if (${Target.Name.Equal[${who}]) {
      /call cast Call of the Hero
      /delay 1
      /if (${Macro.Return.Equal[CAST_SUCCESS]}) /disband
   }
/return
Would this not first cast CoH on anyone who joins the group wether they ask or not and second if the person is already in the group and ask to be cohed, it would not work? Also the above code seems to assume the CoHer is also the anchor because it is inviting and disbanding members. In a normal situation we know this would not work without zone wide tageting, if the person is ok with using zonewide targeting (thus basically letting anyone and everyone paying attention know he is botting) then sure it'll work as long as the person is ungrouped when asking for coh =P

Mimatas
a hill giant
a hill giant
Posts: 262
Joined: Wed Mar 10, 2004 4:22 pm

Post by Mimatas » Wed Aug 18, 2004 11:52 am

No.

/doevents just checks to see if any of the events have happened. If they have, it will then call the specified function.

Basically, it will sit and wait until a tell happens. When a tell is sent with the correct password (or a string containing the correct password), the bot will invite the person who sent the tell. When the person accepts the invite, it will generate the "___ has joined the group". Once doevents is checked again, the Join event will fire, which will CoH them. Hopefully this explains it.

My question:

Code: Select all

${what.Find[MySecretPassword]} 
Shouldn't that be replaced with

${what.Equal[MySecretPassword]}

To ensure that the password must match exactly?

Lordsora
decaying skeleton
decaying skeleton
Posts: 4
Joined: Wed Nov 12, 2003 11:55 am

Post by Lordsora » Wed Aug 18, 2004 12:24 pm

Thanks everone for the help. I'm at work again so I can't test if any of the functions work yet. I wish I new more of the language so I could program some really nice stuff. Does any of the above code work? Has anyone tested it?

Mimatas
a hill giant
a hill giant
Posts: 262
Joined: Wed Mar 10, 2004 4:22 pm

Post by Mimatas » Wed Aug 18, 2004 1:03 pm

I do all my board trolling at work too... and I don't have a coth mage.

It looks like it should work, but they always do.. until they blow up cuz you forgot to add a space after the /if. *grin*