Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Been Gone for while
« Last post by Adam on August 30, 2018, 07:54:13 PM »
Hi Stanach,
not too much has changed. at the moment life has caught up with a lot of us and keeping us busy. especially cratylus dead souls is still supported but there haven't been any recent releases.

stay tuned tho :)
2
General / Been Gone for while
« Last post by stanach on August 22, 2018, 09:46:31 PM »
Well I have been gone for a while. I return to see what is new in the mud world. So dead souls --->dead?  No more updates etc
3
Code Vault / Re: Yet Another Startup Script
« Last post by Adam on August 21, 2018, 12:00:52 AM »
A++ For Effort  :)
4
Code Vault / Yet Another Startup Script
« Last post by quixadhal on July 01, 2018, 02:49:17 PM »
So, I generally hate those dumb "looping" startup scripts that keep restarting your MUD in a while loop.  A while ago I wrote a very small one that just did "start" "stop" and "status".

For some reason, while watching the world cup game the other day, I decided to pretty it up and add a couple more little features.....  FOOL!

It's a bit big now, but it was fun messing around with bash scripting again.

Code: [Select]
#!/bin/bash

# These should be the only lines you need to configure.
M_DIR="/home/quixadhal/dw/bin"
M_CFG="$M_DIR/dw.cfg"

# The rest of this should be fine.
SCRIPT="$0"
CMD="$1"

D_PORT=`grep <"$M_CFG" external_port_1 | awk '{print $NF}'`
A_PORT=`grep <"$M_CFG" 'address server port' | awk '{print $NF}'`
G_DRIVER="$M_DIR/driver $M_CFG"
G_ADDR="$M_DIR/addr_server $A_PORT"

function get_status() {
    HEADER=`ps -auxwwww | head -1`
    DRIVER=`ps -auxwwww | grep "$G_DRIVER" | grep -v "grep $G_DRIVER" | head -1`
    ADDR=`ps -auxwwww | grep "$G_ADDR" | grep -v "grep $G_ADDR" | head -1`
    D_PID=`echo $DRIVER | awk '{print $2}'`
    A_PID=`echo $ADDR | awk '{print $2}'`
    CRON_HEADER='# m h  dom mon dow   command'
    CRON_START_ENTRY=`crontab -l | grep "$SCRIPT start" | head -1`
    CRON_STOP_ENTRY=`crontab -l | grep "$SCRIPT stop" | head -1`

    if [ -n "$D_PID" ]; then
        D_RUNNING="The driver is running on port $D_PORT"
    else
        D_RUNNING="The driver is not running"
    fi
    if [ -n "$A_PID" ]; then
        A_RUNNING="The address server is running on port $A_PORT"
    else
        A_RUNNING="The address server is not running"
    fi
}

function start_up() {
    get_status
    if [ -z "$ADDR" ]; then
        echo "Launching address server..."
        $M_DIR/addr_server $A_PORT >/dev/null 2>&1 &
        sleep 1
    fi
    if [ -z "$DRIVER" ]; then
        echo "Launching driver..."
        $M_DIR/driver $M_CFG >/dev/null 2>&1 &
        sleep 1
    fi
}

function shut_down() {
    get_status
    if [ ! -z "$D_PID" ]; then
        echo "Halting driver... $D_PID"
        kill "$D_PID"
        sleep 1
    fi
    if [ ! -z "$A_PID" ]; then
        echo "Halting address server... $A_PID"
        kill "$A_PID"
        sleep 1
    fi
}

function display_usage() {
    echo "Usage: $SCRIPT [start|stop|status|schedule|unschedule]"
}

function display_help() {
    echo ""
    echo "This is a quick and dirty tool to let you start and stop"
    echo "an LPMUD running under the FluffOS game driver."
    echo ""
    display_usage
    echo ""
    echo "    help          - This detailed man page."
    echo "    start         - Starts the address server and game driver."
    echo "    stop          - Tries to halt the address server and game driver."
    echo "    status        - Displays process information about both."
    echo "    schedule      - Creates a cron entry to start or stop the mud."
    echo ""
    echo "                    Format:   [start|stop] <hour> <minute>"
    echo "                              The hour and minute argument sare both"
    echo "                              required, and should either be numbers"
    echo "                              with hour [0-23] and minute [0-59], or"
    echo "                              a valid crontab range may be specified."
    echo "                              Whitespace is NOT allowed."
    echo "                    Example:  bash% (set -f; mud schedule start * */15)"
    echo "                              The () are needed to not screw up file"
    echo "                              globbing in your main shell"
    echo ""
    echo "    unschedule    - Removes all cron entries."
    echo ""
}

function display_status() {
    get_status
    echo ""
    if [ -n "$D_PID" -o -n "$A_PID" ]; then
        echo "$HEADER"
        echo "$DRIVER"
        echo "$ADDR"
        echo ""
    fi
    echo "$D_RUNNING"
    echo "$A_RUNNING"
    if [ -n "$CRON_START_ENTRY" -a -n "$CRON_STOP_ENTRY" ]; then
        echo "Schedule:"
        echo "$CRON_HEADER"
        echo "$CRON_START_ENTRY"
        echo "$CRON_STOP_ENTRY"
    elif [ -n "$CRON_START_ENTRY" ]; then
        echo "Schedule:"
        echo "$CRON_HEADER"
        echo "$CRON_START_ENTRY"
        echo "No crontab halt schedule exists"
    elif [ -n "$CRON_STOP_ENTRY" ]; then
        echo "No crontab startup schedule exists"
        echo "Schedule:"
        echo "$CRON_HEADER"
        echo "$CRON_STOP_ENTRY"
    else
        echo "No crontab startup schedule exists"
        echo "No crontab halt schedule exists"
    fi
    echo ""
}

function is_numeric() {
    if [ -n "$1" ]; then
        [[ $1 =~ ^[0-9]+$ ]] && { return 0; } || { return 1; }
    fi
    return 1;
}

function is_crontab_format_numeric() {
    if [ -n "$1" ]; then
        if is_numeric "$1"; then
            # plain old numbers are fine
            return 0;
        elif [[ $1 =~ ^[0-9]+(,[0-9]+)*$ ]]; then
            # cron accepts numbers with commas as lists
            return 0;
        elif [[ $1 =~ ^\*(/[0-9]+)?$ ]]; then
            # cron accepts */N for divisible numbers
            # and just * for every
            return 0;
        fi
    fi
    return 1;
}

function is_crontab_hour() {
    if [ -n "$1" ]; then
        if is_numeric "$1"; then
            if [ $1 -ge 0 -a $1 -le 23 ]; then
                return 0;
            else
                return 1;
            fi
        elif is_crontab_format_numeric "$1"; then
            # We can't easily check this, but the format is OK
            return 0;
        fi
    fi
    return 1;
}

function is_crontab_minute() {
    if [ -n "$1" ]; then
        if is_numeric "$1"; then
            if [ $1 -ge 0 -a $1 -le 59 ]; then
                return 0;
            else
                return 1;
            fi
        elif is_crontab_format_numeric "$1"; then
            # We can't easily check this, but the format is OK
            return 0;
        fi
    fi
    return 1;
}

function unschedule() {
    crontab -l | grep -v "$SCRIPT start" | grep -v "$SCRIPT stop" | crontab -
}

function schedule_raw() {
    SUBCMD="$1"
    HOUR="$2"
    MIN="$3"

    get_status
    if [ "$SUBCMD" == "start" ]; then
        SAVE_START=""
        SAVE_STOP="$CRON_STOP_ENTRY"
    else
        SAVE_START="$CRON_START_ENTRY"
        SAVE_STOP=""
    fi
    unschedule
    NEW_ENTRY="$MIN $HOUR * * * $SCRIPT $SUBCMD >/dev/null 2>&1"
    if [ -n "$SAVE_START" ] ; then
        crontab -l | sed "\$ a $SAVE_START" | sed "\$ a $NEW_ENTRY" | crontab -
    elif [ -n "$SAVE_STOP" ]; then
        crontab -l | sed "\$ a $SAVE_STOP" | sed "\$ a $NEW_ENTRY" | crontab -
    else
        crontab -l | sed "\$ a $NEW_ENTRY" | crontab -
    fi
}

function schedule() {
    if [ $# -eq 3 ]; then
        # <start|stop> <hour> <minute>
        SUBCMD="$1"
        HOUR="$2"
        MIN="$3"
        if [ "$SUBCMD" == "start" -o "$SUBCMD" == "stop" ]; then
            if [ -n "$HOUR" -a -n "$MIN" ] && is_crontab_hour "$HOUR" && is_crontab_minute "$MIN"; then
                schedule_raw "$SUBCMD" "$HOUR" "$MIN"
            else
                echo "Time must be a valid hour and minute, or follow crontab format"
                display_help
                exit 1
            fi
        else
            echo "Command must be \"start\" or \"stop\""
            display_help
            exit 1
        fi
    else
        echo "Invalid arguments for schedule (expected 3, got $#)"
        echo "Arguments: $*"
        display_help
        exit 1
    fi
}

if [ -z "$CMD" ]; then
    # No arguments, assume you want status info
    display_status
    exit 0
elif [ "$CMD" == "start" -o "$CMD" == "--start" ]; then
    start_up
elif [ "$CMD" == "stop" -o "$CMD" == "--stop" ]; then
    shut_down
elif [ "$CMD" == "schedule" -o "$CMD" == "--schedule" ]; then
    shift
    set -f
    schedule $*
elif [ "$CMD" == "unschedule" -o "$CMD" == "--unschedule" ]; then
    unschedule
elif [ "$CMD" == "help" -o "$CMD" == "-h" -o "$CMD" == "--help" ]; then
    display_help
    exit 1
elif [ "$CMD" != "status" -a "$CMD" != "--status" ]; then
    # This is the catch-all for "I have no idea what arguments are valid!"
    display_usage
    exit 1
fi

# We usually want to see the results of whatever we did
display_status
exit 0
5
Drivers / Re: new driver development.
« Last post by silenus on April 12, 2018, 10:44:58 AM »
I have been doing some other things for a little while but I would like to get back to learning some programming. Is anyone here familiar with Rust? My understanding is that it's a systems programming language like C/C++ but perhaps a bit easier to learn and with a cleaner syntax. I am wondering how much work it would be to write a parser in it for a version of lpc by essentially translating some of the fluffos code in the compiler in vm into it.
6
Intermud / Re: New I3 Routers - Now Online
« Last post by Adam on February 19, 2018, 09:31:02 AM »
Currently, their is a sync issue between the routers in relation to channels, we are aware of this and working to resolve this as soon as possible within the next  2 - 12 hours

Thank you for your patience.


All Routers are now in sync, the collective mind has been restored, resistance is futile... [20/02/2018 7.00am AET]
7
Intermud / New I3 Routers - Now Online
« Last post by Adam on February 18, 2018, 12:00:39 PM »
Two new i3 routers are online and part of the LPMuds.net IRN network:

*wpr   
IP: 195.242.99.94
Port: 8080
Location: Netherlands, Europe
Maintainer: Aidil@Way of the Force

*Kelly
IP: 150.101.219.57
Ports: 8080, 8787
Location: Victoria, Australia
Maintainer Adam@Dead Souls Dev

Full router list: https://www.themud.org/imc2i3-routers.php
8
Skylib Stuff / Adding a channel to the MUD
« Last post by quixadhal on February 02, 2018, 09:43:40 PM »
So, for some reason EVERY mudlib out there seems to refuse to document this process, leaving it to us to figure it out every time we try a new one.  Skylib shares this philosophy, and so this is what I've figured out so far.

There are two distinct parts to adding an existing I3 channel to your shiny new MUD.  This is *NOT* the process of creating a new channel, this is adding one that already exists out on I3 to the MUD and to the players, so you can actually USE it.

Step one is to make the MUD aware that a channel exists.  AFAIK, there are not commands or objects to let you do this dynamically, so you have to go edit a couple files and run a line of code.

One such file is /secure/include/intermud.h.  In here, you will find the following:

Code: [Select]
#define DEFAULT_CHANNELS ({ \
  "imud_code", \
  "imud_gossip", \
  "nschat", \
  "nscre", \
  "skylib", \
  "url", \
})

You don't HAVE to change this, but this is the initial set of I3 channels the MUD will know about.

The next file you want to look at is /global/player/channels.c.  In here, you will find a function called register_channels().  For some reason, this doesn't let you add new channels, but simply sets the player's channel list to be a set of channels that's pre-defined, with some added or removed based on security settings and the channel existing on I3 or not.

Code: [Select]
private void register_channels() {
    string *orgs;

    channels = ({"chat", "singing", "newbie"});

    if( adminp(TO) )
        orgs = ORGS_H->query_orgs();
    else
        orgs = ORGS_H->query_my_orgs( TO->query_name() );

    if( sizeof(orgs) )
        foreach( string org in orgs )
            channels += ({ ORGS_H->query_channel(org) });

    if( creatorp(TO) ) {
        string name;

        channels += ({"cre", "discworld-chat", "dchat", "free_speech", "intercre",
                     "intergossip", "nipples", "killers", "nscre", "nschat",
                     "skylib", "url", "wileymud" });


That line there, channels += ({ ... });  That's where you need to add your channels.  This is actually Step 2, we're doing, which I will explain in just a second.

I said there were two steps to this process.  The first step is making the I3 router send you channel messages for the channels you want to hear.  You can add your channels into that default list, and I *THINK* the I3 handler will listen to each one when I3 connects to the router.

If you don't want to add them there, or I'm wrong, you can manually force the issue by typing a command like this:

Code: [Select]
> exec return INTERMUD_H->listen_channel("dchat", 1);

In that case, you're sending a packet to the router to say "I want to get messages for the dchat channel".

That will allow the MUD itself to see the channel and interact with it.  For a player to do so, we need the SECOND part, which I described above.

The parser for the player object will look at what you've typed and do a little analysis on it to figure out what you should be doing.  Part of that process is taking the first word and seeing if it matches an entry in your player object's query_channels() result.  If it does, it calls a function in the intermud handler with whatever you typed.

So, even though the MUD knows about dchat, until you go edit the player object code, the parser doesn't know what "dchat" means.

Once both parts are done, the new channel should work... except it won't yet.  Of course, one would expect to have to do the following commands:

Code: [Select]
> dupdate /global/player.c
> dupdate /secure/handlers/intermud.c

But that's not enough.  There's apparently something else that needs to be done to get this to actually work.  I don't know what it would be, as I don't understand the full layout of the mudlib... and so for me, I have to reboot the mud.  When it comes back up, whatever else needed to be done got done, and the new channels work.
9
Skylib Stuff / I3 mudlist fix
« Last post by quixadhal on February 02, 2018, 09:18:34 PM »
So, following the same idea as we did for Discworld, ages ago, to fix the mudlist packets being broken into chunks issue... which will make you not always see ALL muds out there, fire up your favorite editor and point it at /secure/handlers/intermud.c

A little ways down, you'll find the function mudlist_reply().  This handles the mudlist reply packet that arrives during the startup procedure, and whenever the server decides it has changed and wants to send out an update.

Code: [Select]
private void mudlist_reply( mixed *packet ) {
    mapping mudlist;
    string *tmp;

    if( sizeof(packet) != ( S_P + SIZEOF_MUDLIST ) ) {
        packet_invalid(packet);
        return;
    }

    // Due to a change in the way mudlist packets are broken up and sent
    // in chunks by the server, we can't skip id's that are the same
    // as the last one we saw anymore.
    //
    // Change this to < instead of ==, so we still skip OLD packets,
    // if they somehow appear.
    //
    if( packet[ S_P + MUDLIST_ID ] < config->mud_list->id )
        return;

You could also just comment out the line entirely.  The main thing is, if you ignore the 2nd and subsequent packets with the same ID, you may miss mudlist entries.
10
Drivers / Re: new driver development.
« Last post by silenus on January 30, 2018, 09:34:20 PM »
I think obviously you have function call checking already probably not too hard to add that if you want. I am currently working on hacking garbage collection (something that js has built in) into fluffos. Quite a bit of spadework involved. Mostly involving tracking down where candidates for the root set are. I am almost done though. I will see if I can get the whole thing finished by the end of the week. After that I will probably try to assess how much work it is to use LLVM as a JIT for fluffos. Probably try to just do some sort of call threading for now and make it very minimal.
Pages: [1] 2 3 ... 10