Results 1 to 6 of 6

Thread: [Library] Use beds (offline training)

  1. #1
    Focus Group
    Join Date
    Jun 2012
    Posts
    26
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    5 Post(s)
    Reputation
    49
    Rep Power
    5

    [Library] Use beds (offline training)

    Hi guys, I ve been trying to find a way to use beds and offline train, since I didnt find any action or example how to do it I decided to do my own Library and actions.

    • You will need to install Autohotkey software (get it here: Autohotkey)
    • I will show an example of how to use this system, anyway you will need to do your own actions to use it.
    • You should provide the bot the path to use the bed (obviously you need to own a house with a free bed)
    • Make you sure to read the final notes.


    So lets explain how ...

    Add to library folder:
    bedLibrary.lua
    Code:
    local skills = 	{"sword", "axe", "club", "distance", "magic"}
    local script = "C:/script.ahk"
    
    Bed = {}
    Bed.__index = Bed
    
    function Bed.new(skill)
    	return setmetatable({skill = skill}, Bed)
    end
    
    function Bed:getDownTimes()
    	for k, v in ipairs(skills) do
    		if (v == self.skill:lower()) then
    			return k
    		end
    	end
    	return nil
    end
    
    function Bed:buildDownText()
    	for i = 1, self:getDownTimes() do
    		self.text = self.text .. [[
    		
    			Send {Down}
    			sleep, 1000
    			
    		]]
    	end
    end
    
    function Bed:makeFile()
    	local f = io.open(script, "w+")
    	if(not f) then
    		return
    	end
    
    	self.text = [[
    		Send {RWin down} m {RWin up}
    		sleep, 3000
    
    		Send {ctrldown} t {ctrlup}
    		sleep, 3000
    	]]
    	
    	self:buildDownText()
    	
    	self.text = self.text .. [[
    		Send {ENTER}
    
    	]]
    	
    	f:write(self.text)
    	f:close()
    end
    
    function Bed:use()
    	self:makeFile()
    	os.execute(script)
    end
    This is the core of the whole thing.

    To use it you need an action like this:


    Code:
    local bedid = 736							-- Bed ID
    local pos = {x = 32310, y = 31138, z = 6}	-- Bed position
    
    useitem(bedid, pos.x, pos.y, pos.z)			-- This function is built in standard library.
    wait(5000)									-- We wait a bit.
    		
    local bed = Bed.new("magic")				-- We tell our bot what skill we want to train, {"sword", "axe", "club", "distance", "magic"}
    bed:use()									-- The magic goes here.
    Example:

    Lets say I'm using a rune maker and I want to offline train magic level when im out of soul, so my code will look like this ...
    Code:
    local spellrune = "adori gran mort"
    local manarune = 985
    local soulrune = 5
    if soul < soulrune or itemcount("blank rune") < 1 then
    	if usebed and not cavebot then		-- usebed is on setup.
    		setcavebot("yes")				-- start the cavebot with the path to the bed.
    		gotolabel("start")				-- goto first waypoint.
    		usebed = false					-- we update usebed.
    	end
    	return
    end
    
    
    if mp >= manarune then
    	say(spellrune)
    end
    
    wait(1000, 3000)
    
    if math.random(1, 7) == 3 then
    	eatfood()
    end
    Setup:
    Code:
    usebed = true
    I show the bot how to reach the bed, cavebot should be "off" ("no"), the previous script will enable it. (you should prepare your waypoints before starting to bot)


    As you can see there is an action at end of waypoints, at this point the character should be standing near the bed.

    The action:
    Code:
    setcavebot("no")
    
    local bedid = 736
    local pos = {x = 32310, y = 31138, z = 6}
    
    useitem(bedid, pos.x, pos.y, pos.z)
    
    wait(5000)
    
    local bed = Bed.new("magic")
    bed:use()
    
    wait(15000)
    Final notes:
    - You need to have Autohotkey installed otherwise this wont work.
    - Please edit your bot hotkey (ShowClient) as the following:

    (Control + T)
    - Notice: condition should be client focus not required.

    I'll attach my example file, remember is just an example.
    I couldnt attach the library, Idk why so is on the post now.

    Enjoy, and comment any question.
    Attached Files Attached Files

  2. #2
    iBot User 3173654's Avatar
    Join Date
    Aug 2012
    Posts
    1,393
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    28 Post(s)
    Reputation
    202
    Rep Power
    9
    nice job broo !

    REP+
    http://www.tibiaibot.com/forum/showthread.php?16907-FREE-Scripts-3173654&highlight=3173654+free+scripts

  3. #3
    Normal User
    Join Date
    May 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    5
    does it work?

  4. #4
    Focus Group
    Join Date
    Jun 2012
    Posts
    26
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    5 Post(s)
    Reputation
    49
    Rep Power
    5
    ofc it works, wouldnt release something that doesnt work, you just gotta follow the steps, any doubt comment.

  5. #5
    Normal User
    Join Date
    Feb 2012
    Location
    Ottawa, Canada.
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    12
    Rep Power
    5
    PHP Code:
    bedtrain(int xint yint zstring style
    It has been added on iBot v1.1.3
    Cheers,
    WedNesDay.

  6. #6
    Focus Group
    Join Date
    Jun 2012
    Posts
    26
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    5 Post(s)
    Reputation
    49
    Rep Power
    5
    Quote Originally Posted by WedNesDay View Post
    PHP Code:
    bedtrain(int xint yint zstring style
    It has been added on iBot v1.1.3
    Nice! would've been nice find it before making the lib xD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •