useGoodie

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#21 Post by harbifm » Sun May 29, 2011 1:02 am

is there an old version, may 6-7 months old.

I would like to give it a try

User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: useGoodie

#22 Post by Giram » Sun May 29, 2011 4:01 am

harbifm wrote:did not work

where should I save the file (userfunction_useGoodie_universal .lua)?
Default folder for userfunctions is micromacro\scripts\rom\userfunctions . But since you need to use older version of rombot the rombot might not be able to use these files. I think it was addons folder at first.
harbifm wrote:
I have put into the script ffolder, not the profile folder. shouldl I rename the lua file to (usergoodie) for the bot to recongnize it since it is named that in the code, not userfunction_useGoodie_universal.lua, or the other way around

what I meen is changeing the name as an example (useGoodie ("speed"); to (userfunction_useGoodie_universal "speed"); in the profile code?

and again where to save it for the bot to recongnize it?
You can't use different name for function in code. That is always useGoodie("item_name or ID"); . As for file name there should be userfunction or addon in front of the name. Otherwise bot won't recognice these files.
harbifm wrote:is there an old version, may 6-7 months old.

I would like to give it a try
If you have english client then you can try http://www.solarstrike.net/phpBB3/viewt ... =27&t=2051 . That is oldest i can give now. In code there is english buff names so if your clients language is not english then it won't work.

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#23 Post by harbifm » Mon May 30, 2011 1:26 pm

the proplem that I have is that the rom folder does have either addons or userfunctions folders,

I create them manualy,still the bot did not recongnize them but still , it did not work.

i update to newer version (545), which has the userfucntions folder, but then rombot did not work,,my version is 468

is there a solution

User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: useGoodie

#24 Post by Giram » Mon May 30, 2011 1:57 pm

I don't know the version that introducted addons or userfunctions. So it might be that you have too old version of rombot for userfunctions. Creating folders won't work cause rombot won't have code to find those folders and use files in them.

Because you play with older version or runes of magic and are forced to use older version you might not be able to use these files directly. I don't know what functions you are able to use but you can still use code in profile or waypoints.

You could try something like this:

Code: Select all

if not player:hasBuff("write_buff_name_here") then
      inventory:useItem("write_item_name_here")
end
To get buff name use item you want that gives you buff. Check that name and enter it exactly as you see it in hasBuff() function. Then in useItem() function write item you wan't to use. That can also accept item ID but then you can't use semicolons i think. It might work or then it won't work. I am also using much newer version of runes of magic and this is done for newest version. I can only give hints how you can do this but can't be sure if it will work. Depends of the functions your rombot has at the moment. Hope you can get something to work.

You can place that code in your profile between onLeavecombat, onPreSkillCast, onSkillCast or in waypoint file. Profile settings also depends from your rombot version. I don't know at wich versions those are implemented in rombot.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: useGoodie

#25 Post by rock5 » Mon May 30, 2011 8:45 pm

Please note that in older versions, player:hasBuff didn't use the memory, it used RoMScript commands. So you might find it slows things down too much if used in certain places.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#26 Post by harbifm » Tue May 31, 2011 4:13 am

so the code should read like this:

<onLeaveCombat>
if not player:hasBuff("luck") then
inventory:useItem("XXX")
end

if not player:hasBuff("1200 elemental damage") then
inventory:useItem("XXX")
end



</onLeaveCombat>
<onLevelup><![CDATA[
-- Additional Lua code to execute after having a levelup
-- and levelup the skills for a new character (mage or priest recommended)
-- e.g. sendMacro("SetSpellPoint(_tabnr, _skillnr);"); would levelup a skill
]]></onLevelup>


where luck and 1200 elemental damage are the effect/buff name, and XXX are the items name. should not that be a number for each item?

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#27 Post by harbifm » Wed Jun 01, 2011 12:27 am

by the way, why not copy the whole code into (userfuction.lua) and doing the same thing?

will that work?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: useGoodie

#28 Post by lisa » Wed Jun 01, 2011 1:04 am

because userfunction.lua has the core functions for the bot to run. The userfunctions folder was implemented so people can make their own functions without edited the core files of the bot. each time the bot is updated people would need to redo their code again and again. With the usage of the userfunctions folder there is no need for that.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#29 Post by harbifm » Wed Jun 01, 2011 2:52 am

the problem with my version is that there is no userfucntions or addon folder

why not add the code to the user fucntion at the end, and call it in my profie. (for my case)

I can back-up the userfuction folder if need later for updating my rombot

they way that I am going to do it is to cut and past all the content of usergoodie and catch cavi to the userfuntion.lua at the end of every thing, so it does interept any thing, and try to put actions after onLeaveCompat for it to catch golden cavi, use luck potion and Swamp delcious salad every time a compat finish.

I only need these items

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: useGoodie

#30 Post by rock5 » Wed Jun 01, 2011 4:26 am

I would probably just create a file, let's call it "MyFunctions.lua", and put all my functions in there. Then just add the one line to functions.lua,

Code: Select all

include("MyFunctions.lua")
Or maybe you could avoid editing functions.lua and put that command in your profile <onload> instead.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#31 Post by harbifm » Wed Jun 01, 2011 6:32 am

as I understood it

function.lua contain a list of fucntions.

if i add any thing there, as long as added and do not scrow the sequence in the middle, and that it is already have been set in the system (profile) ,or what ever sitting there are, to use funtions.lua for any comand (or look into it there)

like if a called on somthing listed there, as example, if I copy the all the code from Addon_catchcavi.xml, into the functions.lua and I use the following:

<onLeaveCompat>

catchcavi();)

</onLeaveCompat>


it will look for catchcavi() from the funtions.lua file and use it, why add another loop into the function.lua file?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: useGoodie

#32 Post by lisa » Wed Jun 01, 2011 7:36 am

Another reason is for troubleshooting, since your version is so old I am guessing there will be a lot of problems that arise, if you keep the original files in tact it is a lot easier for us to try and help fix the issues. Adding a single line to the top of the file which says to include another file is a good way to go about it.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: useGoodie

#33 Post by rock5 » Wed Jun 01, 2011 8:31 am

Like I said in the other post, put all your functions, such as the catchcavy function, into the userfunction.lua file. It wont initially exist, just create it in the rom folder and add the functions. That way, like Lisa said, you don't need to modify any of the original files. Note: the userfunctions.lua file was created specifically for this purpose, use it.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#34 Post by harbifm » Wed Jun 01, 2011 3:41 pm

ok

I created a userfunctions.lua,

I put the code for catch cavi and useGoodies into it.

and wrote this into the profile, tell me if am doing something wrong

<onLoad><![CDATA[
<include("userfunctions.lua");
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
]]></onLoad>

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: useGoodie

#35 Post by lisa » Wed Jun 01, 2011 6:53 pm

at the top of functions.lua it says something like this

Code: Select all

if( settings == nil ) then
	include("settings.lua");
end
just add the include at the top

Code: Select all

include("userfunctions.lua");
if( settings == nil ) then
	include("settings.lua");
end
or if you want to leave functions.lua as it is by default then in all of your profiles

Code: Select all

<onLoad><![CDATA[
include("userfunctions.lua");
]]></onLoad>
you just had a < in the code you posted that shouldn't have been there
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: useGoodie

#36 Post by rock5 » Thu Jun 02, 2011 7:09 am

You don't need to do any of that. Revision 472 already has code to use "userfunctions.lua". You'll see near the top of bot.lua

Code: Select all

if( fileExists(getExecutionPath().."/userfunctions.lua") ) then
	include("userfunctions.lua");
end
Edit: I thought you had 472. I see above you said you had 468. What I said still applies
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#37 Post by harbifm » Sat Jun 04, 2011 9:02 am

worked fine

but the luck potion is named differently in my server, it is:

lucky target

User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: useGoodie

#38 Post by Giram » Sat Jun 04, 2011 12:40 pm

Those names that are used by useGoodie is not buff names. They are just words that i have defined and i could change that name to what i want. For example using usegoodie("luck") it would search client specific buff name by using buff ids that are defined in code.

harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#39 Post by harbifm » Sat Jun 04, 2011 1:07 pm

the good thing i am not getting errors any more, I have version 475

the way i have done is as u said, cereated a file called userfunctions.lua
copy and paste both catch cavi and useGoodies into that file

than added one line into my profile like this after onLoad:
include "userfunctions"

as described above by rock5

now, how should i call the buff "luck" or the action "catch_cavi()" into action after <onLeaveCombat>?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: useGoodie

#40 Post by rock5 » Sat Jun 04, 2011 9:25 pm

I never said you needed to "include" userfunctions. I said 475 already includes it so you don't have to include it. All you have to do is create the "userfunctions.lua" file.

To use the functions add the following to the onLeaveCombat section,

Code: Select all

catchCavy() -- Will catch only Golden Magic Cavy and should work in any language.
or

Code: Select all

catchCavy("Cavy") -- Will catch both normal and golden, Change "Cavy" to your language.
  • This is assuming you already made that change to the catchCavy function I talked about.
  • Also you might need to upgrade to 477 to use catchCavy.
and

Code: Select all

useGoodie("luck")
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests