Page 1 of 1

trying my first macro

Posted: Wed Sep 25, 2013 7:48 am
by WizeOne
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

Re: trying my first macro

Posted: Wed Sep 25, 2013 11:33 am
by dencelle

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!

Re: trying my first macro

Posted: Wed Sep 25, 2013 11:55 am
by WizeOne
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)

Re: trying my first macro

Posted: Thu Sep 26, 2013 3:38 am
by devNull
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)

Re: trying my first macro

Posted: Thu Sep 26, 2013 4:04 am
by WizeOne
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.

Re: trying my first macro

Posted: Thu Sep 26, 2013 11:05 am
by dencelle

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

Re: trying my first macro

Posted: Thu Sep 26, 2013 10:36 pm
by devNull
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.