Pet Feeding using macro plugin

Moderator: Moderators

Message
Author
Julian
Noob
Noob
Posts: 1
Joined: 10 Jun 2008, 15:36
Noob?: No

Pet Feeding using macro plugin

#1 Post by Julian »

I was looking for some macro/plugin that would feed my pet, but only found an outdated plugin that didn't work, so I decided to make it work myself.

I am using a week or so old SVN version of openkore. First, I found out that there is some pet support in openkore already, looks like this:

Code: Select all

Command usage: pet [capture|hatch|status|info|feed|performance|return|unequip|name <name>]
There are some problems with it, the thing that interests you the most, pet hunger, is under the "pet info" command. But if u write that in console, u get nothing. There are two ways how to solve this

1)enable debug messages, in config.txt find "debug" and set it to "debug 1" but that spams your console with lots of unneeded stuff
2)change the source code, openkore\src\Network\Receive\ServerType0.pm on line around line 4620 you find this code:

Code: Select all

sub pet_info {
	my ($self, $args) = @_;
	$pet{name} = bytesToString($args->{name});
	$pet{renameflag} = $args->{renameflag};
	$pet{level} = $args->{level};
	$pet{hungry} = $args->{hungry};
	$pet{friendly} = $args->{friendly};
	$pet{accessory} = $args->{accessory};
	$pet{type} = $args->{type} if (exists $args->{type});
	debug "Pet status: name=$pet{name} name_set=". ($pet{renameflag} ? 'yes' : 'no') ." level=$pet{level} hungry=$pet{hungry} intimacy=$pet{friendly} accessory=".itemNameSimple($pet{accessory})." type=".($pet{type}||"N/A")."\n", "pet";
}
as you can see it only does a debug message.
You need to change the debug line to:

Code: Select all

message TF("Pet status: name=$pet{name} name_set=". ($pet{renameflag} ? 'yes' : 'no') ." level=$pet{level} hungry=$pet{hungry} intimacy=$pet{friendly} accessory=".itemNameSimple($pet{accessory})." type=".($pet{type}||"N/A")."\n"), "pet", 1;
And that'll make it visible even without debug mode.

So now how to autofeed your pet?
First, you need to find out if your pet is hungry or not. I used the "doCommand" option in config.txt

Code: Select all

doCommand pet info {
	stopWhenHit 0
	inLockOnly 0
	notWhileSitting 0
	notInTown 0
	timeout 300
	disabled 0
	manualAI 0
}
What this does is it requests the pet info every 5 minutes. Now you need to react to it and that's when the macro plugin comes into play. My macro looks like this:

Code: Select all

automacro feedPet {
  console /hungry=(\d+) intimacy=/
  call {
  if ($.lastMatch1 >= 60) goto end 
  do pet feed
  stop
  :end
  log No feeding needed atm!
  }
  #maybe not needed, just in case
  timeout 100 
}
Hope it works for you! you can change the hunger level as you want, as I have no idea when it's best to feed your pet so I've set it to 60.

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

Re: Pet Feeding using macro plugin

#2 Post by Mushroom »

Moving to Share Macros.
Quit.

gonzalesbenjo
Noob
Noob
Posts: 5
Joined: 18 Sep 2009, 13:05
Noob?: No

Re: Pet Feeding using macro plugin

#3 Post by gonzalesbenjo »

what is the exact version of your openkore??

lunarfist
Noob
Noob
Posts: 2
Joined: 10 Mar 2010, 09:31
Noob?: No

Re: Pet Feeding using macro plugin

#4 Post by lunarfist »

what rate is 60?
maybe you can post if what are different rates? best time to feed pet is when hungry what rate is it?
and did others try this already?

ralphacabado
Noob
Noob
Posts: 1
Joined: 25 Jun 2010, 19:09
Noob?: No

Re: Pet Feeding using macro plugin

#5 Post by ralphacabado »

This works, though the macro doesn't. It does use pet info, but does not trigger the petFeed macro. Can anyone please take a look at this? Thank you.

fco2783
Plain Yogurt
Plain Yogurt
Posts: 95
Joined: 05 Apr 2008, 05:15
Noob?: Yes
Location: in place where you cant go
Contact:

Re: Pet Feeding using macro plugin

#6 Post by fco2783 »

for those who not so familiar at the debug
debug 0
debugPacket_unparsed 0
debugPacket_received 0
debugPacket_ro_sent 0
debugPacket_sent 0
debugPacket_exclude
debugPacket_include
debugPacket_include_dumpMethod
debugDomains Pet
no need to change anything just this... then the pet info will show...

Blind990
Noob
Noob
Posts: 1
Joined: 11 Jul 2010, 08:57
Noob?: No

Re: Pet Feeding using macro plugin

#7 Post by Blind990 »

ralphacabado wrote:This works, though the macro doesn't. It does use pet info, but does not trigger the petFeed macro. Can anyone please take a look at this? Thank you.
For some reason this code...

Code: Select all

console /hungry=(\.+) intimacy=/
...is not catching the pet info as a console message.

Post Reply