Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Nulvect

Pages: [1]
Drivers / FluffOS feature requests for 2.23+
« on: June 14, 2011, 01:18:18 pm »
  • 1. Compile-time option to enable the use of "struct" as an alias for the "class" type.
  • 2. The ability to turn on tcp-keepalive on a connection. If this has to be a compile-time option that enables keepalives on all connections then so be it, but being able to just call set_keepalive() on a player-by-player basis would be preferrable.

Thanks for any consideration here.

Drivers / time() problem in mudos
« on: March 10, 2011, 06:34:52 pm »
So our hosting provider just updated us from a 2.4 kernel to a 2.6 (without asking), and now time does not proceed in our mud. It's MudOS v22.2b14, but I tried with fluffos 2.21 and it has the same problem.

I tracked it down to the unix time() function which is used to get the current time in mudos and, I presume, fluffos (have not checked fluffos source code yet). You can "man 2 time" in linux to get the man page on this C function.

MudOS port.c, lines 69-72:
Code: [Select]
int get_current_time()
    return (int) time(0l);      /* Just use the old time() for now */

Seems simple enough, right??

Anyone have any clue why this is not working anymore??

General / evaluate() vs (*f)() troubles in MudOS
« on: March 16, 2010, 01:26:23 pm »
So I'm trying to clean up some old code for magical weapons, and we have the following line:
Code: [Select]
x += to_int( call_other(weap, ({ (*f)(), attackers[0] }) ) );
The f variable is a function pointer which is both defined in and owned by the 'weap' object in 99.99% of cases. It is bound to the weapon using bind() whenever possible. This line works, inexplicably. Writing out (*f)() should call the function at that point, replace it with its return value (which is an int), then try to do call_other(weap, ({ 35, attackers[0] }) ) or some such which would return 0 since there's no function named 35. But it doesn't; it works, and adds the return value of the function f to the x variable, though the function does not actually get the attackers[0] as an argument.

I decided to fix this with a more easily read line:
Code: [Select]
x += to_int( evaluate(f, attackers[0]) );
Which has utterly failed to work, even if I remove the attackers[0] function argument. The function f is never called. So the code that should not be working, is, and the code that should be, is not. I've verified that the f is indeed a function pointer and not a string, double checked the man page and the code for call_other to be sure it cannot accept function pointers or ints as arguments, done several tests, and never gotten an error message. I'm baffled.

Can anyone shed some light on this from another point of view? MudOS v22.2b14, highly modified NM3 lib.

Hello everyone,

I am one of the admins on Primal Darkness, a dark fantasy MUD that has been around since 2000. We have a medium-sized world and a small but steady player base, and we're looking to increase both of those!

Currently there are only a few active coders and we'd like to add another. Our mudlib was originally Nightmare 3, but it has been (and continues to be) heavily modified. The driver is a recent, stable build of MudOS. We only need one more coder for the time being, and s/he would be working under the two admins with a healthy mix of specific projects and doing your own thing. I'm more than willing to teach LPC techniques, but you should know some LPC already and, preferably, good programming practices in general. This is a live MUD so it's important to keep bugs, slowdowns, and crashes to a bare minimum! This position would work on almost anything, potentially - new backend systems, cleaning up existing code, new and useful commands, running events, etc.

To expand the world, we are looking for a full time builder. Creativity and drive are the most important things to have here - we can teach you how to build and take care of any complicated stuff. We do not currently have any OLC system setup, though it's planned to have one eventually. This person would usually just have to clear his/her areas with the admins - there will be few assigned projects. Also important for this position are good grammar and spelling.

Lastly, we're always looking for more players, so anyone who wants to drop by and try us out can do so at port 5000. We have over 20 races, over 20 classes, and a world ready for you to get lost in.

Anyone looking to apply for a position should contact myself or Stormbringer on the mud. You can also email me at the address listed in my profile.

Drivers / MudOS and FluffOS: member_array and 'class' type
« on: October 18, 2008, 12:36:25 pm »
MudOS v22.2b14.

I've defined a class in a header file like so:
Code: [Select]
class Effect {
  // members, not important

In a lib file, I created an array of this type and want to see if a certain class variable is in the array:
Code: [Select]
class Effect *AllEffects;
  if (member_array(thiseffect, AllEffects) != -1)

That member_array always returns -1. I had to write a loop to compare it; == works fine.

Upon inspection of the member_array definition in efuns_main.c, it does not handle the class type _at all_. I also checked fluffos 2.13 and it does not handle classes either. This is just FYI for anyone else who may encounter this problem, as well as a possible feature req/bug report for FluffOS.

Drivers / very odd mudos segfault
« on: March 28, 2008, 07:10:22 pm »
In a piece of code I'm writing, I'm using an anonymous function like so:

Code: [Select]
// first populate the object array "allitems"
// bag is an object
allitems = filter(all_inventory(bag), (:
  (!($1->query_property("no steal")) && $1->get())
:) );

// I calculate the value of tmp here, shouldn't be important

allitems = sort_array(allitems,
  function (object a, object b, tmp) {
    int aw = a->query_weight();
    int bw = b->query_weight();
    mapping acv = a->query_curr_value();
    mapping bcv = b->query_curr_value();
    int agv = (acv && acv["gold"] ? acv["gold"] : 0);
    int bgv = (bcv && bcv["gold"] ? bcv["gold"] : 0);
    aw -= agv;
    bw -= bgv;
    aw -= bw;
    aw = aw + random(tmp) - random(tmp);

    if (aw < 0) return -1;
    else if (aw > 0) return 1;
    else return 0;

When I try to update this file, the mud segfaults. MudOS v22.2b14. Odd things: It doesn't matter whether the file successfully updates or not. It segfaulted both with syntax errors and without. Also, it sometimes takes a few heart_beats before it crashes.

I have gotten it to work by taking the anonymous function and making it a separate function, then calling it, like so:
Code: [Select]
int sortitems(object, object, int);

allitems = sort_array(allitems, (: "sortitems" :), tmp);

int sortitems(object a, object b, int tmp) {
  // exact same contents as the anonymous function posted above

Has anyone else had this sort of thing happen?? I use anonymous functions fairly often, does anyone have any tips on how to avoid this thing in the future??

Code Vault / string macros
« on: March 06, 2008, 10:14:01 pm »
This function can be used to make your own string macros:

Code: [Select]
varargs string expandos(string str, object tgt) {
  string del = "$";
  mapping macros = ([
    "N" : (: this_player() ? this_player()->query_cap_name() : "" :),
    "T" : (: $(tgt) ? $(tgt)->query_cap_name() : "" :),
    "SHORT" : (: query_short() :),

  // always double check the input
  if (nullp(str)) return "";
  if (nullp(tgt)) tgt = 0;

  foreach (string mac, mixed f in macros)
    str = replace_string(str, del+mac, evaluate(f));

  return str;

This is very useful for setting up new lib objects with customizable strings. The example includes an optional parameter, this is not really needed if you set your objects up correctly. Any variables used inside a functional (that you don't declare in that functional) must be in the form $(varname). Possible uses for this:

Code: [Select]
set_long(expandos("A very small $SHORT."));

set_emotes(3, ({ expandos("$N growls.") }), 1);

message("combat", expandos("$N smacks $T across the face!"), environment(this_player()), ({ this_player(), tgt }) );

I know some libs have a built in form of this, but not all do. I hope someone finds this useful.
I release this into the public domain blah blah etc.

General / name generator
« on: September 21, 2007, 04:31:27 pm »
I'm thinking of coding a name generator in LPC that people can use when connecting. After finding and reading the history of, I think I have a good idea of where to start: syllables and rules for putting them together.

Perhaps like this:

Code: [Select]
string *vowels = ({
  "a", "e", "i", "o", "u", "y",

string *consonants = ({
  "b", "c", "d", "f", "g", "h", "j", "k", "l", "m",
  "n", "p", "q", "r", "s", "t", "v", "w", "x", "z",
  "ya", "ye", "yi", "yo", "yu",

mapping syllable_rules = ([
  "bla" : ([
    "before" : ({ "C", "i", "u" }),
    "after" : ({ "V", "b", "l", "r" })
  "hor" : ([
    "before" : ({ "a", "d", "k", "n" }),
    "after" : ({ "V", "s", "t", "c" }),

int is_vowel(string c) { return member_array(c, consonants) == -1; }

Basically, grab a random syllable, then grab another random one to add to the end, check if the new one fits the "after" rule of the first one, and if the first one fits the "before" rule of the new one, and if so, put them together. Random name length, biased toward medium, with a maximum. C stands for any consonant and V for any vowel.

What I'm looking for is anyone who's done this sort of thing before and any advice they might have. This basically falls into the realm of language parsing, with which I have very little experience. Will I be fiddling with the rules and adding new syllables until the day I die?? Or is it possible to get a fairly good generator without devoting months of my life??

Dead Souls Support / Seg faults on 64-bit
« on: November 12, 2006, 08:02:28 pm »

I am testing DS 2.1.1 on SuSe 10.1 (64-bit) environment and I keep getting seg faults. Under gdb, I found this error:

This GDB was configured as "x86_64-suse-linux"...Using host libthread_db library "/lib64/".

"/home/test/mud/ds/ds2.1.1/bin/mudos.cfg" is not a core dump: File format not recognized

Any ideas on how to fix this to run under 64-bit environments?

-- M

Pages: [1]