I'm trying to create a macro which will be triggered if the server time is equal or beyond the quest time.
I'm trying to figure out what syntax is needed for @eval
Code: Select all
$temp1 = @eval($::questList->{####}->{time?}->{1098}->{count}
In the past I was able to modify another macro that is triggered if the number of kills in the quest is fulfilled *see below*
Code: Select all
## Anubis Hunt ##
automacro Anubis_Hunt{
hook packet/quest_update_mission_hunt
#hook target_died
exclusive 1
call {
$temp1 = @eval($::questList->{9056}->{missions}->{1098}->{count})
if ($temp1 == 50) call Crowd_Control_NPC
:end
}
}
macro Crowd_Control_NPC {
$x = @random ("116","117","118","119","120","121","123")
$y = @random ("122","123","124","125","126","127","128","129","130","131","132","133","134","135")
do move $x $y
pause 1
do talknpc 116 120 c n
pause 2
do talknpc 116 120 c n
pause 2
talk resp 0
pause 2
talk resp 0
pause 2
talk resp 2
}
Code: Select all
automacro testsub {
eval (100 * $::char->{exp} / $::char->{exp_max} ) >= 60
run-once 1
call {
do quit
}
}
Ultimately, I stumbled upon this *see below* and I feel that the syntax is patterned here.
Code: Select all
sub cmdQuest {
if (!$net || $net->getState() != Network::IN_GAME) {
error TF("You must be logged in the game to use this command '%s'\n", shift);
return;
}
my ($cmd, $args_string) = @_;
my @args = parseArgs($args_string, 3);
if ($args[0] eq 'set') {
if ($args[1] =~ /^\d+/) {
# note: we need the questID here now, might be better if we could make it so you only have to insert some questIndex
$messageSender->sendQuestState($args[1], ($args[2] eq 'on'));
} else {
message T("Usage: quest set <questID> <on|off>\n"), "info";
}
} elsif ($args[0] eq 'list') {
my $k = 0;
my $msg;
$msg .= center(" " . T("Quest List") . " ", 79, '-') . "\n";
foreach my $questID (keys %{$questList}) {
my $quest = $questList->{$questID};
$msg .= swrite(sprintf("\@%s \@%s \@%s \@%s \@%s", ('>'x2), ('<'x4), ('<'x30), ('<'x10), ('<'x24)),
[$k, $questID, $quests_lut{$questID} ? $quests_lut{$questID}{title} : '', $quest->{active} ? T("active") : T("inactive"), $quest->{time} ? scalar localtime $quest->{time} : '']);
foreach my $mobID (keys %{$quest->{missions}}) {
my $mission = $quest->{missions}->{$mobID};
$msg .= swrite(sprintf("\@%s \@%s \@%s", ('>'x2), ('<'x30), ('<'x30)),
[" -", $mission->{mobName}, sprintf(defined $mission->{goal} ? '%d/%d' : '%d', @{$mission}{qw(count goal)})]);
}
$k++;
}
$msg .= sprintf("%s\n", ('-'x79));
message($msg, "list");
} elsif ($args[0] eq 'info') {
if ($args[1] =~ /^\d+/) {
# note: we need the questID here now, might be better if we could make it so you only have to insert some questIndex
if ($quests_lut{$args[1]}) {
my $msg = center (' ' . ($quests_lut{$args[1]}{title} || T('Quest Info')) . ' ', 79, '-') . "\n";
$msg .= "$quests_lut{$args[1]}{summary}\n" if $quests_lut{$args[1]}{summary};
$msg .= TF("Objective: %s\n", $quests_lut{$args[1]}{objective}) if $quests_lut{$args[1]}{objective};
message $msg;
} else {
message T("Unknown quest\n"), "info";
}
} else {
message T("Usage: quest info <questID>\n"), "info";
}
} else {
message T("Quest commands: set, list, info\n"), "info";
}
}