Hi Guys,
Seeking for your help to check if i'm the right path writing my macro.
The scenario is that the GM is disguising as a monster and the BOT is stuck on trying to attack the disguised GM.
The goal is to set a timeout if the bot is stuck on targeting the disguised GM and will create a file.
The reason I have created a subroutine that will create a trigger file is that I have a java program that will listen on the directory to play an alert sound if the bot is stuck on targeting for me to take manual action.
Below is my code snippet:
automacro foo {
eval AI::inQueue("attack") eq 1 #<---- Automacro will be trigger if the next action will be "attack" (Not sure if this is the right condition to check if the BOT is targeting something)
call bar
timeout 10
}
macro bar {
$isTargeting = @eval(AI::inQueue("attack") eq 1) #<---- Evaluated the "targeting" action and store it on a flag variable.
$isMoving = @eval(AI::action eq "move" ) #<---- Evaluated the "move" action and store it on a flag variable.
$curTimeout = 0
$maxTimeout = 3
while (($isTargeting == 1) && ($curTimeout < $maxTimeout) && ($isMoving == 0)) as loop
$curTimeout++
if($curTimeout == $maxTimeout) {
do sit
writeTriggerFile()
do ai off
}
end loop
}
sub writeTriggerFile{
open(FH,">",'C:/alert/alert.txt') or die "$!";
print FH "whatever\n";
close FH;
}
Thanks in advance
Evaluate actions
Moderators: Moderators, Documentation Writers
Re: Evaluate actions
you can play sound from a macro using the command
Code: Select all
eval Utils::Win32::playSound("plugins/alertSound/sounds/alarm.wav")