Page 5 of 6

Re: Rock5's catchCavy script

Posted: Tue Mar 29, 2011 7:46 pm
by rock5
"\a" is a special code that rings the case bell. So the bell rings trice on this line.

Code: Select all

		cprintf(cli.yellow,"\a\aAttempting to catch cavy...\n")

Re: Rock5's catchCavy script

Posted: Sat May 07, 2011 11:59 am
by AngelDrago
newby question how do you execute the script or is the script auto execute :?: :?:

Re: Rock5's catchCavy script

Posted: Sat May 07, 2011 12:14 pm
by rock5
Just follow the instructions on the first post.

Re: Rock5's catchCavy script

Posted: Fri Jun 03, 2011 5:48 am
by vietales
I have created userfunctions.lua in the "rom" folder my own and pasted your script into this new file.


Using

Code: Select all

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
		catchCavy();
	]]></onLeaveCombat>

=> After 30mins Golden cavy appeared but nothing happened

and

Code: Select all

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
		catchCavy("cavy");
	]]></onLeaveCombat>
=> Received this error

Code: Select all

...esktop/micromacro_475/scripts/rom/classes/player.lua:1088: Error in your profile: onLeaveCombat error: ...esktop/micromacro_475/scripts/rom/classes/player.lua:2779: bad argument #2 to 'find' (string expected, got table)
My svnversion is 475
Rock, help me!

Re: Rock5's catchCavy script

Posted: Fri Jun 03, 2011 10:43 am
by rock5
vietales wrote:I have created userfunctions.lua in the "rom" folder my own and pasted your script into this new file.


Using

Code: Select all

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
		catchCavy();
	]]></onLeaveCombat>

=> After 30mins Golden cavy appeared but nothing happened
I think that should have worked. Do you have huntman traps and are they in your backpack?
vietales wrote:and

Code: Select all

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
		catchCavy("cavy");
	]]></onLeaveCombat>
=> Received this error

Code: Select all

...esktop/micromacro_475/scripts/rom/classes/player.lua:1088: Error in your profile: onLeaveCombat error: ...esktop/micromacro_475/scripts/rom/classes/player.lua:2779: bad argument #2 to 'find' (string expected, got table)
My svnversion is 475
Rock, help me!
Your version doesn't supports tables in the findNearestNameOrId function. Delete these lines near the top of the catchcavy userfunction,

Code: Select all

	if string.lower(_cavy) == "cavy" then -- Look for all cavies
		_cavy = {103566,103567}
	end
You wont be able to use the "cavy" keyword. You will have to specify what to search for.

For example:

Code: Select all

catchCavy() -- Will catch only Golden Magic Cavy in any client language.
catchCavy("Cavy") -- In English will catch both Golden Magic Cavy and Magic Cavy.

Re: Rock5's catchCavy script

Posted: Fri Jun 03, 2011 12:14 pm
by vietales
So weird, catchCavy("Cavy") still not working even there are 3 cavies around me
Do I have to set loot = true in my profile?

Re: Rock5's catchCavy script

Posted: Fri Jun 03, 2011 12:55 pm
by rock5
I can't see why it doesn't work, sorry.

Re: Rock5's catchCavy script

Posted: Fri Jun 03, 2011 1:37 pm
by vietales
rock5 wrote:I can't see why it doesn't work, sorry.
.. so sad :(

Re: Rock5's catchCavy script

Posted: Sat Jun 04, 2011 5:55 am
by vietales
I have made a function named CavyDetect to find out if a cavy spawn or not

Code: Select all

function CavyDetect(_cavy)
	_cavy = _cavy or 103566 or 103567
	local cavy = player:findNearestNameOrId(_cavy)
	if cavy then cprintf(cli.yellow,"\a\aMagic Cavy detected...\n") end
end
but nothing happen when a Cavy spawn

So, Do you think r475 has some problem with 'findNearestNameOrId' function?

Re: Rock5's catchCavy script

Posted: Sat Jun 04, 2011 7:35 am
by rock5
Yes, looks like there was a target "type" limitation that was removed in 477. 477 comments actually say "Can now target Cavys" so I'd say try 477. There are only 2 minor changes between 475 and 477 so it should work.

Re: Rock5's catchCavy script

Posted: Sat Jun 04, 2011 10:12 pm
by vietales
rock5 wrote:Yes, looks like there was a target "type" limitation that was removed in 477. 477 comments actually say "Can now target Cavys" so I'd say try 477. There are only 2 minor changes between 475 and 477 so it should work.
Oh god, it works like a charm !
You're really rock, rock :D

Re: Rock5's catchCavy script

Posted: Sun Jun 05, 2011 1:12 am
by harbifm
can you explain vitales how you made it work with 477 step by step? (begin with creating userfucntion.lua)

Re: Rock5's catchCavy script

Posted: Sun Jun 05, 2011 3:13 am
by lisa
harbifm wrote:can you explain vitales how you made it work with 477 step by step? (begin with creating userfucntion.lua)
The issues and problems you are having and will continue to have are very specific to the server/revision you are using. Please post your requests and such in this topic created especially for your server.
http://www.solarstrike.net/phpBB3/viewt ... =30&t=2538

I would rather not see the forum filled up with questions and problems that only a small % of the users will actually encounter, if we keep the issues in one place then it will help you all out that use the same server/revision.

Check for bag space before use?

Posted: Mon Jun 06, 2011 6:54 am
by Edamh
I quickly skimmed the 5 pages of posts but I didn't see anything about a check for bag space BEFORE using the function. I guess that my bags were full when the golden cavies spawned, bot used a trap, but no egg in bag since bags full. There were 3 traps/eggs unaccounted for in my bags last night.

Can I use the following?

Code: Select all

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
                if inventory:itemTotalCount(0) > 0 then catchCavy()
	]]>
or am I missing (semi)colon in there or other syntax? Thanks.

Re: Rock5's catchCavy script

Posted: Mon Jun 06, 2011 7:17 am
by lisa
the check for bag space seems fine, you need an end to close the if statement though ;)

Code: Select all

 if inventory:itemTotalCount(0) > 0 then catchCavy() end

Re: Rock5's catchCavy script

Posted: Sat Jul 09, 2011 5:14 pm
by omegastar013
thank you for this rock5

Re: Rock5's catchCavy script

Posted: Sat Oct 08, 2011 2:54 am
by testbot
Dont work for me, (Rev 654)

9:38am - C:/micromacro/scripts/rom/classes/player.lua:1423: Error in your profile: onLeaveCombat error: [string "..."]:3: attempt to call global 'catchCavy' (anil value)

thx for all.

Re: Rock5's catchCavy script

Posted: Sat Oct 08, 2011 3:32 am
by lisa
That is telling you that you don't have the userfunction in the userfunctions folder.

Re: Rock5's catchCavy script

Posted: Thu Nov 01, 2012 3:51 am
by botje
just posting here to give a heads up on the fact this is still broken :)

Re: Rock5's catchCavy script

Posted: Thu Nov 01, 2012 4:28 am
by rock5
botje wrote:just posting here to give a heads up on the fact this is still broken :)
Really? I wasn't aware it was broken.