Buffing yourself - question on some code
Posted: Thu Mar 26, 2009 5:45 pm
So i was looking at the code, and wanted to know if this would work, because i wasn't sure how/where it would reset self.Buff1LastUseTime, it was just rewritten from self.PotionLastUseTime. Just modified the potion usage so that instead of checking to see if the potion timer had run out, if the timer on the buff had run out. I wasn't sure how to access the skills that are listed, so if anyone has a better way or any suggestions feel free to post them. This one was for something that would be on a set timer that would expire after x seconds.
So my main questions for this is where would i call the function so that it would buff me the first time. i tried to put in a line so when it started it just used "keyboardPress(settings.profile.hotkeys.Buff1.key);" but then every second it would try to cast the buff. Then once it casts the buff, how do you start the timer so that it starts to count down (or will this happen based on what i have). Sorry havent done much with lua, most of my experience has come from AutoIt.
In player.lua
In character.xml
in Pawn.lua
So my main questions for this is where would i call the function so that it would buff me the first time. i tried to put in a line so when it started it just used "keyboardPress(settings.profile.hotkeys.Buff1.key);" but then every second it would try to cast the buff. Then once it casts the buff, how do you start the timer so that it starts to count down (or will this happen based on what i have). Sorry havent done much with lua, most of my experience has come from AutoIt.
In player.lua
Code: Select all
-- Check if you need to rebuff
function CPlayer:checkBuff1()
-- Still cooling down, don't use.
if( os.difftime(os.time(), self.Buff1LastUseTime) < settings.profile.options.Buff1_DURATION ) then
return;
else
local modifier = settings.profile.hotkeys.Buff1_Duration
if( modifier ) then keyboardHold(modifier); end
keyboardPress(settings.profile.hotkeys.Buff1.key);
if( modifier ) then keyboardRelease(modifier); end
end
endCode: Select all
<option name="Buff1_DURATION" value="1800" />
<hotkey name="Buff1" key="VK_0" modifier="" />Code: Select all
self.Buff1LastUseTime = 0;