Promoting better communication between master and slave...

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

catcity
Noob
Noob
Posts: 18
Joined: 20 Oct 2012, 14:31
Noob?: No

Promoting better communication between master and slave...

#1 Post by catcity »

Hi all,

I'm hoping someone can help me with this. In the effort of trying to promote better communication between the master bot and the slave bot (in order that they stop acting so weird when things happen) I've been trying to put together what I think is a simple automacro; except for the fact that I can't seem to get certain aspects of it to trigger.

So here's the situation:

Master bot ports back to town to restock on pots; slave bot goes crazy saying "Lost my master!" and starts walking back to town. Master bot, having finished buying pots makes his way back to the lockmap and meets up with the slave about half way there and they both walk back to the lockMap together.

What I would like:

Master bot lets the slave bot know that he is going back for pots; slave bot changes his config settings to take a more aggressive approach (he has some survivability on his own) and stops being useless until the point in time that the master bot reappears on the map and they can join back up and have a good time.

So, first thing's first, in the Master config, I have this ol' thing:

Code: Select all

doCommand pm SlaveBot RESTOCKING POTIONS, YO. {
	timeout 50
	inInventory Red Potion <= 0
}
At the same time, the Master bot ports back to town thanks to buyAuto in the config. This works and the slave receives the PM.

Then in the slave's macro.txt I have this:

Code: Select all

automacro sequenceRestocking1 {
	console "(From MasterBot) : RESTOCKING POTIONS, YO."
	call sequenceRestocking2
}
This never triggers. I've tried it with quotes and without quotes and I am pretty sure that is the exact text that appears in the console when the PM is sent. As such, the following never triggers either (in the macros.txt for the slave):

Code: Select all

macro sequenceRestocking2 {
		do conf attackAuto 2
		do conf follow 0
		do conf lockMap $.map
		do ai clear
		stop
}
The intention being, the bot stops being a slave and starts unloading some fire bolts on things.

Then, back in the Master's macros.txt, I have this:

Code: Select all

automacro sequenceRestocking {
	location @config lockMap
	run-once 1
	call {
		do pm SlaveBot G2G
	}
}

automacro sequenceRestocking2{
	console "(To SlaveBot) : RESTOCKING POTIONS, YO."
	call {
		release sequenceRestocking
		stop
	}
}
The idea being, when the Master returns to the lockMap, he sends a pm to the slave to say, "Hey, I'm ready to roll." and then locks the macro so it doesn't spam him. Then, when he ports out of the map to collect potions the next time, it unlocks the macro to repeat again when he returns; and the slave receives:

Code: Select all

automacro sequenceRestocking3 {
	console "(From MasterBot) : G2G"
	call sequenceRestocking4
}

macro sequenceRestocking4 {
		do conf attackAuto 1
		do conf follow 1
		do conf lockMap
		do ai clear
		stop
}
The slave becomes a passive little followbot all over again and everything should be just fine... Except I can't get any of it to trigger. This is only the second macro I've tried to write and the first was really simple; so it's probably not efficient in any way as I'm still learning. The thing is though, I've read over and over the macros page of the wiki and I just can't seem to see why it's not triggering. Even things that I am unsure about, like whether or not "location @config lockMap" even works, I can't test it because the macro doesn't trigger in the first place.

If anyone could just look over what I've done and help me find a footing, I would really appreciate it.

Thanks
There's two types of people in this world, kid: Those who can, and those who can't; and cats...

[Plugin] Automatic Map Changer
Mortimal
Developers
Developers
Posts: 389
Joined: 01 Nov 2008, 15:31
Noob?: No

Re: Promoting better communication between master and slave...

#2 Post by Mortimal »

First: better use pm AM triger, sms like this:

Code: Select all

automacro masterRestoking {
   pm ("RESTOCKING POTIONS, YO."), MasterBot 
   exclusive 1
   call stopActing
}
If location @config(lockMap) not working, try to use eval ($::field->baseName eq $::config{lockMap})
Please use pin function for uploading your file contents!
rocknroll
Been there done that!
Been there done that!
Posts: 118
Joined: 19 Sep 2011, 07:30
Noob?: Yes

Re: Promoting better communication between master and slave...

#3 Post by rocknroll »

yes, use pm function :)

do pm nameA blabla
trigger it with
pm "blabla"

if u want to undefined lockMap with do command, use

Code: Select all

do conf lockMap none
Sorry, my english is very bad !
catcity
Noob
Noob
Posts: 18
Joined: 20 Oct 2012, 14:31
Noob?: No

Re: Promoting better communication between master and slave...

#4 Post by catcity »

Thanks guys.

After I posted this I managed to get a crude version of it working which I will post here for reference:

config.txt for MASTER:

Code: Select all

doCommand pm SlaveBot Porting for Pots... {
	timeout 50
	inInventory White Potion = 0
}
macros.txt for MASTER:

Code: Select all

automacro bindSlave {
	mapchange any
	call {
		$myMap = $.map
		$lockMap = @config(lockMap)
		if ($myMap != $lockMap) goto end
			do pm SlaveBot Good to Go!
			:end
	}
}

automacro bindSlave2 {
	console "(To SlaveBot) : Porting for Pots..."
	call {
		release bindSlave
		stop
	}
}
macros.txt for SLAVE:

Code: Select all

automacro tempoChk {
	console "(From: MasterBot) : Porting for Pots..."
	call tempoChg
}

automacro tempoChk2 {
	console "(From: MasterBot) : Good to Go!"
	call tempoChg2
}

macro tempoChg {
		do conf attackAuto 2
		do conf follow 0
		do conf lockMap $.map
		stop
}

macro tempoChg2 {
		do conf attackAuto 1
		do conf follow 1
		do conf lockMap none
		stop
}
So the master sends the pm, the slave picks it up and as the master ports off to restock on potions, the slave turns aggressive and keeps on killing. Then when the master returns, he tells the slave that he is good to go and it all reverts back to the standard.

This is very crude, probably inefficient and probably not working very well.

I'm going to take your advice and see how I can improve it.
There's two types of people in this world, kid: Those who can, and those who can't; and cats...

[Plugin] Automatic Map Changer
rocknroll
Been there done that!
Been there done that!
Posts: 118
Joined: 19 Sep 2011, 07:30
Noob?: Yes

Re: Promoting better communication between master and slave...

#5 Post by rocknroll »

why don't u use pm function so it can be easily.

MASTER
macros.txt

Code: Select all

automacro stopLeading {
 inventory "White Potion" = 0
 timeout 60
 call {
	do pm SLAVEBOT Porting for Pots...
	}
}

automacro bindSlave {
 mapchange any
 call {
	$myMap = $.map
	$lockMap = @config(lockMap)
	if ($myMap != $lockMap) goto end
	 do pm SLAVEBOT Good to Go!
	:end
	}
}
SLAVE
macros.txt

Code: Select all

automacro tempoChk {
 pm "Porting for Pots..."
 var .lastpm = MASTER
 exclusive 1
 call {
	do conf attackAuto 2
	do conf follow 0
	do conf lockMap $.map
	stop
	}
}

automacro tempoChk2 {
 pm "Good to Go!"
 var .lastpm = MASTER
 exclusive 1
 call {
	do conf attackAuto 1
	do conf follow 1
	do conf lockMap none
	stop
	}
}
Sorry, my english is very bad !
catcity
Noob
Noob
Posts: 18
Joined: 20 Oct 2012, 14:31
Noob?: No

Re: Promoting better communication between master and slave...

#6 Post by catcity »

Hey man, you are totally right, but bear in mind there is a delay between posts posted and posts approved. The code that I linked was the crude macro that I got working just after I made the initial post. Like I say; I'm going to take your advice and improve it further, I'm just having a problem getting part of it to trigger now.

Don't sweat, I'll be back here with the new version soon.

Cheers for your help.
There's two types of people in this world, kid: Those who can, and those who can't; and cats...

[Plugin] Automatic Map Changer