1. RE: question that might not have an answer
euphoric wrote:
>
>
> Michelle Rogers wrote:
<snip>
> > 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>
> >
> >
> You need some sort of internal EU interpreter, because the code you
> add will be stored in variables or in a data file... it won't
> become a physical part of the program; it won't be additional lines
> of code.
>
> David Cuny has an interpreter, I think, or Pete or somebody else. :)
You might be interested in euscript, which is based on David's
interpreter. You can get it from my web page:
http://www14.brinkster.com/matthewlewis/projects.html
IIRC, someone (Greg Haberek?) was improving euscript. To see it in
action, you can check out EDB (also on my page). I use euscript to
allow user defined event handling in database forms.
Matt Lewis
2. RE: question that might not have an answer
On 12 Jan 2004, at 15:11, Matt Lewis wrote:
>
>
> euphoric wrote:
> >
> >
> > Michelle Rogers wrote:
>
> <snip>
>
> > > 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>
> > >
> > >
> > You need some sort of internal EU interpreter, because the code you
> > add will be stored in variables or in a data file... it won't
> > become a physical part of the program; it won't be additional lines
> > of code.
> >
> > David Cuny has an interpreter, I think, or Pete or somebody else. :)
>
> You might be interested in euscript, which is based on David's
> interpreter. You can get it from my web page:
>
> http://www14.brinkster.com/matthewlewis/projects.html
>
> IIRC, someone (Greg Haberek?) was improving euscript. To see it in
> action, you can check out EDB (also on my page). I use euscript to
> allow user defined event handling in database forms.
Matt, on-the-fly additions, or additions and then shutting down the app and
restarting before the new code is runable?
Kat
3. RE: question that might not have an answer
Kat wrote:
>
>
> On 12 Jan 2004, at 15:11, Matt Lewis wrote:
>
> >
> > You might be interested in euscript, which is based on David's
> > interpreter. You can get it from my web page:
> >
> > http://www14.brinkster.com/matthewlewis/projects.html
> >
> > IIRC, someone (Greg Haberek?) was improving euscript. To see it > > in
> > action, you can check out EDB (also on my page). I use
> > euscript to allow user defined event handling in database forms.
>
> Matt, on-the-fly additions, or additions and then shutting down the
> app and restarting before the new code is runable?
On-the-fly additions. euscript is just David Cuny's eu.ex reworked into
an include file. In fact, you can have multiple, compartmentalized
scripts.
In order for it to meaningfully work with your application, you need to
provide an API into your code (calling functions, changing data, etc).
Basically, you provide a routine name, type (function or procedure), the
number of arguments and a routine id, and then it's visible to your
script. Changing variables must be handled indirectly (i.e., you need
to provide get/set routines to handle this).
The code isn't as robust as it could be. Your application could crash
after some script errors. For instance, there is no typechecking of
arguments when calling an external function. Part of the reason for
this is that it wasn't implemented by David (or Delroy, who took it over
at one point) and I don't understand how it all works well enough to do
this.
Matt Lewis
4. RE: question that might not have an answer
Michelle Rogers wrote:
>
>
> 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
>
>
Maybe, when a new command is entered, the program could do the
following:
1. Write the new command in commands.e
2. Save the state of the game.
3. Restart the game automatically and abort the original one.
4. Load the previous version of the game.
That way maybe the new command would be registered.
Don't know if it would work ok for you, but that's my idea. Hope it
helps.
Phil