1st... we store the hashes and arrays in the globals. Then re-use/update the info in the globals. Its like when you open a cabinet in your kitchen, take out something and then put them back in. When you put back in... re-arrange the item in the cabinet for future usage. Ex: Take item no. 1, store it into macro var and then delete the item no. 1 from globals. Repeat the steps untill all is cleared.
Wanna see my kitchen cabinet?
p.s: What say you?
With all this stuff, you will know which 1 to buff and which 1 is not. We have guild and dist infos that could make this a reallity.
near player info
Moderator: Moderators
Re: near player info
How about we play more deeper into the eval functions...
1. In Settings.PM ... just below the "# Data file folders." line... make it look like this...
In config.txt ... create a new line for filtering purpose
In Macro:
How to use?
p.s: See the powerful of eval yet?
1. In Settings.PM ... just below the "# Data file folders." line... make it look like this...
2. Then... add this 4 subs after the sub getTablesFolders ..# Data file folders.
our @controlFolders;
our @tablesFolders;
our @pluginsFolders;
our @anything;
our %any;
our $i;
our $_name;
our $_guild;
our $_job;
our $_lvl;
our $_sex;
our $_dist;
our $_id;
our $_loc;
our @remove;
our $n;
# The registered data files.
Code: Select all
sub setTry {
($_name, $_guild, $_job, $_lvl, $_sex, $_dist, $_id, $_loc) = @_;
$i = 0 if $i eq "";
%any;
$any{$i}{name} = $_name;
$any{$i}{guild} = $_guild;
$any{$i}{job} = $_job;
$any{$i}{lvl} = $_lvl;
$any{$i}{sex} = $_sex;
$any{$i}{dist} = $_dist;
$any{$i}{id} = $_id;
$any{$i}{loc} = $_loc;
push(@anything, \%any);
$i++;
}
sub setUndef {
undef @anything;
undef $i;
}
sub getTry {
return @anything;
}
sub removeTry {
undef @remove;
($_name) = shift;
if (@{\@anything} > 0 && defined $_name) {
$i = 0;
$n = 0;
foreach my $any1 (@anything) {
if ($any1->{$n}{name} eq $_name) {
$n++;
next;
}
%any;
$any{$i}{name} = $any1->{$n}{name};
$any{$i}{guild} = $any1->{$n}{guild};
$any{$i}{job} = $any1->{$n}{job};
$any{$i}{lvl} = $any1->{$n}{lvl};
$any{$i}{sex} = $any1->{$n}{sex};
$any{$i}{dist} = $any1->{$n}{dist};
$any{$i}{id} = $any1->{$n}{id};
$any{$i}{loc} = $any1->{$n}{loc};
push(@remove, \%any);
$i++;
$n++;
}
undef @anything;
@anything = @remove;
}
}
In config.txt ... create a new line for filtering purpose
guildList guild1,guild2,guild3
PlayersDist 7
In Macro:
Code: Select all
macro player {
log Scanning Players Info...
do eval Settings::setUndef();for (my $_i = 0; $_i < @playersID; $_i++) {my $_player = $::players{$::playersID[$_i]};next if $_player eq "";$_guild = ($_player->{guild})?$_player->{guild}{name}:'none';$_name = ($_player->{'name'})?$_player->{'name'}:"Unknown";$_job = $::jobs_lut{$_player->{jobID}};$_lvl = $_player->{'lv'};$_sex = $::sex_lut{$_player->{'sex'}};$_dist = sprintf("%.1f", distance($::char->{pos_to}, $_player->{pos_to}));$_id = $_player->{'binID'};$_loc = "$_player->{pos_to}{x}" . " $_player->{pos_to}{y}";Settings::setTry($_name, $_guild, $_job, $_lvl, $_sex, $_dist, $_id, $_loc)}
pause 2
log Done!!
}
macro print {
log Printing Players Info
do eval my $_i = 0;my @print = Settings::getTry();foreach (@print) {next if ($_ eq "");$_g = $_->{$_i}{guild}; $_n = $_->{$_i}{name};$_j = $_->{$_i}{job};$_l = $_->{$_i}{lvl};$_s = $_->{$_i}{sex};$_d = $_->{$_i}{dist};$_id = $_->{$_i}{id};$_loc = $_->{$_i}{loc};message "$_id, $_n, $_g, $_l, $_s, $_j, $_d, $_loc\n", "macro";$_i++}
}
macro filter {
log Filtering the Players Info
do eval my $_i = 0;my @print = Settings::getTry();foreach (@print) {$_g = $_->{$_i}{guild};$_n = $_->{$_i}{name};if ($_ eq "" || !existsInList($::config{guildList}, $_g) || $_->{$_i}{dist} > $::config{PlayersDist} || $_g eq "none" || $_n eq "Unknown") {Settings::removeTry("$_n");next} else {$_j = $_->{$_i}{job};$_l = $_->{$_i}{lvl};$_s = $_->{$_i}{sex};$_d = $_->{$_i}{dist};$_id = $_->{$_i}{id};$_loc = $_->{$_i}{loc};message "$_id, $_n, $_g, $_l, $_s, $_j, $_d, $_loc\n", "macro";$_i++}}
}
macro filter2 {
log Filtering the Players Info and take out the 1st matching infos
$name = none
$id = none
do eval my $_i = 0;my @print = Settings::getTry();foreach (@print) {$_g = $_->{$_i}{guild};$_n = $_->{$_i}{name};if ($_ eq "" || !existsInList($::config{guildList}, $_g) || $_->{$_i}{dist} > $::config{PlayersDist} || $_g eq "none" || $_n eq "Unknown") {Settings::removeTry("$_n");next} else {$::Macro::Data::varStack{job} = $_->{$_i}{job};$::Macro::Data::varStack{lvl} = $_->{$_i}{lvl};$::Macro::Data::varStack{sex} = $_->{$_i}{sex};$::Macro::Data::varStack{dist} = $_->{$_i}{dist};$::Macro::Data::varStack{id} = $_->{$_i}{id};$::Macro::Data::varStack{loc} = $_->{$_i}{loc};$::Macro::Data::varStack{guild} = $_g;$::Macro::Data::varStack{name} = $_n;last}}
if ($name = none || $id = none) stop
log $name ($id) [$guild] $sex $job $lvl $dist ($loc)
log Do something with $name ($id)
log After that remove it from the info list
call remove
}
macro remove {
#$removeName shouldn't be blank and must be player's name
$removeName = $name
log Removing Player's Name ($removeName)
do eval Settings::removeTry("$removeName")
}
1. macro player = collecting infos.
2. macro print = printing the current infos.
3. macro filter = filtering the current infos.
4. macro filter2 = filtering + setting the macro var. Then remove the info from the info list.
5. macro remove = remove the player's name and its infos from the current info list.
How to use?
- a. Use 1, 2, 3 and 2 again = You'll see all the players info 1st, then you'll see the filter result.
- b. Use 1, 2, 4 (repeat the 4 untill nothing happened) = Ermmm... better you try it 1st coz I dont know how to tell you ^^
p.s: See the powerful of eval yet?
-
- Noob
- Posts: 3
- Joined: 29 May 2008, 18:59
- Noob?: No
Re: near player info
thx for the macro dude...
but this macro doesn't show the players equips, it only shows the name / guild / sex / job class / level / distance / etc... or does it?
but this macro doesn't show the players equips, it only shows the name / guild / sex / job class / level / distance / etc... or does it?
Re: near player info
I'm using the latest version of openkore (Trunk) but after I pm my priest saying "open warp portal" It didn't give me any response , but in the bot console I'm seeing it says automacro warp portal is triggered. Though no further actions is done. Can Darki or anyone can help me?