View Single Post
Old 02-05-2009, 03:43 AM   #3
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Post Re: Revolutionary New OLC and Scripting

I have to admit it's still being worked on. There are some definite kinks. The bug I found today: if you hurt() in a script, destroying the target, the variable points to a bad part of memory when you next dereference it. Yay. Crashed the MUD hard. This will be fixed soon I hope.

I plan to implement only bug fixes in the hard code. I've noticed I've written a lot but not all of it functions as expected, so that's the only changes I will be making from here on out: making it do what it says it does and making it work as expected. Yes, I'm done adding features.

The latest updates not even available yet on SourceForge include fixes to the magic and spell system that I have put off for years. Today I added 6 (yes 6!!) spells, one creates an object, 3 are offensive and 2 create mobs. Once the kinks are ironed out I will be pumping out 100+ spells for an upcoming release demonstrating all of the features of NiMUD.

-------

The most advanced features of NiMUD currently are still amazing to use. I'm particularly fond of the "TRACE" feature which permits an immortal to "act out" the actions of a scripted actor in the game. Once in TRACE mode (by typing "trace" from within the script editor), everything you do is recorded and stored in the script.

The way I usually create one of these is by creating a new script and then adding the first line:

autowait (25);

This is a good pace for a script. I then exit the editor and type the 'trace' command to enter 'trace' (or 'tracing') mode.

When I'm done acting out the set of activities, I type 'trace' in the script editor one more time to exit this mode and it stops recording my actions.

I used this method to create the adventurer guide. I was able to walk for a great distance within the MUD and the adventurer makes it to his destination.

At the end of this script I wrap it up by adding these lines by hand:

do({:waves and heads back to the Inn.});
jump(5005);

At this point, I made sure all the settings were correct, created a couple accompanying scripts that help the player participate, and polished it off with a self-test.

I've made several interesting areas with this method and with other scripting features. There are even some room creating features I haven't used in a while that are pretty cool, like the programmable map-room feature.

------

Adding a spell is easy! First, create the spell, then create a script that will be the actions of the caster. I was able to add a creature summoning spell, an offensive spell and a spell that creates an ice sword all with this method. I've created several functions that incorperate the features of the components and gem magick systems.

if ( reagents( mana, reglist ), { goto({cast}); }, { goto({failed} } );
<- tests to see if the caster has everything they need
mix(mana, reglist);
<- casts the actual spell, consuming the reagents

and

if ( gem({f|w|e|a},20), { goto({cast}); }, { goto({failed}); } );

where gem consumes any available mana stored in magic gems

Example: Water-elemental Spell Summons Water Spirit
locke is offline   Reply With Quote