stop loop when attack

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

Moderator: Moderators

c4c1n6kr3m1
The Way Of Human
The Way Of Human
Posts: 150
Joined: 24 Mar 2012, 04:13
Noob?: Yes

stop loop when attack

#1 Post by c4c1n6kr3m1 »

i'm a noob in macro want to ask. i tried first aid using macro for my novice
{
:chhp
do ss 142
if (@eval(return $::char->{hpPercent}) < 70 && @eval(return $::char->{spPercent}) > 2) goto chhp
}

i want to stop it if get attacked. help me and thx.
Shadow7
Human
Human
Posts: 25
Joined: 03 Dec 2009, 12:30
Noob?: No

Re: stop loop when attack

#2 Post by Shadow7 »

How are you triggering your macro?
or When do you want your character to use first aid?

From your conditions in your macro I can see that you want to trigger first aid when:
hp < 70%
sp > 2%
no monsters are attacking you

You could try something like this:
Note: This is the first time I tried using a timeout less than 1. Tell me if it works :) Otherwise set it to 1?

automacro useFirstAid {
timeout 0.5
hp < 70%
sp > 2%
aggressives == 0
call {
do ss 142
}
}


For more information on conditions and automacros try checking out the Macro manual
wiki.openkore.com/index.php/Macro_plugin
/no1
c4c1n6kr3m1
The Way Of Human
The Way Of Human
Posts: 150
Joined: 24 Mar 2012, 04:13
Noob?: Yes

Re: stop loop when attack

#3 Post by c4c1n6kr3m1 »

automacro aidfirst {
priority 5
aggressives == 0
hp < 42%
sp > 10%
macro_delay 0.01
exclusive 1
call {
:chhp
do ss 142
if (@eval(return $::char->{hpPercent}) < 70 && @eval(return $::char->{spPercent}) > 2) goto chhp
}
}

that's mine.
the problem is how to stop it when get attack after trigerred???
i've tried using config useSelf_skill, it's funny to see bot sit then firstaid then sit then firstaid...because run out sp, so i try using macro. ( yeah i'm noob )
User avatar
SkylorD
Moderators
Moderators
Posts: 1202
Joined: 16 Dec 2011, 02:53
Noob?: No
Location: Brazil

Re: stop loop when attack

#4 Post by SkylorD »

Don't know if this are correct, i don't have time to read Commands.pm or Misc.pm in search for the correct variable, but i remember only this :

Code: Select all

automacro aidfirst {
priority 5
aggressives == 0
hp < 42%
sp > 10%
macro_delay 0.01
exclusive 1
call {
$hPercent = @eval (return $::char->{hpPercent})
$sPercent = @eval (return $::char->{spPercent})

if (@eval(return $::dmgFrom) == 0) goto chhp
:chhp
while ($hPercent < 70 && $sPercent > 2) as loop
do ss 142
end loop
}
}
2º :

Misc.pm
# If monster attacked/missed you
return 1 if ($monster->{'dmgToYou'} || $monster->{'missedYou'});
According with this tip :

Code: Select all

automacro aidfirst {
priority 5
aggressives == 0
hp < 42%
sp > 10%
macro_delay 0.01
exclusive 1
call {
$hPercent = @eval (return $::char->{hpPercent})
$sPercent = @eval (return $::char->{spPercent})
$damage = @eval (return $::dmgToYou)

if ($damage == 0) goto chhp
:chhp
while ($hPercent < 70 && $sPercent > 2) as loop
do ss 142
end loop
}
}
3º :
Or simply, you can configure monster not acordding monster name with commas :
monster not Monster that appears in your route or walk
4º :
eval $dmgToYou == 0
As condition, of course.
Learn rules
c4c1n6kr3m1
The Way Of Human
The Way Of Human
Posts: 150
Joined: 24 Mar 2012, 04:13
Noob?: Yes

Re: stop loop when attack

#5 Post by c4c1n6kr3m1 »

thanks. :D trying