blueboy / portal

This portal repo is for development purposes only
http://github.com/blueboy/portal
GNU General Public License v2.0
27 stars 24 forks source link

Save Automatic Follow Distance toggle status to SQL #31

Closed blueboy closed 11 years ago

blueboy commented 11 years ago

Following the recent commit for 'auto equip', I thought it might be a good idea to save and restore the bot(s) Automatic Follow Distance to the database too.

o Default FollowAutoGo , can be FOLLOWAUTOGO_RUN (Enabled) or FOLLOWAUTOGO_OFF (Disabled). o I first assigned meaningful enum labels to replace the existing FollowAutoGo values. o Save bot(s) FollowAutoGo as the feature is toggled by command >follow auto. o Restore the bot(s) FollowAutoGo values, using command >resumeorders It was important to associate the FollowAutoGo values with meaningful combat orders. If we were to restore without appropriate orders, (via say BotDataRestore()) the bot(s) may behave very strangely. o Create subcommand 'info' for 'follow' command, to show Automatic Follow Distance toggle status.

You can setup a macro to provide useful information. Once you set combat orders in-game, they will be remembered for future sessions so it not necessary to include these setting in the macro.

/p resumeorders // restore previous combat orders /p equip info // show 'auto equip' status /p follow info // show 'auto follow' status

I have a working patch and I would be interested in your thoughts.

Cheers

Gitch commented 11 years ago

I've enjoyed watching the updates. Sadly, I'm so busy lately I just don't have the time to dive back into it myself.

Maybe at some point i can. Glad to see all the work still going on!

Gitch

On 7/25/2012 7:32 PM, blueboy wrote:

Following the recent commit for 'auto equip', I thought it might be a good idea to save and restore the bot(s) Automatic Follow Distance to the database too.

o Default FollowAutoGo , can be FOLLOWAUTOGO_RUN (Enabled) or FOLLOWAUTOGO_OFF (Disabled). o I first assigned meaningful enum labels to replace the existing FollowAutoGo values. o Save bot(s) FollowAutoGo as the feature is toggled by command >follow auto. o Restore the bot(s) FollowAutoGo values, using command >resumeorders It was important to associate the FollowAutoGo values with meaningful combat orders. If we were to restore without appropriate orders, (via say BotDataRestore()) the bot(s) may behave very strangely. o Create subcommand 'info' for 'follow' command, to show Automatic Follow Distance toggle status.

You can setup a macro to provide useful information. Once you set combat orders in-game, they will be remembered for future sessions so it not necessary to include these setting in the macro.

/p resumeorders // restore previous combat orders /p equip info // show 'auto equip' status /p follow info // show 'auto follow' status

I have a working patch and I would be interested in your thoughts.

Cheers


Reply to this email directly or view it on GitHub: https://github.com/blueboy/portal/issues/31

blueboy commented 11 years ago

Hi Gitch, Good to see you're still about ;) and always welcome, should you wish to take a dip in the future. I'm not sure whether you got the notification about the change in forum address (email has been problematic). If not, it can be found at http://playerbot.mine.nu Take care...

kennumen commented 11 years ago

Sounds great. Didn't follow the run-through fully, but push the code (don't tease) and I'll have a look and test :)

Good to hear from you, Gitch.

blueboy commented 11 years ago

It was not my intention to tease (I wasn't sure how important this was, that's why I asked) or confuse, but I think I was a little unclear ;) The Automatic Follow Distance ( >follow auto ) does not need combat orders set to work. However if you are saving the AFD status to the 'playerbot_saved_data' table there must be a record present for the bot(s) to store the value. New bot records are only created the first time combat orders are set, so if the record does not exist then the AFD status will not be remembered (The same is true for the 'Equip Auto' status). I chose to restore the AFD status via >resumeorders because of this association, so always set combat orders at least once.

I have now pushed the patch to the 'new-ai' for you guys to test

Hope you like it ;)

kennumen commented 11 years ago

I would have gone another way. If the record is not present, call a 'reset CO' function first which, if it doesn't already, sets everything to 0 (or adding 0's if the record doesn't exist yet). Anyway, developer's taste and I'm just glad I didn't have to code it :p

One question though - the first time I read the 'follow info' description I was under the impression it would output both the status of the toggle as well as the actual, numeric follow distance (which can be altered with near/far/reset). And now I'm trying to come up with a reason for why it might be undesirable - would it be confusing? Or should we just output the distance? It certainly couldn't hurt for debugging; Would it add to the end-user experience?

kennumen commented 11 years ago

Updated without SQL - failed to start (as intended). Used update r5, worked great. Everything else appears to work.

Would prefer you not close the issue before my previous reply is discussed out (but I leave that up to you).

blueboy commented 11 years ago

I have now updated the 'follow info' command to show bot distance from the master. The distance value is colour coded (hot/cold) with the closest distance being red and the furthest being blue. As you quite rightly pointed out, this could be used a debug tools should the bot(s) go astray.

Enjoy ;)