processAutoStatsRaise/processAutoSkillsRaise & teleport

This place is for Closed bug reports only. NOT for asking help!

Moderators: Moderators, Developers

Message
Author
Shadow7
Human
Human
Posts: 25
Joined: 03 Dec 2009, 12:30
Noob?: No

processAutoStatsRaise/processAutoSkillsRaise & teleport

#1 Post by Shadow7 »

I didn't know where else to post this so here goes.

AI::CoreLogic::processAutoStatsRaise
and
AI::CoreLogic::processAutoSkillsRaise

OK Version: 2.0.2 (Release Candidate) as well as previous versions

As the comment on the function/s says:

Save which stat was raised, so that when we received the "stat changed" packet (00BC?) we can changed $statChanged back to 0 so that kore will start checking again if stats need to be raised. This basically prevents kore from sending packets to the server super-fast, by only allowing another packet to be sent when $statChanged is back to 0 (when the server has replied with a a stat change)

The problem:
Kore doesn't receive the statChanged/skillChanged packet while in the teleporting phase. By teleporting phase I mean the split second wherein you teleport and your screen fades and its as if for that moment your character doesn't exists and you will not be able to receive any packets. (Well think of it as that; although I do know teleport is based on warp) The point is when that happens processAutoStatsRaise and processAutoSkillsRaise will not trigger anymore. (Unless you manually add skills and stats and the server sends you the stat/skillChanged packet)

The suggestion:
If the very purpose of the condition was to prevent kore from sending packets too quickly why not add a timeout of let's say 2 seconds?
That way if ever the kore wasn't able to receive the skill/statChanged packet it will wait out 2 seconds and then be able to add skills and stats instead of getting stuck.

Sidenotes: This problem happens to me frequently because I bot in a map wherein my character must teleport immediately when attacked by monsters.
I wouldn't mind trying to solve this on my own but unfortunately I am not familiar with programming in PERL. Your help will be appreciated very much. ^_^

Mortimal
Developers
Developers
Posts: 389
Joined: 01 Nov 2008, 15:31
Noob?: No

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#2 Post by Mortimal »

Noticed that too... i am looting YGG on high rate server and priest always warping so he can not add points...
Please use pin function for uploading your file contents!

Mushroom
Perl Monk
Perl Monk
Posts: 427
Joined: 04 Apr 2008, 14:04
Noob?: No
Location: Brazil

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#3 Post by Mushroom »

I have the same problem when using tele-search. It would be a good ideia if kore had support for /str, /agi, /vit/, /int, /luk commands. Would make stats adding faster.
Quit.

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#4 Post by Dark Airnel »

I am also experiencing the same error way back.. I should have reported it earlier. I never thought it was an openkore issue and not with the server since I am playing a private server.

Mortimal
Developers
Developers
Posts: 389
Joined: 01 Nov 2008, 15:31
Noob?: No

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#5 Post by Mortimal »

Tomorrow i will try to write sms... And understand how \str+ etc. works
Please use pin function for uploading your file contents!

Shadow7
Human
Human
Posts: 25
Joined: 03 Dec 2009, 12:30
Noob?: No

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#6 Post by Shadow7 »

I am currently testing a fix a tried myself. What I did was I declared 2 global variables in Globals.pm $statTime and $skillTime; in functions.pl in the part that initializes variables I gave them the value time. Finally I changed the trigger of processAutoStatsRaise and processAutoSkillsRaise to
((!$statChanged || timeOut($statTime,1)) && $config{statsAddAuto})
and
((!$skillChanged || timeOut($skillTime,1)) && $config{skillsAddAuto}) respectively.

Before I did though I analyzed if kore would know how much stat points and stat add points it really had. My basis is that when I typed in st or skills it already had the updated stats/skills despite not getting the statChanged or skillChanged packet. I also looked at st if it updated stats by requesting anything in Commands.pm.
I concluded kore would not mess up stat adding or skill adding by using a timeout as a trigger.

I'll probably post my results after xmas :D

Edit: I also forgot to mention that inside each of their respective blocks I assigned the value time to both $statTime and $skillTime to reset the timer.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#7 Post by EternalHarvest »

Maybe better organize checking like that: when raising, remember what raised to which value. Then do nothing until that becomes true. This will remove AI logic from Network, too.

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#8 Post by Technology »

hmm, timeouts are evil, i tend to use as less of them as possible.
Its better to be certain.

To demonstrate my point, what would you prefer:
whenStatusInactive Blessing

or

timeout 240


EDIT: maybe this helps, it was written a long time ago to have some kind of way to save/share builds. ;)
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

Shadow7
Human
Human
Posts: 25
Joined: 03 Dec 2009, 12:30
Noob?: No

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#9 Post by Shadow7 »

Timeouts are evil indeed. Doesn't work with skills, seems to work with stats.
(It keeps on adding a certain skill even if its already the max level)
I was rushing since there's an exp mod on my server.
I'll try what Eternal Harvest suggested. Thanks for the feedback. :D

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: processAutoStatsRaise/processAutoSkillsRaise & teleport

#10 Post by Technology »

Shadow7 wrote:Kore doesn't receive the statChanged/skillChanged packet while in the teleporting phase.
I went out there and tested if this was the case and indeed, Shadow7 has described the problem very well.

EternalHarvest's idea is good, but i doubt this can only be done by only checking both:
- last upgraded skill
- skillvl that we should have

Lets look at the following hypothetical steps that show the flaws:
1) kore sends a packet to level a skill up and saves that skill and its future level
2) kore teleports and therefore leveling up the skill fails (no packet is sent to report failure tho)
3) kore runs processAutoSkillsRaise and checks if the that saved skill is already to its future level, but after such teleport this is not the case

note: the check in 3 is necessary, not only because we don't want to spam packets but also because we need control over exactly how many skillpoints we want to invest in a skill.

Lets move this bug to bug reports.
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

Locked