collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: load/reload module  (Read 1674 times)

0 Members and 1 Guest are viewing this topic.

Offline Agnot

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
load/reload module
« 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


Offline Nytridr

  • BeBot Expert
  • ****
  • Posts: 262
  • Karma: +0/-0
    • Rising Sun
Re: load/reload module
« Reply #1 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.

This was back in 2005 when it was touched on.

Nyt
Co-Prez of Rising Sun RK1 (1st & only org I will ever belong to)

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: load/reload module
« Reply #2 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.

Offline Agnot

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: load/reload module
« Reply #3 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.


 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 661
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal