BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Module Requests => Topic started by: Agnot on September 26, 2008, 10:30:13 pm

Title: load/reload module
Post by: Agnot on September 26, 2008, 10:30:13 pm
Ideally we wouldn't need to keep restarting the bot to fix code and have it tested. I realize %restart should work but at the moment mine doesn't (but that's besides the point as %shutdown works fine) but even if it did that would require taking the bot down during the operation.

thinking something like:
!reload <code.php>
!unload <code.php>
!load <code.php> //for if a file was placed in the custom folder AFTER boot startup

This would allow for ingame reloading of specific module codes say in the "custom" folder for instance to save actual coders from having to continually restart the bot to test functionality.

Now if there's already a function for this disregard this post please

Title: Re: load/reload module
Post by: Nytridr on September 26, 2008, 11:55:17 pm
This was kind of touched on earlier and I will just quote it for you.

Quote
Few nice things there, some of which i had planned myself.

As for reloading modules while running, its unfortunately not easilly done with interpreted languages. I seem to recall a discussion on the Ruby mailing list not too long ago about it being theoretically possible to archieve something close to "reloading" methods, but it wasnt exactly easy to archieve. And im not sure that approach discussed would even be possible with PHP, given PHP isnt even designed to be a scripting language on the level where its used today.

 Here is the thread for it, check what Khalem said about it. (http://bebot.link/feedback-and-suggestions/suggestions-for-next-version/)

This was back in 2005 when it was touched on.

Nyt
Title: Re: load/reload module
Post by: Alreadythere on September 27, 2008, 12:17:36 am
I don't know any way in php to reload an already defined class during runtime. Which means I don't think true reloading of code will be possible - at all.

I got some ideas about allowing enabling and disabling of loaded modules during runtime though, this could solve some of the reasons for restarts. No promises about any timeframes though.
Title: Re: load/reload module
Post by: Agnot on October 29, 2008, 07:47:59 pm
Thank you for the replies.

Alreadythere: an idea - perhaps allow the classes to have a variable such as Status which would flag as either 0/1 or true/false and before the bot actually tries to call the function and methods within it would check if the flag was enabled. So if the class is flagged as being disallowed the execution would stop at an if(allow == true) if it was disabled. This would allow such things later such as !disable abused/broken_module_name_here on the fly which is also useful.

Interesting thread Nytridr. Seems what Nik_Doof was thinking was a link/delink functionality by eval() which doesn't sound fun.

Going to think this over a bit more. Sadly work and RK4 haven't offered me a lot of time to just dabble with code much.

SimplePortal 2.3.7 © 2008-2024, SimplePortal