View Single Post
Old 03-15-2009, 03:27 PM   #21
Fizban
Member
 
Join Date: Jul 2006
Name: Brandon
Location: Shelby Township, Michigan
Home MUD: The Builder Academy
Home MUD: 4 Dimensions
Posts: 144
Fizban is on a distinguished road
Re: Revolutionary New OLC and Scripting

NIMScripts command functions do not replace existing mud commands by default, a special call to "return(1)" alerts the MUD that it should not continue looking for other commands (command syntax properly entered, so stop here) -- if this is not used, the command executes and then the mud continues to the next command. So, in effect, you can override or augment standard commands like 'wear', 'lock', 'drop', 'get' etc by adding a command like this to a "prop" (similar to Diku "object")

DG can do this as well. DG overrides the actual mudcommand by default, but can be set not to.

A few examples below:

That script fires if they type look with no argument, ie. to look at the room. They would get that message in place of seeing the room as would usually occur.

This script is the same as the one before except it triggers when anything is typed by players in the room. (arg list of * does this). It then checks what they typed against the command interpreter and if it would be interpreted as 'look' the "if %cmd.mudcommand% == look" part of the first if check is true. As such this one fires when they type l, lo, loo, or look if all of those would make them look if the script wasn't there. The return 0 in the else tells the script to pass the players input to the MUD as if the script wasn't there so that it doesn't interfere with commands other than 'look'.

This one sends the message in addition to showing them the room as usual due to the return 0 at the top passing the input to the command interpreter in addition to anything the script is doing.

Note: I'm not trying to one up NIMSCript, I'm really mostly comparing because it piques my interest as well, to the best of my knowledge DG was what I'd always considered to be, by far, the most advanced scripting used in any DIKU derived codebase that wasn't just an existing language embedded into the MUD. (ie, I'm not comparing it non mud-specific languages like lua which can be embedded.)
Fizban is offline   Reply With Quote