Page 2 of 2

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 6:10 am
by Administrator
Check the timing in CPlayer:cast(). If it takes that long between casts, I assume you're lagging quite a bit and it's messing up the timing between casts.
So, I'm assuming sitting does nothing for HP/MP recovery rate?
I'm fairly new to this game so I'm still figuring out basics like these :P
Pretty much. Sitting is useless. There's no point to it when it does almost nothing for you and potions are easily and cheaply available.
can I setup if checks for target debuffs and stack ammounts to setup decent dps rotations for my knight?
Yes, kind of. But it is going to require a lot of modification. I had added some code to automatically acquire buff/debuff information for the player and his target, but it resulted in performance issues. You could maybe look at the function for updating buffs/debuffs in pawn.lua and player.lua.

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 6:30 am
by Esiw
Administrator wrote:Check the timing in CPlayer:cast(). If it takes that long between casts, I assume you're lagging quite a bit and it's messing up the timing between casts.
Oh yeah, found the part, I'll mess around with it, thanks ^_^
Administrator wrote:
So, I'm assuming sitting does nothing for HP/MP recovery rate?
I'm fairly new to this game so I'm still figuring out basics like these :P
Pretty much. Sitting is useless. There's no point to it when it does almost nothing for you and potions are easily and cheaply available.
can I setup if checks for target debuffs and stack ammounts to setup decent dps rotations for my knight?
Yes, kind of. But it is going to require a lot of modification. I had added some code to automatically acquire buff/debuff information for the player and his target, but it resulted in performance issues. You could maybe look at the function for updating buffs/debuffs in pawn.lua and player.lua.
Looking at pawn now, looks like it's already implemented? What am I missing here (probably a lot, as easy as lua seems to be- I've never attempted it before).
I can't just go if (target.Debuffs["Light Seal III"] = true) then { in the onSkillCast part? :P

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 7:04 am
by Administrator
The calls to the function to prep that data has been disabled because of reasons before. If you want to use it, you'll have to call that function on the player's target (target = player:getTarget(); target:updateBuffs()).

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 8:17 am
by Esiw
Administrator wrote:The calls to the function to prep that data has been disabled because of reasons before. If you want to use it, you'll have to call that function on the player's target (target = player:getTarget(); target:updateBuffs()).
That's what I've understood so far, but I'm not sure where I can call the function from/at, and in what format I should use the other functions from it in the actual xml?

I havent gotten anywhere so far really because the bot keeps whining about my onSkillCast code :(
Can I call it right from there (my profile xml)? or should I perhaps embed it somewhere in the player cast part of the player lua (and could I then only use the target.Debuffs("whatever") right in the xml after that? would that even be the correct way to use that function?)? et.c. (heh)
Would cutting off the buff check and only keep the debuff check help performance any?

Sorry if I'm pestering you :twisted:

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 8:31 am
by d003232
Administrator wrote:Check the timing in CPlayer:cast(). If it takes that long between casts, I assume you're lagging quite a bit and it's messing up the timing between casts.
So, I'm assuming sitting does nothing for HP/MP recovery rate?
I'm fairly new to this game so I'm still figuring out basics like these :P
Pretty much. Sitting is useless. There's no point to it when it does almost nothing for you and potions are easily and cheaply available.
I check the sit_or_stand thing today and was surprised. It seem now that the regeneration if sitting is about double as high as if we stand. I tested some coding in the bot and it seems to work. Although there is no way to check if we sit or stand. And I don't really like the idea of all the bot sitting around without any potions. :-)

And for the casting thing. We could examine if we could cast 100 ms or 200 ms faster. I suppose there would be something possible if we switch the internal cooldown to ms instead of seconds. But first we would had to check the reason for your long casting wait time. I will look if I could insert some debugging code to have better possibilities to examine that.

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 9:39 am
by d003232
Administrator wrote:Check the timing in CPlayer:cast(). If it takes that long between casts, I assume you're lagging quite a bit and it's messing up the timing between casts.
I did a change with SVN 330. We now already cast if the wait time is equal the cooldown. And it seems that by that, we sometimes cast half a second faster (without getting a 'not ready' message ingame).

I now want to check the waiting time at a ms level. Perhaps we could also reduce the wait time 100 or 200ms without getting a 'not ready' message.

@admin: I have problems with the 'getTime()' function. That returns a table value? So I can't do

Code: Select all

self.LastCastTime = getTime() + self.CastTime*1000;
Is there another function to get a ms time value?

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 10:15 am
by Administrator
Can I call it right from there (my profile xml)? or should I perhaps embed it somewhere in the player cast part of the player lua (and could I then only use the target.Debuffs("whatever") right in the xml after that?
It depends how you want to use it. The easiest way would be in onSkillCast.

Code: Select all

<onSkillCast>
if( arg1.Name == "CLASS_SKILLNAME" ) then
  local target = player:getTarget();
  target:updateBuffs();

  if( target.Debuffs["Something"] ) then
    player:cast("CLASS_SOMESKILL");
  end
end
</onSkillCast>
@admin: I have problems with the 'getTime()' function. That returns a table value? So I can't do

Code: Select all

self.LastCastTime = getTime() + self.CastTime*1000;
Is there another function to get a ms time value?
The table is really just a 64bit value. It contains a high part and a low part; each 4 bytes. Rather than applying different values to the table, you should use it to get the difference between two points in time using deltaTime() as follows:

Code: Select all

local timeDifference = deltaTime(getTime(), self.LastCastTime); -- get the difference in miliseconds
if( timeDifference*1000 > self.CastTime ) then
  -- do something
end

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 10:21 am
by d003232
Administrator wrote:

Code: Select all

local timeDifference = deltaTime(getTime(), self.LastCastTime); -- get the difference in miliseconds
if( timeDifference*1000 > self.CastTime ) then
  -- do something
end
The problem is to add the 'self.CastTime' ( a number value) to the 'self.LastCastTime' ( a table value after initialize it with 'getTime()'. That's the way at the moment how the bot remembers the last casting time.

I will try to think about that this evening. Now I have a little troublemaker next to me.

Re: Crash on running rom\bot.lua? Halp!

Posted: Tue Oct 06, 2009 8:47 pm
by Esiw
Administrator wrote:

Code: Select all

<onSkillCast>
if( arg1.Name == "CLASS_SKILLNAME" ) then
  local target = player:getTarget();
  target:updateBuffs();

  if( target.Debuffs["Something"] ) then
    player:cast("CLASS_SOMESKILL");
  end
end
</onSkillCast>
That's the code I've been trying to use but;
if I have that code and have my abilities listed as normal in my profile,
I can't figure out any way for it to stop using those abilities randomly ASWELL as accoarding to my onSkillCast (if I add something like inbattle="false" then it will ignore my onSkillCast instructions, if I move the abilities to <hotkey> and change it to key=" then I get the same results.

Oh and btw, I basically removed the yrests from player:cast and it did wonders for my melee character (assuming I can get the debuff check working) although I should probably put one or two back in to be a bit mana conservative... I still can't figure out how to make spell casting better though, maybe it waits until the game tells you it's done casting, even if you can start casting earlier than that (which is what I assumed to be latency)- I've been trying a couple of things to make it attempt to start casting faster (through for example, a difftime with -500 or so on skill.casttime but I don't think I'm doing it right)

Also haha oh wow knight is insanely self substaining with mana back + priest regenerate :D

Re: Crash on running rom\bot.lua? Halp!

Posted: Wed Oct 07, 2009 5:26 am
by d003232
Esiw wrote:mana conservative... I still can't figure out how to make spell casting better though, maybe it waits until the game tells you it's done casting, even if you can start casting earlier than that (which is what I assumed to be latency)- I've been trying a couple of things to make it attempt to start casting faster (through for example, a difftime with -500 or so on skill.casttime but I don't think I'm doing it right)
I will add a new SVN version this evening, where you can set a 'minus x ms' factor to cast a little earlier. And you are right. The 'self.Casting' flag could also be a handicap. But first I wan't to see the effect from using internaly ms instead of sec.

Re: Crash on running rom\bot.lua? Halp!

Posted: Wed Oct 07, 2009 5:33 am
by d003232
Esiw wrote:I can't figure out any way for it to stop using those abilities randomly ASWELL as accoarding to my onSkillCast (if I add something like inbattle="false" then it will ignore my onSkillCast instructions, if I move the abilities to <hotkey> and change it to key=" then I get the same results.
I don't unserstand what you mean with 'randomly'? The event could only have effects after the correconding skills are used. You could add some

Code: Select all

printf("%s\n", variabletosee);
into the event to see, when it is used? And you could post the according MM window content if there is something wrong.

Re: Crash on running rom\bot.lua? Halp!

Posted: Wed Oct 07, 2009 7:22 am
by Esiw
d003232 wrote:
Esiw wrote:I can't figure out any way for it to stop using those abilities randomly ASWELL as accoarding to my onSkillCast (if I add something like inbattle="false" then it will ignore my onSkillCast instructions, if I move the abilities to <hotkey> and change it to key=" then I get the same results.
I don't unserstand what you mean with 'randomly'? The event could only have effects after the correconding skills are used. You could add some

Code: Select all

printf("%s\n", variabletosee);
into the event to see, when it is used? And you could post the according MM window content if there is something wrong.
Randomly in the sense that it "sometimes" attempts to use Punishment and Mana Return when the target debuff doesnt fill the requirements for those two abilities to do anything.

So it's SEEMINGLY random :P

I'm not saying that the current way it's handeled is wrong or anything, Administrator mentioned earlier that he had the mechanics for a debuff check in place but it caused performance issues- I'm assuming that the current state of the bot is just the other way of dealing with that problem versus the game mechanics.

d003232 wrote:
Esiw wrote:mana conservative... I still can't figure out how to make spell casting better though, maybe it waits until the game tells you it's done casting, even if you can start casting earlier than that (which is what I assumed to be latency)- I've been trying a couple of things to make it attempt to start casting faster (through for example, a difftime with -500 or so on skill.casttime but I don't think I'm doing it right)
I will add a new SVN version this evening, where you can set a 'minus x ms' factor to cast a little earlier. And you are right. The 'self.Casting' flag could also be a handicap. But first I wan't to see the effect from using internaly ms instead of sec.
Oh cool, I'll update it then.

Re: Crash on running rom\bot.lua? Halp!

Posted: Wed Oct 07, 2009 5:17 pm
by Administrator
Esiw wrote: So it's SEEMINGLY random :P

I'm not saying that the current way it's handeled is wrong or anything, Administrator mentioned earlier that he had the mechanics for a debuff check in place but it caused performance issues- I'm assuming that the current state of the bot is just the other way of dealing with that problem versus the game mechanics.
Post a copy of your profile.

Re: Crash on running rom\bot.lua? Halp!

Posted: Thu Oct 08, 2009 8:25 am
by d003232
With SVN 326 you can test the new skill use timing functionality. There is a new profile option

Code: Select all

<option name="SKILL_USE_PRIOR"	value="300" />
With that you can say the bot to cast x ms earlier (before cooldown is finished) and to leave the 'casting time wait coding' x ms earlier. The default value is 300ms.

You can test, what's the best value to cast more earlier.

Does anyone knows, how much the general cooldown value between using skills is?

There are also some new debugging options

Code: Select all

	<onLoad>
		-- 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);

		settings.profile.options.DEBUG_SKILLUSE.ENABLE = true;
		settings.profile.options.DEBUG_SKILLUSE.TIMEGAP = true;
		settings.profile.options.DEBUG_SKILLUSE.ONCOOLDOWN = true;
		settings.profile.options.DEBUG_SKILLUSE.HPLOW = false;

	</onLoad>
You can enter them in your profile (but in the onload event) to see the time-gaps between casts and the value in ms we are below or over an cooldown. I would recommend to delete all buff skills in your profile for testing purpose. Just to not be spammed with messages to much.