runFromTarget support in autoSwitch

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Post Reply
Message
Author
fallen
Noob
Noob
Posts: 7
Joined: 06 Apr 2008, 09:01
Noob?: Yes
Location: near respawn at Prontera

runFromTarget support in autoSwitch

#1 Post by fallen »

I wrote a quick patch to add runFromTarget and runFromTarget_dist to the autoSwitch options. It's still experimental, but seems to work OK so far on SVN version.

Dunno if this is the right place to post it, or if there is forms to fulfil - feel free to move/correct me if I am doing anything wrong.

I have 2 situations where this is useful:
- an Auto Spell sage killing geographers (distant cast only, no auto spell :P damn those DEX plants)
- an Exorcist on Pyramids and maps with Drainliars, Familiars and the like - I'd rather use a stunner to kill them than use a Phen accessory (where I play, there is no Phen card drop - only thru ROPs; too expensive to let it get caught on a bot)

There are probably more situations where it could be useful, but those are my motives for patching :)

Enough talk, here is the snippet of code, added in AI.pm.

on function "sub attack", right after the "useWeapon' check in autoSwitches:

Code: Select all

                                if ($config{"autoSwitch_$i"."_useWeapon"} ne "") {
                                        $ai_v{'attackUseWeapon'} = $config{'attackUseWeapon'};
                                        $config{'attackUseWeapon'} = $config{"autoSwitch_$i"."_useWeapon"};
                                        message TF("Change Attack useWeapon to : %s\n", $config{'attackUseWeapon'}), "equip";
                                }
                                # Patch starts here
                                if ($config{"autoSwitch_$i"."_runFromTarget"} ne "") {
                                        $ai_v{'runFromTarget'} = $config{'runFromTarget'};
                                        $config{'runFromTarget'} = $config{"autoSwitch_$i"."_runFromTarget"};
                                        message TF("Change runFromTarget to : %s\n", $config{'runFromTarget'}), "equip";
                                }
                                if ($config{"autoSwitch_$i"."_runFromTarget_dist"} ne "") {
                                        $ai_v{'runFromTarget_dist'} = $config{'runFromTarget_dist'};
                                        $config{'runFromTarget_dist'} = $config{"autoSwitch_$i"."_runFromTarget_dist"};
                                        message TF("Change runFromTarget_dist to : %s\n", $config{'runFromTarget_dist'}), "equip";
                                }
                                # Patch ends here
                                last AUTOEQUIP;
A little bit further down, there is the ai_v "restore" code. Again, right after the useWeapon check:

Code: Select all

                if ($ai_v{'attackUseWeapon'} ne "" && $config{'attackUseWeapon'} != $ai_v{'attackUseWeapon'}) {
                        $config{'attackUseWeapon'} = $ai_v{'attackUseWeapon'};
                        message TF("Change Attack useWeapon to default : %s\n", $config{'attackUseWeapon'}), "equip";
                }
                # Patch starts here
                if ($ai_v{'runFromTarget'} ne "" && $config{'runFromTarget'} != $ai_v{'runFromTarget'}) {
                        $config{'runFromTarget'} = $ai_v{'runFromTarget'};
                        message TF("Change runFromTarget to default : %s\n", $config{'runFromTarget'}), "equip";
                }
                if ($ai_v{'runFromTarget_dist'} ne "" && $config{'runFromTarget_dist'} != $ai_v{'runFromTarget_dist'}) {
                        $config{'runFromTarget_dist'} = $ai_v{'runFromTarget_dist'};
                        message TF("Change runFromTarget_dist to default : %s\n", $config{'runFromTarget_dist'}), "equip";
                }
                # Patch ends here
        } #END OF BLOCK AUTOEQUIP
And now the configuration example:

Code: Select all

autoSwitch Geographer,Flora {
        useWeapon 0          
        runFromTarget 1
        runFromTarget_dist 6
}
I would appreciate your thoughts on this.
Image

shakespeare
Noob
Noob
Posts: 8
Joined: 08 Apr 2008, 01:03
Noob?: Yes
Location: PH
Contact:

Re: runFromTarget support in autoSwitch

#2 Post by shakespeare »

i like this idea ^^
Im A Darkmoon Fan ^_^

Bibian
Perl Monk
Perl Monk
Posts: 416
Joined: 04 Apr 2008, 03:08

Re: runFromTarget support in autoSwitch

#3 Post by Bibian »

you might want to post a diff file and test it in every possible way.
we'll commit it if we think its usefull and working properly

kali
OpenKore Monk
OpenKore Monk
Posts: 474
Joined: 04 Apr 2008, 10:10

Re: runFromTarget support in autoSwitch

#4 Post by kali »

Post a diff, I'll move it to the commit queue.

Time to wake up :P
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

ulun
Noob
Noob
Posts: 6
Joined: 22 Feb 2009, 08:23
Noob?: Yes

Re: runFromTarget support in autoSwitch

#5 Post by ulun »

Nice implementation :) I look forward at this.

User avatar
help_us
Testers Team
Testers Team
Posts: 106
Joined: 04 Apr 2008, 21:53
Noob?: No
Location: Asia
Contact:

Re: runFromTarget support in autoSwitch

#6 Post by help_us »

AI.pm already changes
Image
Image

Post Reply