Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
auto_energyring
05-03-2014, 03:33 AM,
#1
auto_energyring
This script loads an energy ring when your hp drops below 40% and unloads it when you heal back to full. You can change the percentage as well as set a normal ring to switch back to if you want. Just edit the numbers and save the file.

1.make a file called auto_energyring.lua in your magebot folder
2.copy paste the script
3.check scripts[x]
4.click the OFF button next to auto_energyring to turn on
5. if you hit escape you will need to resume the scripts by hitting ~ or clicking resume

Code:
local CLOCK
local gptimer=os.clock()-.40
local energyring=3051
local energyring_active=3088
local normalring=0
local percenthp=40
local checkspeed=.1
local oldnum=0
local oldslot=0
function auto_energyring()
    CLOCK=os.clock()
    if (CLOCK-gptimer<checkspeed) then return 0; end
    gptimer=CLOCK
    if (self.hp<(percenthp*self.hpmax)/100 and self.ring~=energyring) then
        local gp=FindItem(energyring)
        if (gp~=nil) then
            ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,energyring,1)
            oldnum=gp.num
            oldslot=gp.slot
            gptimer=CLOCK+.4
        end
        return
    end
    if (self.hp>self.hpmax-10 and self.ring==energyring_active and normalring>0) then
    local gp=FindItem(normalring)
        if (gp~=nil) then
            ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,normalring,1)
        end
        return
    end
    if (self.hp>self.hpmax-20 and self.ring==energyring_active and normalring==0) then
        print("unloading")
        ThrowItemItoC(SLOT_RING,oldnum,oldslot,energyring_active,1)
        gptimer=CLOCK+1
    end
end
    
    
SetTimerCallback("auto_energyring")
Reply
05-04-2014, 01:02 AM,
#2
RE: auto_energyring
do not have a tutorial on how to activate the file. lua with magebot? I can explain how this script is executed Sad
Reply
05-08-2014, 09:30 AM,
#3
RE: auto_energyring
ill try to make one at some point. what happened when you checked the Script[x] checkbox?
Reply
06-05-2014, 08:45 AM,
#4
Big Grin  RE: auto_energyring
Hello

How can i active the auto ring script??

Thanks
Reply
06-05-2014, 10:59 AM,
#5
RE: auto_energyring
check the scripts box
maximize the tibia window so you can see the scripts
click the autoring script
Reply
07-08-2014, 11:11 PM,
#6
RE: auto_energyring
script does not work please fix
Reply
10-04-2014, 06:36 PM, (This post was last modified: 10-04-2014, 06:49 PM by djmax1.)
#7
RE: auto_energyring
Not working for me. Client 10.41.
_____________
It's working now. I made something wrong!
Thanx for the script! it's awesome!
Reply
05-05-2017, 01:43 PM,
#8
Thumbs Up  RE: auto_energyring
it actually works

thanks a lot @Lopht !!!!!!!


you're a legend
Reply
05-16-2017, 01:33 AM,
#9
RE: auto_energyring
not work for me, version 10.0
Reply
11-05-2017, 01:20 AM,
#10
RE: auto_energyring
(05-03-2014, 03:33 AM)lopht Wrote: This script loads an energy ring when your hp drops below 40% and unloads it when you heal back to full.  You can change the percentage as well as set a normal ring to switch back to if you want.  Just edit the numbers and save the file.

1.make a file called auto_energyring.lua in your magebot folder
2.copy paste the script
3.check scripts[x]
4.click the OFF button next to auto_energyring to turn on
5. if you hit escape you will need to resume the scripts by hitting ~ or clicking resume

Code:
local CLOCK
local gptimer=os.clock()-.40
local energyring=3051
local energyring_active=3088
local normalring=0
local percenthp=40
local checkspeed=.1
local oldnum=0
local oldslot=0
function auto_energyring()
    CLOCK=os.clock()
    if (CLOCK-gptimer<checkspeed) then return 0; end
    gptimer=CLOCK
    if (self.hp<(percenthp*self.hpmax)/100 and self.ring~=energyring) then
        local gp=FindItem(energyring)
        if (gp~=nil) then
            ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,energyring,1)
            oldnum=gp.num
            oldslot=gp.slot
            gptimer=CLOCK+.4
        end
        return
    end
    if (self.hp>self.hpmax-10 and self.ring==energyring_active and normalring>0) then
    local gp=FindItem(normalring)
        if (gp~=nil) then
            ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,normalring,1)
        end
        return
    end
    if (self.hp>self.hpmax-20 and self.ring==energyring_active and normalring==0) then
        print("unloading")
        ThrowItemItoC(SLOT_RING,oldnum,oldslot,energyring_active,1)
        gptimer=CLOCK+1
    end
end
    
    
SetTimerCallback("auto_energyring")

Hey, can you help me on something?
I'd like to throw back my ring(id9585) when my HP is full again
how can I do that?
I'd really appreciate it. Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)