Page 1 of 1

Changing Profile setting back

Posted: Mon Nov 07, 2011 9:24 pm
by imaginethat
hi
I am wanting to know if there is a way of setting profile settings back to the orginal settings listed in the profile document once you change them using code in a function.
example:
Profile.xml contains

Code: Select all

		<option name="COMBAT_TYPE"        value="melee" />	<!-- leave empty or choose ranged/melee if not using class default -->
		<option name="COMBAT_RANGED_PULL" value="false" /> <!-- only important for melees -->
		<option name="COMBAT_DISTANCE"    value="200" />
		<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" />
I am wanting to change the "COMBAT_DISTANCE" to something very small due to the area the bot is running through, as attacking distant mobs pulls the bot away from the waypoints too much, and gets stuck trying to get back to the narrow path it needs to travel through.
So I use

Code: Select all

changeProfileOption("COMBAT_DISTANCE", 30);
How do I get this setting back to what it is listed in the profile.xml once the bot gets past the narrow path?

I already know some of you are going to say just use type="RUN" or "TRAVEL", but there are other things I want to do this way, like increasing the amount of potions to buy before heading somewhere I know there are no health potions available, but setting it back to 'normal' profile settings once back to a place where there are easy access to potions.

I know I could just set it to the same value as in the profile, but that means I have a hard coded value in my function that will not work across various characters using this same function.

Also on a side note, what is the difference between COMBAT_DISTANCE and MAX_TARGET_DIST. If bot is targeting something, that seems like combat to me. I'm sure there is a valuable distance, so keen to find out.

cheers

Re: Changing Profile setting back

Posted: Mon Nov 07, 2011 9:59 pm
by lisa
Before you change the value just save the value to a variable.

Code: Select all

_combat = settings.profile.options.COMBAT_DISTANCE
changeProfileOption("COMBAT_DISTANCE", 30);
then when you want to change it back do

Code: Select all

changeProfileOption("COMBAT_DISTANCE", _combat);
That will probably work.



max target distance is the distance it will decide to attack the mob.
if set to 200 and mob is distance 210 then it won't attack it

combat distance is the distance bot will move to when it goes to attack.
if set to 180 and mob is distance 200 then it will move closer until distance is 180.

Re: Changing Profile setting back

Posted: Mon Nov 07, 2011 11:30 pm
by imaginethat
Awesome
thanks for that Lisa, and the explanation of combat and max_target.