Page 1 of 1

Attempt to compare string with number error during fight

Posted: Fri Jul 01, 2011 3:32 am
by Questionmark
After botting Miller's Farm for a while I wanted to make a waypoint file for the 200%/400% TP weekend, but when my character attacks a mob, the bot stops and shows an error (as attached). I've searched the forum, but I can't find a suitable solution.

Profile file

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<profile>
	<options>
		<!-- Try the bot with a new char mage                   -->
		<!-- At the pioneer village. Use demo.xml waypoint file -->
		<option name="HP_LOW" value="75" />
		<option name="MP_LOW_POTION" value="50" />
		<option name="HP_LOW_POTION" value="50" />
		<option name="USE_HP_POTION" value="best" />	<!-- potion select strategy: best|minstack -->
		<option name="USE_MANA_POTION" value="best" />	<!-- potion select strategy: best|minstack -->

		<!-- Rest if HP or Mana is below that level -->
		<option name="HP_REST" value="25" />
		<option name="MP_REST" value="25" />

		<!-- Shopping options, how many of what do you want to keep in your inventory -->
		<option name="HEALING_POTION" value="0" />
		<option name="MANA_POTION" value="0" />
		<option name="ARROW_QUIVER" value="0" />
		<option name="THROWN_BAG" value="0" />
		<option name="POISON" value="0" />
		<option name="EGGPET_HOE" value="99" />
		<option name="EGGPET_SPADE" value="99" />
		<option name="EGGPET_HATCHET" value="0" />
		<option name="INV_AUTOSELL_ENABLE" value="true" />
		<option name="INV_MAX_SLOTS" value="180" />
		<option name="INV_AUTOSELL_FROMSLOT" value="1" />
		<option name="INV_AUTOSELL_TOSLOT" value="180" />
		<option name="INV_AUTOSELL_QUALITY" value="white,green,blue" />
		<option name="INV_AUTOSELL_IGNORE" value="" />
		<option name="INV_AUTOSELL_TYPES" value="Armor,Others,Weapons" />
		<option name="INV_AUTOSELL_TYPES_NOSELL" value="" />
		<option name="INV_AUTOSELL_NOSELL_DURA" value="" />
		<option name="INV_AUTOSELL_STATS_NOSELL" value="XI" />
		<option name="INV_AUTOSELL_STATS_SELL" value="Energy,Acumen,Solidity,Custodian,Barricade,Growth,Life,Capability,Spell,Wizardry,Earth,Whiff,Flame,Mist,Dark,Light,Element" />

		<!-- either false or arrow or thrown -->
		<option name="RELOAD_AMMUNITION" value="thrown" />	<!-- false|arrow|thrown -->

		<!-- Combat options -->
		<option name="COMBAT_TYPE" value="" />	<!-- leave empty or choose ranged/melee if not using class default -->
		<option name="COMBAT_RANGED_PULL" value="true" /> <!-- only important for melees -->
		<option name="COMBAT_DISTANCE" value="150" />
		<option name="MAX_FIGHT_TIME" value="15" />	<!-- Max time without damage before break -->
		<option name="DOT_PERCENT" value="90" />
		<option name="ANTI_KS" value="true" />
		<option name="MAX_TARGET_DIST" value="225" />

		<!-- Attack monsters 3 levels above or 10 below your level -->
		<option name="TARGET_LEVELDIF_ABOVE" value="3" />
		<option name="TARGET_LEVELDIF_BELOW" value="10" />

		<!-- Waypoint and movement settings -->
		<option name="WAYPOINTS" value="" />  <!-- leave empty to show a list -->
		<option name="RETURNPATH" value="" />
		<option name="PATH_TYPE" value="waypoints" />	<!-- waypoints | wander -->
		<option name="WANDER_RADIUS" value="500" />
		<option name="WAYPOINT_DEVIATION" value="25" />
		<option name="QUICK_TURN" value="true" />

		<!-- Loot settings -->
		<option name="LOOT" value="true" />
		<option name="LOOT_ALL" value="true" />
		<option name="LOOT_IN_COMBAT" value="false" />
		<option name="LOOT_DISTANCE" value="225" />
		<option name="LOOT_PAUSE_AFTER" value="0" />		<!-- probability in % for a short rest -->
		<option name="LOOT_AGAIN" value="1000" />

		<!-- Harvest options -->
		<option name="HARVEST_DISTANCE" value="200" />
		<option name="HARVEST_WOOD" value="false" /> <!-- Choose which types to harvest. -->
		<option name="HARVEST_HERB" value="true" /> <!-- "true" = harvest, "false" = do not harvest -->
		<option name="HARVEST_ORE" value="true" />

		<!-- Eggpet options -->
		<option name="EGGPET_ENABLE_ASSIST" value="true" />
		<option name="EGGPET_ASSIST_SLOT" value="1" />
		<option name="EGGPET_ENABLE_CRAFT" value="true" /><!-- If using same slot for assist and craft, onlt 1 can be enabled. -->
		<option name="EGGPET_CRAFT_SLOT" value="2" />
		<option name="EGGPET_CRAFT_RATIO" value="1:0:1" /> <!-- mining:woodworking:herbalism ratio to produce. -->
		<option name="EGGPET_CRAFT_INDEXES" value="" /> 	 <!-- override auto craft index for mining,woodworking,herbalism eg. "2,,"-->


		<!-- Log out and resurrect settings -->
		<option name="LOGOUT_TIME" value="0" />	<!-- in minutes, 0 = timer disabled -->
		<option name="LOGOUT_SHUTDOWN" value="false" />
		<option name="LOGOUT_WHEN_STUCK" value="true" />
		<option name="CLOSE_WHEN_STUCK" value="true" />
		<option name="RES_AUTOMATIC_AFTER_DEATH" value="true" />
		<option name="MAX_DEATHS" value="10" /> <!-- Log out after this many deaths -->
	</options>

	<friends>
		<friend name="Stone Armored Rhino" />
		<friend name="Ailic Rune Scholar" />
		<friend name="Ailic Botanist" />
		<friend name="Ailic Historian" />
		<friend name="Sandstone Messenger" />
		<friend name="Garrison Soldier" />
	</friends>

	<mobs>
		<mob name="" />
	</mobs>

	<hotkeys>
		<hotkey name="MACRO" modifier="" key="VK_J" />
	</hotkeys>

	<!-- define your skills depending from your actual primary class -->
	<!-- see the example for a priest/mage                           -->
	<!-- delete skills you don't have or don't want to use.          -->
	<!-- For more skills to use see /database/skills.xml             -->
	<!-- demo skills for LvL 1 character for all classes             -->

	<skills_warrior>
		<skill name="ROGUE_SHADOWSTAB" modifier="" hotkey="VK_2" priority="110" />
		<skill name="WARRIOR_SLASH" modifier="" hotkey="VK_3" priority="90" />
		<skill name="WARRIOR_MOON_CLEAVE" modifier="" hotkey="VK_4" priority="80" />
		<skill name="WARRIOR_BLASTING_CYCLONE" modifier="" hotkey="VK_5" priority="70" />
		<skill name="WARRIOR_BLOOD_DANCE" modifier="" hotkey="VK_6" priority="60" />
		<skill name="WARRIOR_OPEN_FLANK" modifier="" hotkey="VK_7" priority="50" />
		<skill name="WARRIOR_PROBING_ATTACK" modifier="" hotkey="VK_8" priority="40" />
		<skill name="WARRIOR_KEEN_ATTACK" modifier="" hotkey="VK_9" priority="30" />
		<skill name="WARRIOR_SPLITTING_CHOP" modifier="" hotkey="VK_0" priority="20" />
	</skills_warrior>

	<skills_scout>
		<skill name="SCOUT_WIND_ARROWS" modifier="" hotkey="VK_1" priority="110" />
		<skill name="SCOUT_AUTOSHOT" modifier="" hotkey="VK_2" priority="90" />
		<skill name="SCOUT_COMBO_SHOT" modifier="" hotkey="VK_3" priority="80" />
		<skill name="SCOUT_VAMPIRE_ARROWS" modifier="" hotkey="VK_4" priority="70" />
<!--	<skill name="SCOUT_SHOT" modifier="" hotkey="VK_5" priority="60" />
		<skill name="SCOUT_SNIPE" modifier="" hotkey="VK_6" priority="50" />
		<skill name="WARRIOR_SLASH" modifier="" hotkey="VK_7" priority="40" /> -->
	</skills_scout>
	
	<skills_rogue>
		<skill name="ROGUE_SHADOWSTAB" modifier="" hotkey="VK_1" priority="110" />
		<skill name="ROGUE_LOW_BLOW" modifier="" hotkey="VK_2" priority="90" />
		<skill name="ROGUE_WOUND_ATTACK" modifier="" hotkey="VK_3" priority="80" />
	</skills_rogue>

	<onLoad><![CDATA[
	]]></onLoad>

	<onDeath><![CDATA[
	]]></onDeath>

	<onLeaveCombat><![CDATA[
		player:lootAll();
		catchCavy();
	]]></onLeaveCombat>

	<onLevelup><![CDATA[
	]]></onLevelup>

	<onSkillCast><![CDATA[
	]]></onSkillCast>

	<onHarvest><![CDATA[
	]]></onHarvest>
</profile>
Waypoint file

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<onLoad>
		changeProfileOption("MAX_TARGET_DIST", 150);
		changeProfileOption("WAYPOINT_DEVIATION", 25);
		changeProfileOption("HEALING_POTION", 99);
	</onLoad>
	<!-- #  1 --><waypoint x="-15562" z="39804" y="606">
		player:merchant("Fadiya Royil");
		yrest(100);
		sendMacro("ChoiceOption(1);");
		yrest(100);
	</waypoint>
	<!-- #  2 --><waypoint x="-15648" z="39901" y="606">	</waypoint>
	<!-- #  3 --><waypoint x="-15516" z="40224" y="596" tag="Fight">	</waypoint>
	<!-- #  4 --><waypoint x="-15399" z="40433" y="612">	</waypoint>
	<!-- #  5 --><waypoint x="-15411" z="40720" y="613">	</waypoint>
	<!-- #  6 --><waypoint x="-15404" z="40905" y="621">	</waypoint>
	<!-- #  7 --><waypoint x="-15360" z="41233" y="658">	</waypoint>
	<!-- #  8 --><waypoint x="-15471" z="41392" y="649">	</waypoint>
	<!-- #  9 --><waypoint x="-15671" z="41310" y="631">	</waypoint>
	<!-- # 10 --><waypoint x="-15773" z="41158" y="616">	</waypoint>
	<!-- # 11 --><waypoint x="-15984" z="40980" y="619">	</waypoint>
	<!-- # 12 --><waypoint x="-16188" z="40752" y="610">	</waypoint>
	<!-- # 13 --><waypoint x="-16457" z="40601" y="613">	</waypoint>
	<!-- # 14 --><waypoint x="-16664" z="40631" y="628">	</waypoint>
	<!-- # 15 --><waypoint x="-16741" z="40323" y="616">	</waypoint>
	<!-- # 16 --><waypoint x="-16705" z="40119" y="615">	</waypoint>
	<!-- # 17 --><waypoint x="-16538" z="40037" y="613">	</waypoint>
	<!-- # 28 --><waypoint x="-16248" z="40014" y="633">	</waypoint>
	<!-- # 19 --><waypoint x="-15730" z="40058" y="606">
		local occupiedSlots, totalSlots = sendMacro("GetBagCount();");
		if (totalSlots > occupiedSlots) then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("Fight"));
		else
			__WPL:setWaypointIndex(__WPL:findWaypointTag("NPC"));
		end
	</waypoint>
	<!-- # 20 --><waypoint x="-15590" z="39822" y="606" tag="NPC">	</waypoint>
</waypoints>

Re: Attempt to compare string with number error during fight

Posted: Fri Jul 01, 2011 4:18 am
by rock5
How did you end up getting a "table range not found" error? That should all be fixed now. And how did you end up with the skills MaxHpPer, player.HP or player.MaxHP being a string?

Are you sure all your files are ok? Are there any with yellow or red icons?

Re: Attempt to compare string with number error during fight

Posted: Fri Jul 01, 2011 4:52 am
by Questionmark
Because of the error I've removed the entire rom folder, made a new one and did a SVN checkout (http://rom-bot.googlecode.com/svn). So I should have the latest files. And no, there are no yellow or red icons. Probably due to the 'reinstall'.

Re: Attempt to compare string with number error during fight

Posted: Fri Jul 01, 2011 5:23 am
by rock5
The nI'd say there is probably something wrong with the waypoint file or profile, probably the profile, but I can't tell what. Try running with the default profile or start the bot with debug on to see if it gives more information.

Code: Select all

rom/bot debug

Re: Attempt to compare string with number error during fight

Posted: Fri Jul 01, 2011 7:13 am
by Questionmark
Well, I seem to got it running again or so I thought. I've changed the following option.

From

Code: Select all

<option name="TARGET_LEVELDIF_ABOVE" value="3" />
To

Code: Select all

<option name="TARGET_LEVELDIF_ABOVE" value="5" />
The mobs I was fighting were sometimes more than 3 levels higher, but after a few kills I encountered a new error (see attachment). Something in the "classes/pawn.lua" file. This is the line...

Code: Select all

	self.TargetPtr = memoryReadRepeat("int", proc, self.Address + addresses.pawnTargetPtr_offset);

Re: Attempt to compare string with number error during fight

Posted: Fri Jul 01, 2011 8:14 am
by rock5
Questionmark wrote: Well, I seem to got it running again or so I thought. I've changed the following option.

From

Code: Select all

<option name="TARGET_LEVELDIF_ABOVE" value="3" />
To

Code: Select all

<option name="TARGET_LEVELDIF_ABOVE" value="5" />
I don't see how that could cause the error you were getting but if your not getting that error anymore...
Questionmark wrote: after a few kills I encountered a new error (see attachment). Something in the "classes/pawn.lua" file. This is the line...

Code: Select all

	self.TargetPtr = memoryReadRepeat("int", proc, self.Address + addresses.pawnTargetPtr_offset);
A failure to read memory doesn't necessarilly mean there is anything wrong with the code. Most likely something just interfered with the reading of memory. I'm not sure what that could have been. Maybe you were doing something else that stressed the pc resources or a temporary glitch in the game or running too many programs at once or anything really.

Re: Attempt to compare string with number error during fight

Posted: Fri Jul 01, 2011 12:21 pm
by Questionmark
Thanks for your help.

Re: Attempt to compare string with number error during fight

Posted: Mon Jul 04, 2011 6:52 am
by Questionmark
rock5 wrote:And how did you end up with the skills MaxHpPer, player.HP or player.MaxHP being a string?
After some testing it seemed that the W/R elite skill Blood Dance is causing this problem.

Re: Attempt to compare string with number error during fight

Posted: Mon Jul 04, 2011 7:43 am
by lisa
skills database has this

Code: Select all

<skill name="WARRIOR_BLOOD_DANCE" range="50" cooldown="8" maxhpper="-5" type="damage" target="enemy" />
interesting to use maxhpper -5, the skill does use 5% hp per use.
Setting to -5 though is a weird way of doing it, can you even have a -5% of maximum hp?
0 = dead
100 = full
where would -5 fall into it?

Re: Attempt to compare string with number error during fight

Posted: Mon Jul 04, 2011 3:03 pm
by Questionmark
Ofcourse, the "-5" is parsed as a string, because of the minus. I'm not using that anyways, but I'll remove that option and see if it works. The "maxhpper" option is kind of weird anyway, isn't it? The wiki says the following about the "hpper" option...
Percentage of HP to use the skill at. Your HP % must be below that level (or above if using '!' eg. "!50") to use the skill. This will over-ride HP_LOW for heals!
Therefor using the skill at a certain HP wouldn't make any sense at all, because it uses 5% HP and should not be activated at a certain % of HP. What would be interesting is that if I would have 5% HP and use this skill, would it kill me? That would something to protect the character from.

Re: Attempt to compare string with number error during fight

Posted: Mon Jul 04, 2011 5:10 pm
by Administrator
If it doesn't mater, then 0 HP would be fine. Since it uses 5%, I think a requirement of 5% would make sense. Anything would be better than -5.

Re: Attempt to compare string with number error during fight

Posted: Mon Jul 04, 2011 6:20 pm
by MiesterMan
Wouldn't it be !5 then? Might want to make it !6 because I don't know if this skill can suicide the caster or not.

Edit: On second thought something like !20 might be better. The bot only does what you tell it too, might be a good idea to use the same logic that you would play with.

Re: Attempt to compare string with number error during fight

Posted: Tue Jul 05, 2011 1:14 am
by rock5
"!20" doesn't sound bad. I'm committing stuff soon. Should I change it to that? How you tested it? Does it work well?

Re: Attempt to compare string with number error during fight

Posted: Tue Jul 05, 2011 5:08 pm
by Questionmark
rock5 wrote:"!20" doesn't sound bad. I'm committing stuff soon. Should I change it to that? How you tested it? Does it work well?
I noticed that you've changedthe value for Blood Dance in patch 613. I'll test it within a few days, being busy at the moment. I will post my feedback here.

Re: Attempt to compare string with number error during fight

Posted: Tue Jul 05, 2011 7:48 pm
by rock5
Yeh I decided to just add it anyway. If it doesn't work we could always fix it later. After all, it wasn't working the way it was anyway.

Re: Attempt to compare string with number error during fight

Posted: Wed Jul 06, 2011 11:03 pm
by rock5
Another post caused me to look at the code that deals with maxhpper and it looks like -5 was correct. It should have worked. I don't think !20 will work. This still needs to be solved.

Edit: I spoke too soon. Looks like the bot convrts '!' to '-' so either will work. But still, that means the orifinal -5 should have worked.

Re: Attempt to compare string with number error during fight

Posted: Sun Jul 17, 2011 7:34 am
by Questionmark
As promised, my feedback. And I can keep it short. It is still giving me the same "attempt to compare string with number" error as I posted before.

Re: Attempt to compare string with number error during fight

Posted: Sun Jul 17, 2011 8:23 am
by lisa
did you try it without the maxhpper in the skills database like you said you were going to?

Re: Attempt to compare string with number error during fight

Posted: Sun Jul 17, 2011 10:34 am
by lisa
I lvled a char to 25/25 W/R to test this and maxhpper="-20" works fine...
!20 errors

Re: Attempt to compare string with number error during fight

Posted: Sun Jul 17, 2011 11:20 am
by rock5
lisa wrote:I lvled a char to 25/25 W/R to test this and maxhpper="-20" works fine...
!20 errors
Ok, had a closer look. Looks like !20 would work if used in the profile but not in the database.