Help customizing an automacro for private messages.

All resolved question will be found here. It is recommended that you browse / search through this section first and see if your question has been answered before

Moderators: Moderators, Documentation Writers

Message
Author
Johan Liebert
Noob
Noob
Posts: 4
Joined: 11 Aug 2015, 08:40
Noob?: Yes

Help customizing an automacro for private messages.

#1 Post by Johan Liebert »

I recently found and installed a macro that checks for private messages below:

Code: Select all

automacro incoming_persomsg {
 console /From:/ #command to execute the automacro
 call {
 do play C:\WINDOWS\Media\alarm.wav #This sound will be played you can choose other sounds but they must be .wav!
 pause 1
 #im not turning the ai off cuz on a PM they mostly dont see you. of course you could add an ai off here too
 }
}
Note: I customized the .wav file. It's not inherent in Windows/Media.

However, right now I am trying to get support for a healing bot who pm's me it's coordinates every time it loses track of me. I'm trying to code in another line into the automacro to signal if console /From:/ but NOT if the console show /From: <botname>/.

I have tried putting in

Code: Select all

console not /From: botname/

Code: Select all

not console /From: botname/
and I've tried doing

Code: Select all

console /From:/ not console /From: botname/
to no avail.

Does anyone know how to get this to work to:
1. Allow for both "From: healingbot" msgs to appear in the console at the same time as "From: enemy" msgs from others and signal only for the others.
2. Have it not ignore pms from others that occur in the same timespan as my healing bots.

Help is greatly appreciated. I'm still very new with automacros.

P.S. I'm very sorry if this has been asked before or if I posted in the wrong location. I used the search engine and came up with nothing.

otaku
Human
Human
Posts: 28
Joined: 29 Nov 2013, 21:50
Noob?: No
Location: Brazil
Contact:

Re: Help customizing an automacro for private messages.

#2 Post by otaku »

There is not a "not" paramater to console. You could use something like this for the regex:

Code: Select all

/^From: (?!botname)/
But there are better ways than to use console. You don't wanna trigger it for everything that shows in the console. You just need for private messages. You could either use the "hook" or "pm" conditions. For example:

Using "hook":

Code: Select all

automacro example {
	hook packet_privMsg
	save MsgUser
	save Msg
	call {
		if ($.hooksave0 == botname) {
			log Ignoring...
		} else {
			log Do something.
			log The message is: $.hooksave1
		}
	}
}
Using "pm":

Code: Select all

automacro example {
	pm /.*/  # Doesn't matter the content
	call {
		if ($.lastpm == botname) {
			log Ignoring...
		} else {
			log Do something.
			log The message is: $.lastpmMsg
		}
	}
}
I didn't really test it, but it should work. You should read the Macro's documentation on the Wiki.
Last edited by otaku on 14 Aug 2015, 23:30, edited 2 times in total.
I'm watching my TV or is it watching me?

otaku
Human
Human
Posts: 28
Joined: 29 Nov 2013, 21:50
Noob?: No
Location: Brazil
Contact:

Re: Help customizing an automacro for private messages.

#3 Post by otaku »

<bugged double post...>
Last edited by otaku on 15 Aug 2015, 12:38, edited 1 time in total.
I'm watching my TV or is it watching me?

Johan Liebert
Noob
Noob
Posts: 4
Joined: 11 Aug 2015, 08:40
Noob?: Yes

Re: Help customizing an automacro for private messages.

#4 Post by Johan Liebert »

Thank you for the help, I'll look into the commands in that code. I tested it and it's working perfectly.
I was thinking I might get lucky and have it respond to boolean operators and got too optimistic lol.

Here's finished code for anyone else who doesn't want to have to substitute the parts:

Code: Select all

automacro Pmincoming { 
   pm /.*/ 
   call { 
      if ($.lastpm == botname) { #put botname here
         log Ignoring... 
      } else { 
         do play C:\WINDOWS\Media\tada.wav #put sound file you want here if you don't like this one. Must be .wav file! 
         pause 1 
         log The message is: $.lastpmMsg 
      } 
   } 
}
Thanks again for the help.

Locked