question that might not have an answer

new topic     » topic index » view thread      » older message » newer message

I have a question.  On the mud I am working on, I have a list of mudcommands
that can be done in a data file.  They read into a commands variable, which
looks like this..

commands={command,command,command...}
command={{name of command},{function command should run when typed},{level
player must be to use command}}


I would like for mud-"coders" to be able to add commands "on the fly" from
inside the mud.  I can handle the actual adding of the command easy
enough...on one line, they would simply type:

addcommand <command> <function> <levelreq>

But here's my question.  The functions are referenced by routine_id .  When
any command is typed, the program searches for the command in the data file,
then if found calls the procedure in the 2nd element of that command
sequence by using a routine_id.  So, the functions for the commands are of
course stored within a file..umm...something like commands.e

So, here's the problem.  Coders could physically add the command...but is
there a way to add the function into the .e file from inside the program?  I
THOUGHT about...reading in the entire commands.e file as regular data,
adding the new function to the end as regular data, then saving it again.
First of all, will this even work?  But, secondly, how would you force the
program to re-read that file while it's already running?  I already thought
of the "easy" fix and tried to make a "compile" command from inside the mud
that simply includes the file again.  But, apparently we can't put include
statements inside procedure/functions?  That seemed to be the error I was
getting.  Or, am I wrong about that and there was something else wrong?

Or, perhaps I just want to do the impossible?  But surely, there's some way?

Michelle Rogers

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu