• entries
743
1924
• views
583702

325 views

I'm teetering on the brink at the moment of putting by D3D experiments on hold for a bit and breathing life back into my text adventure language.

This is a project I've been working on, on and off, for a number of years now. I keep starting it from scratch, which is not always a bad thing with a hobby project, but the last incarnation consisted of a compiler and a virtual machine that ran the byte-code output.

It was quite flexible really, with a bit of a C-like syntax but with reference parameters, declare-anywhere local variables and customisable properties for stuff like locations and items, accessed via the dot operator.

It looked a bit like this:

verbs #look,#get,#take=#get,#quit;nouns #door,#path;for location{    word noun=word(0);}for item{    word noun=word(0);    location at=location(0);}new location path : noun(#path){    out "standing on a path.";}new item door : noun(#door),at(path){    out "It was made of wood.";}parse(word &v,word &n){    service(0); v=word(reg(0)); n=word(reg(1));}int items_at(location l){    int n=0;    for(int i=0;i1) if(item(i).at==l) n=n+1;    return n;}list_items(location l){    int n=items_at(l);    for(int i=0;i1)        {        if(item(i).at==l)            {            out item(i);            if(i==n-1) out ".";            if(i==n-2) out " and ";            if(i2)  out ", ";            }        }}desc(location n){   out "You are ",n(),end;   if(items_at(n)) out "You can see ",list_items(n),end;}main(){    word v,n; location l=path;    desc(l);    out "> ";    parse(v,n);       while(v!=#quit)        {        select(v)            {            #look: desc(l);            #get : on_get();            }        out "> ";        parse(v,n);        }}

It has really been more an excercise in scripting languages and compilers than out of any specific interest in text adventures, although some forum posts recently have reminded me how much I used to enjoy the old Level 9 games back in the day.

I've got a few days off at the end of this week and then a bank holiday on Monday so I'm tempted to have a good bash at trying to get this up and running again. Don't know if there is any current interest in text adventures but would just be nice to go back to programming at a DOS prompt and not having to look stuff up every five minutes for a few days.

There are no comments to display.

## Create an account

Register a new account