near player info
Moderator: Moderators
Re: near player info
@RBiN - Your idea is brilliant (only a few of us can see the true potential). Hardly see macro users willing to post an eval issues even if it already solved us many kind of headache problems before. Maybe some of us are really selfish or they are afraid if the codes not nice and etc. Infact, we should encourage ppl to use this eval... practice alot will give us an awsome eval codes.
p.s: Keep-up the good work ^^ ... I'm watching
p.s: Keep-up the good work ^^ ... I'm watching
-
- Plain Yogurt
- Posts: 95
- Joined: 05 Apr 2008, 05:15
- Noob?: Yes
- Location: in place where you cant go
- Contact:
Re: near player info
im totally noob at eval...
could you explain this macro...
the way i understand it... this should post on the console something like this "name=BotPeople job=Novice and blah blah blah"
but seem cant make it work... is this only work if you are in the same guild or something???
last time ezza and help_us said it needed a hook to make it work, http://forums.openkore.com/viewtopic.php?f=32&t=555
could you explain this macro...
Code: Select all
automacro test {
player /(.*)/, 5
exclusive 1
call {
$i = $.lastMatch1
do eval my $_player = Match::player($_i); foreach my $_player (@{$::playersList->getItems()}) { $::Macro::Data::varStack{name} = $_player->{'name'}; $::Macro::Data::varStack{job} = $_player->job; $::Macro::Data::varStack{lvl} = $_player->{'lv'}; $::Macro::Data::varStack{sex} = $::sex_lut{$_player->{'sex'}}; $::Macro::Data::varStack{dist} = sprintf("%.1f", distance($::char->{pos_to}, $_player->{pos_to})); $::Macro::Data::varStack{guild} = $_player->{guild} ? $_player->{guild}{name} : ''; $::Macro::Data::varStack{id} = $_player->{'binID'}; }
log name=$name job=$job lvl=$lvl sex=$sex dist=$dist guild=$guild id=$id
if ($dist < 4) goto next
:next
do something with $name or $id
stop
}
}
but seem cant make it work... is this only work if you are in the same guild or something???
last time ezza and help_us said it needed a hook to make it work, http://forums.openkore.com/viewtopic.php?f=32&t=555
Re: near player info
@fco2783 - you got me wrong. The comment was not for this player syntax... new version macro can use regexp on player's name. In this case, the regexp use a back reference last match to any names (.*) with the distance lower than 5. So, it will trigger to any players name in that range.
If you wanna try playing this eval.. use this little modifications to the original post
If you wanna try playing this eval.. use this little modifications to the original post
Code: Select all
automacro test {
player /(.*)/, 5
timeout 5
call {
$n = $.lastMatch1
log $n
do eval foreach my $_player (@{$::playersList->getItems()}) { next if $_player->{'name'} eq "";if ($_player->{'name'} eq "$n") {$::Macro::Data::varStack{name} = $_player->{'name'}; $::Macro::Data::varStack{job} = $_player->job; $::Macro::Data::varStack{lvl} = $_player->{'lv'}; $::Macro::Data::varStack{sex} = $::sex_lut{$_player->{'sex'}}; $::Macro::Data::varStack{dist} = sprintf("%.1f", distance($::char->{pos_to}, $_player->{pos_to})); $::Macro::Data::varStack{guild} = $_player->{guild} ? $_player->{guild}{name} : ''; $::Macro::Data::varStack{id} = $_player->{'binID'}; }}
if ($name = Unknown || $name = "") stop
log name=$name job=$job lvl=$lvl sex=$sex dist=$dist guild=$guild id=$id
log do something with Name $name or ID $id
}
}
Re: near player info
its still buggy though, if you put a specific distance it doesnt trigger when there's 2 or more player on screen. ill find some other alternative to that one, try to work it out this weekend coz its the only day im free. anyway i made some minor changes, also thx to ezza for the modification.
Code: Select all
automacro test {
player /(.*)/, 5
timeout 5
call {
$n = $.lastMatch1
log $n
do eval foreach my $_player (@{$::playersList->getItems()}) { next if $_player->{'name'} eq ""; next if $_player->{actorType} ne "Player"; if ($_player->{'name'} eq "$n") {$::Macro::Data::varStack{name} = $_player->{'name'}; $::Macro::Data::varStack{job} = $_player->job; $::Macro::Data::varStack{lvl} = $_player->{'lv'}; $::Macro::Data::varStack{sex} = $::sex_lut{$_player->{'sex'}}; $::Macro::Data::varStack{dist} = sprintf("%.1f", distance($::char->{pos_to}, $_player->{pos_to})); $::Macro::Data::varStack{guild} = $_player->{guild} ? $_player->{guild}{name} : ''; $::Macro::Data::varStack{id} = $_player->{'binID'}; }}
if ($name = Unknown || $name = "") stop
log name=$name job=$job lvl=$lvl sex=$sex dist=$dist guild=$guild id=$id
log do something with Name $name or ID $id
}
}
Re: near player info
Well, actually I dont agree with (.*) at 1st, becoz it spam the automacro everytime there is a player around us. The modification code above just to make the eval match the $n with no specific usage other than get used to the perl eval practicing.
p.s: Triggering the automacro is more headache than coding the macro itself ^^.
[edit] Becarefull on the actor type. Unknown #ID player also in the same type of actor Player when it still not in the mem cache.. so dont worry.. the player syntax in automacro just trigger only to players.. not the anything else.
p.s: Triggering the automacro is more headache than coding the macro itself ^^.
[edit] Becarefull on the actor type. Unknown #ID player also in the same type of actor Player when it still not in the mem cache.. so dont worry.. the player syntax in automacro just trigger only to players.. not the anything else.
Re: near player info
it also triggers when a homunculus is in sight thats why i put next if $_player->{actorType} ne "Player"ezza wrote:[edit] Becarefull on the actor type. Unknown #ID player also in the same type of actor Player when it still not in the mem cache.. so dont worry.. the player syntax in automacro just trigger only to players.. not the anything else.
actually its more difficult to write an eval perl in macro than a normal perl. :p
Re: near player info
Code: Select all
automacro test {
player /(.*)/, 5
timeout 5
call {
$n = $.lastMatch1
log $n
do eval foreach my Actor::Player $_player (@{$playersList->getItems()}) { next if $_player->{'name'} eq "";if ($_player->{'name'} eq "$n") {$::Macro::Data::varStack{name} = $_player->{'name'}; $::Macro::Data::varStack{job} = $_player->job; $::Macro::Data::varStack{lvl} = $_player->{'lv'}; $::Macro::Data::varStack{sex} = $::sex_lut{$_player->{'sex'}}; $::Macro::Data::varStack{dist} = sprintf("%.1f", distance($::char->{pos_to}, $_player->{pos_to})); $::Macro::Data::varStack{guild} = $_player->{guild} ? $_player->{guild}{name} : ''; $::Macro::Data::varStack{id} = $_player->{'binID'}; }}
if ($name = Unknown || $name = "") stop
log name=$name job=$job lvl=$lvl sex=$sex dist=$dist guild=$guild id=$id
log do something with Name $name or ID $id
}
}
Discussion: 1st, player syntax in automacro only match players name ($n)... not the homun. Then, we match the name ($n) to the existing players name in the playersList (did homun really exist in this playersList?). So, its the players name that we try to match here... not the homun, unless got some stupid ppl with the same name to the homun
p.s: So, what say you?
Re: near player info
it actually triggers the macro regardless if its a homunculus. i tried adding this partRBiN wrote:Discussion: 1st, player syntax in automacro only match players name ($n)... not the homun. Then, we match the name ($n) to the existing players name in the playersList (did homun really exist in this playersList?). So, its the players name that we try to match here... not the homun, unless got some stupid ppl with the same name to the homun
p.s: So, what say you?
Code: Select all
$::Macro::Data::varStack{type} = $_player->{actorType}
[macro][log] name=Big Bird type=Homunculus job=Filir
i also check it personally and it was really a homunculus. try to check it for urself.
Re: near player info
Sry @RBiN, I havent see any homun type in my server... I tested this with my other ID. So, everytime it trigger .. i just can see my ID only ^^
Okay... seems like this is a challange to us since the player syntax also trigger on homun ... why dont you try this 1st, see if there is any bug or error
p.s: I hate homun ^^
[edit] Btw, I cant trigger the player /.*/ regexp. Is it really a regexp?
Okay... seems like this is a challange to us since the player syntax also trigger on homun ... why dont you try this 1st, see if there is any bug or error
Code: Select all
automacro test {
player /^.*/, 5
timeout 10
call {
do eval my %_playersInfo;my @playersInformation;for (my $_i = 0; $_i < @playersID; $_i++) {next if ($::playersID[$_i] eq "");$_player = $::players{$::playersID[$_i]};$_playersInfo{$_i}{name} = ($_player->{'name'})?$_player->{'name'}:"Unknown";$_playersInfo{$_i}{job} = $::jobs_lut{$_player->{jobID}};$_playersInfo{$_i}{lvl} = $_player->{'lv'};$_playersInfo{$_i}{sex} = $::sex_lut{$_player->{'sex'}};$_playersInfo{$_i}{dist} = sprintf("%.1f", distance($::char->{pos_to}, $_player->{pos_to}));$_playersInfo{$_i}{guild} = $_player->{guild} ? $_player->{guild}{name} : 'None';$_playersInfo{$_i}{id} = $_player->{'binID'};$_playersInfo{$_i}{loc} = "$_player->{pos_to}{x}" . " $_player->{pos_to}{y}";push @playersInformation, \%_playersInfo;};$_i = 0;$_n = 1;message "-------------- Player List -----------------\nNo. Name (ID) Guild Sex Lvl Job Dist Loc\n--------------------------------------------\n";foreach (@playersInformation) {if ($_->{$_i}{dist} > 5) {$_i++;next} next if ($_->{$_i}{name} eq "");message "$_n\. $_->{$_i}{'name'} ($_->{$_i}{id}) [$_->{$_i}{'guild'}] $_->{$_i}{'sex'} $_->{$_i}{'lvl'} $_->{$_i}{job} Dist=$_->{$_i}{'dist'} ($_->{$_i}{loc})\n", "macro"; $_i++;$_n++}
}
}
p.s: I hate homun ^^
[edit] Btw, I cant trigger the player /.*/ regexp. Is it really a regexp?
Re: near player info
good work in making those player store in a hash, however it only prints player within the given distance but how can we determine which one to buffs? i think we dont have something like this
do something on $_->{$_i}{id} or $_->{$_i}{name}
so we will write it this way?
$id = @eval($_->{$_i}{id}
$name = @eval($_->{$_i}{name}
...and also the other element
i think thats a lot of work. i prefer the old macro we just need some other way to trigger it.
ps. nice idea though ^^
do something on $_->{$_i}{id} or $_->{$_i}{name}
so we will write it this way?
$id = @eval($_->{$_i}{id}
$name = @eval($_->{$_i}{name}
...and also the other element
i think thats a lot of work. i prefer the old macro we just need some other way to trigger it.
ps. nice idea though ^^