Page 1 of 1

668 Changelog

Posted: Fri Oct 28, 2011 11:28 pm
by rock5
Mostly just a collection of small changes that have been accumilating in my rom folder. A bit overdue but I kept putting it off until the issues we had with patch 4.03 were resolved and things settled down.
  • Added get 'getHotkeyByName' function to fix problems with users who mess up their key bindings list. This should never happen but 1 user, who copied some files from 1 game installation to another, messed it up and their key bindings list was missing the new 'Partner Bag' binding. So 'Toggle title/guild' wasn't their 49th binding but their 48th. This function solves that and any related future problem by getting the hotkey 'by name'. Note: this is mostly invisible to users.
  • Added 4th argument "range" to player:moveTo() function which effectively makes player:moveInRange obsolete. Also dynamically calculates where to move to when moving into range of a target even if it's moving. Hm.. I should have changed 'moveInRange' to use this.
  • Removed confusing autosell debug message about durability. When using autosell with debugging on, a debug message about durability would be shown for each item even though there was nothing wrong with durability. This caused users to think there was a problem with durability when there was not. So I removed it. A message will still be shown if not sold because of durability.
  • Added autosell debug messages for stats number and item types. When using debug with autosell no messages were shown if items were not sold because of wrong stat number or wrong type. Now they do.
  • Added 'MaxDurability' to inventory items. I noticed that equiped items had max durability but not inventory items, so I added it.
  • Changed item 'BoundStatus' to a byte value. I noticed that the rest of the integer was used for something else so sometimes BoundStatus returned a large value instead of a value from 0 to 3. So changed it to read byte only.
  • Fixed bug that caused bot to remember item stats even though the slot is empty. When an item was removed from a slot, the 'Stats' value was not reset. Now it is.
  • Increased buff limit to 50. Some people can apply more than 20 buffs. When this happened it returned no buffs. This increased limit should fix that.
  • Added better RU support (thx Bot_romka) Some changes by bot_Romka to add Russian language support.
  • Modified object searches so that if you use quotes around and id, it still works. For example, this will work where before it didn't

    Code: Select all

    player:findNearestNameOrId("123456")
  • Added or fixed the following skills in the database; MAGE_STARS_OF_LIGHT, SCOUT_TARGET_LOCK, SCOUT_ARROW_SHIELD, DRUID_SAVAGE_BLESSING, WARDEN_EARTH_SPIRIT_ESSENCE, WARDEN_UNTAMABLE.
  • Fixed issues with COMBAT_DISTANCE, COMBAT_TYPE and COMBAT_RANGED_PULL when changing class (hopefully). Seems to be working correctly now but it's hard to test all scenarios.
  • Added batch files, StartCommandLine.bat, Get_Player_Position.bat and Get_Object_Id.bat. Just a quick way to start those files. Not really neccessary but doesn't hurt to have them.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 12:09 am
by lisa
something got broken in 668 =(

partyhealer 667 works perfectly, 668 it doesn't buff or heal.
I'll see if I can narrow it down but since you did the code for 668 you would probably have a better idea of where to start looking.

It has all the pawn info, prints the player names, so partymember table works. I'll do some testing but just thought I'd let you know.

it all works except for when it does

Code: Select all

player:checkSkills(true);
It doesn't even try to use any skills, turned on skill debug and no prints at all.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 1:30 am
by lisa
Ok I found what makes it stop using skills.

Ok I am using a P/M/S
If you remove the warrior skills section from profile it stops using skills.
have

Code: Select all

	<skills_warrior>

	</skills_warrior>
in profile and it works fine.

I have no idea why removing skills_warrior would make priest skills stop working.
*shrugs*

There is obviously something in the 668 code which is affecting this as I update to 667 and the same profile works fine with or without skills_warrior.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 1:43 am
by rock5
That gives me a clue. There was something I changed relating to the skills table. I'll have a look.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 2:02 am
by lisa
Yeah when I printed the skills table it didn't seem to have the actual skill information from memory, just the stuff in database/profile.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 3:01 am
by rock5
Try changing line 2652 of player.lua

Code: Select all

	if self.Class1 ~= oldclass or (#settings.profile.skills == 0 and #settings.profile.skillsData ~= 0) then
to

Code: Select all

	local skillDataCount = 0
	for k,v in pairs(settings.profile.skillsData) do skillDataCount = skillDataCount + 1 end
	if self.Class1 ~= oldclass or (#settings.profile.skills == 0 and skillDataCount ~= 0) then

Re: 668 Changelog

Posted: Sat Oct 29, 2011 3:15 am
by lisa
Removed the skills_warrior and it was casting skills as it should.

If you are doing a commit can you remove the cooldown from this

Code: Select all

	<skill name="KNIGHT_HOLY_SEAL" id="491368" mana="30"  type="buff" buffname="501772" target="self" />
For some reason it had cooldown of 300 when there is no cooldown, duration is 300 though.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 3:48 am
by rock5
In the olden days when buffs weren't checked, sometimes 'duration' and 'cooldown' were used interchangably. And it worked ok. When I added the buff checks I cleared out all the durations but this was left because it was written as a cooldown.

Well that's what I think happened anyway.

I'll add it to my next commit.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 5:47 am
by rock5
Ok commited to rev 669, but did it a different way.

So, there's no easy way to count the items in a table but turns out there's an easy way to tell if a table is empty. "next(table)" returns nil if empty. That's what I used. I'm so happy I found that. I'm going to remember that for future use.

Re: 668 Changelog

Posted: Sat Oct 29, 2011 4:13 pm
by Administrator
rock5 wrote: So, there's no easy way to count the items in a table
Why doesn't #tablename work?

Re: 668 Changelog

Posted: Sat Oct 29, 2011 9:49 pm
by rock5
Administrator wrote:
rock5 wrote: So, there's no easy way to count the items in a table
Why doesn't #tablename work?
No. That only counts numbered items in table and only those in consecutive order from 1. So if

Code: Select all

tablename = {[4]=stuff,[5]=stuff}
Which is what happened in my case, then

Code: Select all

#tablename 
will give '0'.

That's why it only worked for Lisa if she had the warrior skills section included. Warrior class is 1. Therefore there would have been a [1]= in the table so #tablename returned a value > 0.

'next(tablename)' returns the first value regardless of the types.

Re: 668 Changelog

Posted: Sun Oct 30, 2011 11:42 pm
by lisa
hmm seems when waitforloadingscreen is in action the keys to stop or pause MM won't work. End or ctrl + L don't do anything.

Re: 668 Changelog

Posted: Mon Oct 31, 2011 7:33 am
by rock5
I've noticed that too but I've found that even if nothing appears in the mm window, it stops anyway or eventually shows the "Paused" text eventually. It probably has to do with the fact that I changed waitforloadingscreen to not yield. Pausing must happen during yield.

Yielding during loading screen was removed because any code or userfunctions that use timer events might try to access inaccessable areas of memory or do a RoMScrpt commands, during the loading screen.

So I'm not sure what can be done. Is there a way to make the bot react to keypresses such as the End key without yielding to other code such as userfunctions?

Re: 668 Changelog

Posted: Mon Oct 31, 2011 1:28 pm
by Administrator
rock5 wrote:So I'm not sure what can be done. Is there a way to make the bot react to keypresses such as the End key without yielding to other code such as userfunctions?
No, I don't think so. But, I figured it should still be running the function to check for those hotkeys every few lines with a debug hook.

Re: 668 Changelog

Posted: Mon Oct 31, 2011 9:46 pm
by rock5
I'm not sure what you mean by 'debug hook'. Are you saying it checks for those keypresses occationally even though the waitForLoadingScreen doesn't yield?

Re: 668 Changelog

Posted: Wed Nov 02, 2011 8:36 am
by Administrator
rock5 wrote:I'm not sure what you mean by 'debug hook'. Are you saying it checks for those keypresses occationally even though the waitForLoadingScreen doesn't yield?
It should be. A hook is used so that every 10 lines, it will check for global hotkeys (CTRL+L, start/stop keys) even if you do not yield. This was done to help prevent scripts from going out of control (such as infinite loops).

Re: 668 Changelog

Posted: Wed Nov 02, 2011 10:35 am
by lisa
when I do a full account on the same WP and it gets to last char, it logs to character select screen and is waiting for the game to log back in. At that stage no keypresses stop the bot. I can either log in any character and then stop bot or I can close MM and execute it again.

Re: 668 Changelog

Posted: Thu Nov 03, 2011 12:29 am
by Administrator
Is the while loop for that perhaps running inside of a coroutine other than the main one? That is, is it running inside a timed function or something?