Userfunction - addon_attackspeedzero

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.
Post Reply
Message
Author
User avatar
attackspeedzero
Posts: 28
Joined: Sat Mar 02, 2013 6:24 pm

Userfunction - addon_attackspeedzero

#1 Post by attackspeedzero » Sat Apr 27, 2013 1:19 pm

I thought I would share the compilation of user functions that I'm building. Most of these are to make coding faster and easier, and some are quite helpful for code readability. Put this file into /userfunctions/ folder.

New/modified functions in bold.

v1.1 changes:
  • Rewrite function sort_daily_log(folder) to sort_log(folder,_breakafterlines)
  • Add function fast_targetNPC(npcname)
Function list:
  • Lua file/table manipulation functions from this thread: http://www.solarstrike.net/phpBB3/viewt ... =27&t=4768
  • comma_value(n)
    • From a log file by lisa (sorry, forgot which thread)
    • Will commify a number greater than 999
  • cprintn(color,string)
    • Ends a colored console print line with "\n" because I got tired of adding this to every cprintf()
  • goto_wp(waypointTag)
    • More "English" and readable, replaces "__WPL:setWaypointIndex(__WPL:findWaypointTag(waypointTag))"
  • reload_wp_file()
    • More "English" and readable, replaces "loadPaths(__WPL:getFileName())"
  • kill_stupid_newbie_pet()
    • From my version of ElfDaily
    • Check vicinity for newbie pet, use newbie pet egg to unsummon, then delete newbie pet egg from inventory
  • save_daily_log(folder)
    • From my version of ElfDaily
    • Save info into log file for character name and daily token count
  • sort_log(folder,_breakafterlines)
    • Inspired by my version of ElfDaily
    • Sort the info in log file alphabetically
    • _breakafterlines argument (optional) insert a blank line after this number of rows in the sorted file
  • take_snoop(snoopname,destination,_colon,_next)
    • If standing next to snoop or ailic's aide, will pay to travel to the destination.
    • destination argument example: "Jinners Camp"
    • _colon argument (optional) - set this to 1 for cases where the option text is "Transport to: " instead of "Transport to "
    • _next argument (optional) - set this to 1 for cases where there's more than one page of destinations
  • set_options(options,optionDescriptions)
    • Idea came from DoD script by Solembum05
    • Allow players to choose options during runtime instead of having to hardcode everything
  • quest_check(quest,questCompleteWaypoint,_questWaypoint)
    • From my version of Sea of Snow Package
    • Allow for keeping waypoints in a loop until quest complete
    • questCompleteWaypoint argument - choose waypoint to go to after quest is completed
    • _questWaypoint argument (optional) - will recycle a section of waypoints
  • quest_skip_if_complete(quest,nextWaypoint)
    • From my version of Sea of Snow Package
    • Skip to "nextWaypoint" if the quest is already completed
  • fast_targetNPC(npcname)
    • Target NPC without all the yrests found in player:target_NPC()
    • Built for speed, especially with EoJ farming in mind
Attachments
addon_attackspeedzero.lua
v1.1
(5.74 KiB) Downloaded 439 times
addon_attackspeedzero.lua
v1.0 (public release)
(5.61 KiB) Downloaded 209 times
Last edited by attackspeedzero on Mon Apr 29, 2013 4:45 pm, edited 3 times in total.

kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Re: Userfunction - addon_attackspeedzero

#2 Post by kkulesza » Sat Apr 27, 2013 7:34 pm

Thanks for sharing Your work.
Some of this functions seem interesting.
But I find Your addon hard to read since there is almost no documentation.

Could You add some usage examples?

Thanks in advance :)

User avatar
attackspeedzero
Posts: 28
Joined: Sat Mar 02, 2013 6:24 pm

Re: Userfunction - addon_attackspeedzero

#3 Post by attackspeedzero » Mon Apr 29, 2013 12:08 pm

I tried pretty well to explain everything, at least in the way things are called. Is there something specific you're running into an issue with?

User avatar
rido_knight
Posts: 102
Joined: Wed May 29, 2013 6:50 am
Location: Turkey

Re: Userfunction - addon_attackspeedzero

#4 Post by rido_knight » Mon Dec 02, 2013 5:18 am

Gives error :(

Image

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

Re: Userfunction - addon_attackspeedzero

#5 Post by rock5 » Tue Dec 24, 2013 10:08 am

Just to let you know, you shouldn't call GetIdName outside of a function because it runs at load time. This causes an error if the addresses need updating because the userfunctions are loaded before the addresses check happens.

Code: Select all

Installing userfunctions. 2:0am - scripts\645/bot.lua:86: ...les (x86)/micromacr
o/scripts/645/classes/memorytable.lua:7: bad argument #2 to 'memoryReadUIntPtr'
(number expected, got nil)
  • 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

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

Re: Userfunction - addon_attackspeedzero

#6 Post by rock5 » Sat Feb 08, 2014 1:27 am

Here is my version of kill_stupid_newbie_pet, if you want to use it.

Code: Select all

function kill_stupid_newbie_pet()
	local function evalfunc(address)
		local obj = CPawn.new(address)
		obj:updateIsPet()
		return obj.IsPet == player.Address
	end
	
	if player:findNearestNameOrId(113199,nil,evalfunc ) then  -- search vicinity for your Newbie Pet
		local newbEgg = inventory:findItem(207051); -- Newbie Pet Egg
		if newbEgg then
			newbEgg:use()
			newbEgg:delete()
		end
	end
end
It checks if the newbie pet is your pet before recalling and tidys up the code that uses and deletes the egg.
  • 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

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Userfunction - addon_attackspeedzero

#7 Post by beanybabe » Tue Jul 14, 2015 12:34 pm

sorry that did not seem to work either. it will get rid of pet 1 on 1 char but any relogs it does not seem to it only deletes the egg after first.
---------------------------------
Rock I tried your newbie pet code and it would not get rid of the pet if char started moving and interrupt it.

Code: Select all

-- function kill_stupid_newbie_pet()
   local function evalfunc(address)
      local obj = CPawn.new(address)
      obj:updateIsPet()
      return obj.IsPet == player.Address
   end
   
  if player:findNearestNameOrId(113199,nil,evalfunc ) then  -- search vicinity for your Newbie Pet
      local newbEgg = inventory:findItem(207051); -- Newbie Pet Egg
      if newbEgg then
         newbEgg:use()
		 yrest(500);    -- I added this to prevent interrupting pet recall
         newbEgg:delete()
      end
   end

kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Userfunction - addon_attackspeedzero

#8 Post by kenzu38 » Wed Jul 15, 2015 2:28 am

beanybabe wrote:sorry that did not seem to work either. it will get rid of pet 1 on 1 char but any relogs it does not seem to it only deletes the egg after first.
I always put these lines at the top of all my wp's onload section.

Code: Select all

player:update()
inventory:update()
loadProfile()
And then followed by gm detect if the area is risky. Haven't botted in years so I vaguely remember the commands, it's probably loadprofile() will small letter p.

I know some functions already do the updates for you but I think it's still best to update at the very start of the script. So try that if you haven't already. Good luck.

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

Re: Userfunction - addon_attackspeedzero

#9 Post by rock5 » Wed Jul 15, 2015 2:28 pm

It's possible the problem is with how long it takes for the pet to appear. If it hasn't appeared yet when that code runes then it won't see the pet but will still drop the egg. Maybe a yrest would help.
  • 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

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Userfunction - addon_attackspeedzero

#10 Post by beanybabe » Tue Oct 13, 2015 11:07 am

I added a wait in the function so it did not need be added elsewhere.

Code: Select all

function kill_stupid_newbie_pet()
	yrest(4500)  -- wait for pet to appear 
   local function evalfunc(address)
      local obj = CPawn.new(address)
      obj:updateIsPet()
      return obj.IsPet == player.Address
   end
    if player:findNearestNameOrId(113199,nil,evalfunc ) then  -- search vicinity for your Newbie Pet
      local newbEgg = inventory:findItem(207051); -- Newbie Pet Egg
      if newbEgg then
         newbEgg:use()
         newbEgg:delete()
      end
   end
end

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests