Help on checking player status

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
khuankhuan
Noob
Noob
Posts: 5
Joined: 10 Jun 2010, 05:35
Noob?: Yes

Help on checking player status

#1 Post by khuankhuan »

Hi, i wanted to write a macro to check opponent's status whether he/she is Frozen or not and act accordingly. But there's no such functions in Automacro or macro so i decided to try write a perl sub and here's the question:
sub isFrozen {
my $id = @_;
return 1 if (Misc::checkPlayerCondition('#I don't know what to fill in here and how to use it', $id));
return 0;
}
And i found this line inside Misc.pm
if ($config{$prefix . "_whenStatusActive"}) {
return 0 unless $player->statusActive($config{$prefix . "_whenStatusActive"});
}
what does the $prefix in $config means? is it the block title? and the function will automatically check the target_whenStatusActive set?

Or is it a special variable name set in config? like in config i write: specialkeyword_whenStatusActive Frozen
and i use the function: (Misc::checkPlayerCondition('specialkeyword_whenStatusActive', $id)) ??

Thanks for the help :D

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Help on checking player status

#2 Post by EternalHarvest »

Code: Select all

sub isFrozen {
	my ($id) = @_;
	Actor::get($id)->statusActive('BODYSTATE_FREEZING')
}
Misc::checkPlayerCondition is for config.txt blocks, $prefix is the block prefix.

khuankhuan
Noob
Noob
Posts: 5
Joined: 10 Jun 2010, 05:35
Noob?: Yes

Re: Help on checking player status

#3 Post by khuankhuan »

Thanks EternalHarvest :D

Ic, is there any documentation that teaches/tells us how to use those functions like in Actor.pm Functions.pm and so on? (Please don't scold me by asking me go google or search myself ;) I had been trying to search such things over the internet but i cant find anything)

khuankhuan
Noob
Noob
Posts: 5
Joined: 10 Jun 2010, 05:35
Noob?: Yes

Re: Help on checking player status

#4 Post by khuankhuan »

Sorry for asking again. But the sub doesn't work.

I had placed this in the macros.txt:
sub isFrozen {
my ($id) = @_;
Actor::get($id)->statusActive('BODYSTATE_FREEZING');
}
and i use the if syntax to check the statement:
if (isFrozen("$ID") == 0)
The id i get from a console RegExr capture:
console /You use Throw Venom Knife \(Lv: 1\) on (.*) \((\d+)\)/
For this case the id showed in OpenKore is 3. But the following error showed up:
freeze.call error: error in 1: syntax error in if statement
Does the Actor works with monster as well or is it restricted to player only? What should i input to the $id?

Thanks ;)

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Help on checking player status

#5 Post by EternalHarvest »

Numbers displayed by OpenKore aren't Actor IDs. To get real IDs from them, use @playersID, @monstersID etc.

Cozzie
Spam Generator
Spam Generator
Posts: 499
Joined: 04 Apr 2008, 09:30
Noob?: No
Location: Melbourne, City of beer and awful sushis

Re: Help on checking player status

#6 Post by Cozzie »

Moving this to development help. If you share the result of your work it would be good =)
Make Openkore Awesome. Join the team.

khuankhuan
Noob
Noob
Posts: 5
Joined: 10 Jun 2010, 05:35
Noob?: Yes

Re: Help on checking player status

#7 Post by khuankhuan »

I didn't finish develop this checking player status code as i cant really find the correct Player's ID to let OpenKore search for. The ID that returned by using PL command does not do the work.

Mushroom
Perl Monk
Perl Monk
Posts: 427
Joined: 04 Apr 2008, 14:04
Noob?: No
Location: Brazil

Re: Help on checking player status

#8 Post by Mushroom »

Code: Select all

$actorID = @eval($::playersID[$ID])
Quit.

Locked