First Macro (look okay?)

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

Moderator: Moderators

crashdmj
Noob
Noob
Posts: 11
Joined: 01 Aug 2013, 16:14
Noob?: Yes

First Macro (look okay?)

#1 Post by crashdmj »

So I wanted a macro that could have a slave healer send out a message to a master (character controlled) which would alert him to dwindling SP. The master would then respond by using pots if close to death. Hopefully I didn't reinvent the wheel (something kore could already do).

For the slave:

Code: Select all

##Slave##
#This macro will have slave PM the master when it's SP is below an amount.
#Good for letting your player-controlled character know when it is time 
#to use pots and not rely on the slave for heals

automacro ShoutSP {
	sp < 30 #or whatever amount is lowest sp cost for heal#
	call {
		do pm ("MainChar") (SP low) #c public, p party, g guild, pm private)#
	}
	timeout 12
}


For the master (player):

Code: Select all

##Master##
#After receiving message from slave, "SP low", will do self check to
#determines if it should use pots so as not to die! Must satisfy all
#conditions: 1) Received message from slave that "SP low", #2) HP 
#lower than set amount and 3) Has "white potion" in inventory to even use

automacro RelyOnPots {
	$.lastpmMsg ("SP low") [BotHealer]
	hp < 20%
	inventory "white potion" >= 1
	call {
		do is white potion
	}
	timeout 1
}
Any advice? Is there a big time delay between public chats, private messages and party messages? Meaning should I pick one over the other?
Cheers
crashdmj
Noob
Noob
Posts: 11
Joined: 01 Aug 2013, 16:14
Noob?: Yes

Re: First Macro (look okay?)

#2 Post by crashdmj »

Ok, so the slave part of the macro works with some formatting changes (tested pm function and c "chat" only):

Code: Select all

automacro ShoutSP {
	sp < 30 #or whatever amount is lowest sp cost for heal#
	call {
		do pm "CharName" SP low #c public, p party, g guild, pm private)#
	}
	timeout 12
}
But I realized something with the master part of the code: the last pm will always be "SP low" so the automacro will just spam white potions until it doesn't meet one of the other conditions (obvious one being hp > 30%). You wouldn't want to be needlessly wasting pots if you healer can heal you. So then I thought what about the slave doing an all-clear pm ("SP fine") but then it will have to spam that message continuously w/o using a timeout. The reasoning for not using the timeout would be in instances where the Slave's sp dips below the 30 mark again soon after a "SP fine" pm (see example below for step-by-step reasoning). PM Spamming the message seems like a waste of processor resources. Any suggestions?

[Step-by-step reasoning against having timeouts in either the slave or master macro block]
Slave: "Sp fine" (sp is >= 30%) Timeout 10 seconds
Master: sees that "SP fine" =/= "SP low", and nothing happens (no pots spammed)
<Slave heals Master and in doing do, sp dips below 30> Timeout 10 seconds
Slave: "SP low" (sp is < 30%)
<Master spams pots until hp > 50% (or some number) and will continue to until it gets the "SP fine" from slave which could happen before the "SP fine" timeout has elapsed, which = you spanning pots needlessly now that your healer bot has sp to heal you with>

If you do use timeouts, there is a chance that the SP could change during one of those timeouts in which case after the timeout elapsed you could be dead.