trying my first macro

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

Moderator: MacroQuest Developers

WizeOne
a hill giant
a hill giant
Posts: 207
Joined: Tue Jul 12, 2005 12:36 pm

trying my first macro

Post by WizeOne » Wed Sep 25, 2013 7:48 am

Hello guys-n-gals,

i am finally trying to write my first macro and i seem to be failing at that and searching 8( .
if any kind soul could point me in the right direction it would be greatly appreciated.
i am trying to match by charname and the script fails.

Code: Select all

| MyBot by WizeOne
| ver 0.01
| 9/25/13

#event Invite           "#1# invites you to join a group."


 Sub Main
   /echo MyBot Loaded
   :mainloop
   /doevents
   /goto :mainloop
 /return
 
 Sub Event_Invite(string Line, string Inviter)
   /echo ${Inviter} invited me!
   /if ((${Inviter} != "thischar") || (${Inviter} != "thatchar")) {
   /disband
   /echo declined invite from ${Inviter}
  } else {
   /invite
  }
 /return
it gives me:
"Unparsable in Calculation: 't'
mybot.mac@17
failed to parse /if condition '((charinviter != "thischar") || (charinviter != "thatchar"))', non-numeric encountered.


any tips or pointers?
Thanks,
WizeOne

dencelle
orc pawn
orc pawn
Posts: 10
Joined: Sat May 24, 2008 3:12 pm

Re: trying my first macro

Post by dencelle » Wed Sep 25, 2013 11:33 am

Code: Select all


| MyBot by WizeOne
| ver 0.02
| 9/25/13

#event Invite           "#1# invites you to join a group."


Sub Main
   /echo MyBot Loaded
   :mainloop
   /doevents
   /goto :mainloop
/return

Sub Event_Invite(string Line, string Inviter)
   /echo ${Inviter} invited me!
   /if ((${Inviter.Equal[ThisChar]}) || (${Inviter.Equal[ThatChar]})) {
   /disband
   /echo declined invite from ${Inviter}
  } else {
   /invite
  }
/return
Line 17

Code: Select all

--   /if ((${Inviter} != "thischar") || (${Inviter} != "thatchar")) {
++   /if ((${Inviter.Equal[ThisChar]}) || (${Inviter.Equal[ThatChar]})) {

Reference: http://www.macroquest2.com/includes/was ... #refstring


GJ on your first attempt... Keep at it!

WizeOne
a hill giant
a hill giant
Posts: 207
Joined: Tue Jul 12, 2005 12:36 pm

Re: trying my first macro

Post by WizeOne » Wed Sep 25, 2013 11:55 am

Thank you dencelle for your assistance. just had to change the /invite and /disband lines but that works now 8)

now to see what other headaches i can make 8)

devNull
a ghoul
a ghoul
Posts: 121
Joined: Sat Mar 06, 2004 3:57 am

Re: trying my first macro

Post by devNull » Thu Sep 26, 2013 3:38 am

WizeOne wrote:just had to change the /invite and /disband lines
Just for reference, you could have also done:

/if ((${Inviter.NotEqual[ThisChar]}) || (${Inviter.NotEqual[ThatChar]})) {

or

/if ((!${Inviter.Equal[ThisChar]}) || (!${Inviter.Equal[ThatChar]})) {

But, I really think you mean to use AND and not OR.

if ( inviter != thischar && inviter != thatchar)

WizeOne
a hill giant
a hill giant
Posts: 207
Joined: Tue Jul 12, 2005 12:36 pm

Re: trying my first macro

Post by WizeOne » Thu Sep 26, 2013 4:04 am

devNull wrote:
WizeOne wrote:just had to change the /invite and /disband lines
Just for reference, you could have also done:

/if ((${Inviter.NotEqual[ThisChar]}) || (${Inviter.NotEqual[ThatChar]})) {

or

/if ((!${Inviter.Equal[ThisChar]}) || (!${Inviter.Equal[ThatChar]})) {

But, I really think you mean to use AND and not OR.

if ( inviter != thischar && inviter != thatchar)
pretty sure it would need to be an OR.

if chara or charb invite then ok.

if it was an AND it would have to match both right?
if chara and charb invite then ok.

starting to think i should figure out how to make a bot-master list.

basically starting simple like this to determine who can control it and then allow it to continue if they are authorized.

dencelle
orc pawn
orc pawn
Posts: 10
Joined: Sat May 24, 2008 3:12 pm

Re: trying my first macro

Post by dencelle » Thu Sep 26, 2013 11:05 am

Code: Select all


| MyBot by WizeOne
| ver 0.02
| 9/25/13

#event Invite           "#1# invites you to join a group."


Sub Main
   /echo MyBot Loaded
   :mainloop
   /doevents
   /goto :mainloop
/return

Sub Event_Invite(string Line, string Inviter)
   /echo ${Inviter} invited me!
   /if (${Select[${Inviter},Char1,Char2,Char3,Char4,Char5]}) {
   /invite
     } else {
   /disband
/echo declined invite from ${Inviter}
  }
/return
Line 17
--/if ((${Inviter.Equal[ThisChar]}) || (${Inviter.Equal[ThatChar]})) {
++ /if (${Select[${Inviter},Char1,Char2,Char3,Char4,Char5]}) {

also switched out the invite and disband for you since i didn't notice they were backwards ether >.<

check this out!: http://www.macroquest2.com/includes/was ... #tloselect

devNull
a ghoul
a ghoul
Posts: 121
Joined: Sat Mar 06, 2004 3:57 am

Re: trying my first macro

Post by devNull » Thu Sep 26, 2013 10:36 pm

WizeOne wrote:
devNull wrote:
WizeOne wrote:just had to change the /invite and /disband lines
Just for reference, you could have also done:

/if ((${Inviter.NotEqual[ThisChar]}) || (${Inviter.NotEqual[ThatChar]})) {

or

/if ((!${Inviter.Equal[ThisChar]}) || (!${Inviter.Equal[ThatChar]})) {

But, I really think you mean to use AND and not OR.

if ( inviter != thischar && inviter != thatchar)
pretty sure it would need to be an OR.

if chara or charb invite then ok.

if it was an AND it would have to match both right?
if chara and charb invite then ok.

starting to think i should figure out how to make a bot-master list.

basically starting simple like this to determine who can control it and then allow it to continue if they are authorized.
Your original code was using not equal. If each condition is a not equal, then you need AND, otherwise if the first one is true (inviter != charA) the IF conditional will always be true regardless of the 2nd condition and you will always /disband.