I'm new to Perl and the macro writing, i read the faq on openkore wiki and searched many things in the forum and others and in the google code of openkore too.
Here is my problem.
I'm trying to write a macro in order to cast "Taekwon Mission" until i'm out of mana or the "monster" changed and has a base lvl < 70, then use a sound to alert me for example. The problem is i don't find how i could have the information required concerning the monster and his base lvl after i cast "Taekwon Mission" (monster name, monster id, monster base lvl, etc.) and then use it in my loop whastover.
Here is my beginning, if someone could help me i would be grateful
Code: Select all
automacro tkMissionChange{
sp < 10
call tkMissionChange
}
macro tkMissionChange {
log Begin macro tkMissionChange
log SP at first : $.sp
do sit
if ($.sp == 191) { # will do a while loop in the end
log Mana is full
do ss TK_MISSION
# $monster = -> here i would like to get the information of the monster i need (id, name, base level, etc.)
log \$monster : $monster
}
log End macro tkMissionChange
}
I have see those lines in the openkore files but i don't see if it is usable or not
Code: Select all
# TODO test if we must use ID to know if the packets are meant for us.
# ID is monsterID
sub taekwon_packets {
my ($self, $args) = @_;
my $string = ($args->{value} == 1) ? T("Sun") : ($args->{value} == 2) ? T("Moon") : ($args->{value} == 3) ? T("Stars") : TF("Unknown (%d)", $args->{value});
if ($args->{flag} == 0) { # Info about Star Gladiator save map: Map registered
message TF("You have now marked: %s as Place of the %s.\n", bytesToString($args->{name}), $string), "info";
} elsif ($args->{flag} == 1) { # Info about Star Gladiator save map: Information
message TF("%s is marked as Place of the %s.\n", bytesToString($args->{name}), $string), "info";
} elsif ($args->{flag} == 10) { # Info about Star Gladiator hate mob: Register mob
message TF("You have now marked %s as Target of the %s.\n", bytesToString($args->{name}), $string), "info";
} elsif ($args->{flag} == 11) { # Info about Star Gladiator hate mob: Information
message TF("%s is marked as Target of the %s.\n", bytesToString($args->{name}), $string);
} elsif ($args->{flag} == 20) { #Info about TaeKwon Do TK_MISSION mob
message TF("[TaeKwon Mission] Target Monster : %s (%d%)"."\n", bytesToString($args->{name}), $args->{value}), "info";
} elsif ($args->{flag} == 30) { #Feel/Hate reset
message T("Your Hate and Feel targets have been resetted.\n"), "info";
} else {
warning TF("flag: %s gave unknown results in: %s\n", $args->{flag}, $self->{packet_list}{$args->{switch}}->[0]);
}
}
I don't know how i can have access to those informations, i'm new to Perl, the macros and the syntax :s, so i don't know if there are some kind of global variables or something like this to access to informations that may have been stored somewhere after the cast of my skill "Taekwon Mission".
Thanks in advance
EDIT: I tried to modify the code here
Code: Select all
elsif ($args->{flag} == 20) { #Info about TaeKwon Do TK_MISSION mob
message TF("[TaeKwon Mission] Target Monster : %s (%d%)"."\n", bytesToString($args->{name}), $args->{value}), "info";[/color]
}
My main problem is also that i don't know how to get the information of "ServerType0.pm" when my spell "Taekwon mission" is cast in the "macros.txt" files what is the way to communicate between those two ? Is there some kind of global variable or global object that can be summoned from the "macros.txt" file ?
Please Help me :s