[ASK] My Tele Search Macro

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

Moderator: Moderators

grimmy
Noob
Noob
Posts: 4
Joined: 19 Nov 2013, 07:49
Noob?: Yes

[ASK] My Tele Search Macro

#1 Post by grimmy »

Hi guys,

Recently I made a simple macro for tele-searching. The point is to make the bot tele-search until its sp less than 10%, then it will turn tele-search off until it has enough sp (in my case, 50%). Here is my code :

Code: Select all

automacro save_sp_on {
	sp < 10%
	call change_config
	run-once 1
}

macro change_config {
	do conf route_randomWalk 1
	release save_sp_off
}

automacro save_sp_off {
	sp > 50%
	call return_config
	run-once 1
}

macro return_config {
	do conf route_randomWalk 0
	release save_sp_on
}
When I test it myself, the code works ( I keep typing tele until its sp down to under 10%, and then sit until its sp > 50%). But sometimes when I leave my bot overnight, I sometimes find my bot config has route_randomWalk 1 even when its sp is over 50%. Is there anything I miss? Also if you have suggestion to improve my macro, I would gladly accept it.

----edit----
oh and before someone asking, yes I have already changed the config and mon_control for tele-searching.
----edit2---
I also have taken a look at tele-search v2, but that's not really what I'm looking for.
iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG

Re: [ASK] My Tele Search Macro

#2 Post by iMikeLance »

Code: Select all

automacro save_SP_On
	eval $::config{route_randomWalk} eq 0
	sp < 10%
	exclusive 1
	macro_delay 0
	delay 0
	call {
		[
			do conf route_randomWalk 1
		]
	}
}

automacro save_SP_Off
	eval $::config{route_randomWalk} eq 1
	sp > 50%
	exclusive 1
	macro_delay 0
	delay 0
	call {
		[
			do conf route_randomWalk 0
		]
	}
}
grimmy
Noob
Noob
Posts: 4
Joined: 19 Nov 2013, 07:49
Noob?: Yes

Re: [ASK] My Tele Search Macro

#3 Post by grimmy »

@iMikeLance
Thanks for the update, it works fine now.
But there's something that I want to ask, why put both macro_delay and delay together? Don't they have the same function?
And why put exclusive, not run-once? Is that a better version of run-once?
iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG

Re: [ASK] My Tele Search Macro

#4 Post by iMikeLance »

IIRC macro_delay sets the delay between macro commands and delay is the time to wait before calling the macro.
exclusive 1 means that no other automacro will trigger util this one is finished. Without exclusive 1, if another macro triggers while your tele search macro is running, it won't be released and won't trigger again.