Talos Mud Development Blog

One mans quest to blog about Mud Development

Old Code Converted To 3.0

leave a comment »

So I imported my old domain from 2.1.18 all the way up to the current 3.0, but man there are some crazy little changes that occured.  Like new verbs that upset the addactions that I had coded up.  Here’s what I learned:

create an object that uses this code:

environment(this_player())->addaction_function();

OLD CODE: stage.c

static void create() {
    room::create();
    SetClimate(“indoors”);
    SetAmbientLight(30);
    SetTown(“Talos”);
    SetShort(“White Dove Inn – Performers Stage”);
    SetLong( (: LongDesc :) );
    SetExits( ([
 “east” : “/domains/talos/whitedoveinn/room/dancefloor2.c”
      ]) );
    SetItems( ([
       : “A pull rope to open and close the curtains.”
      ]) );

     add_action(“pull_rope”,”pull”);
}

 

New Code: stage.c

 SetInventory(([
  WDI_OBJ”stage_rope.c”: 1,
 ]) );

 

New Code: stage_rope.c

#include <lib.h>
#include “../whitedoveinn.h”

inherit LIB_DUMMY;
inherit LIB_PULL;

int pullRope(object who);

static void create()
{
 dummy::create();
 SetKeyName(“rope”);
 SetId(({“rope”, “curtain rope” }));
 SetShort(“a curtain rope”);
 SetLong(“A rope used to open and close the curtain.”);
 SetPull( (: pullRope :) );
}

int pullRope(object who)
{
 write(“Trying to ‘Pull Rope’\n”);
 environment(this_player())->pull_rope();
 return 1;
}

There are two very important facts here: on the object you need to have the LIB_DUMMY so that it doesn’t show up in the room inventory, and then all you have to do is have your item call the code alread created: environment(this_player())->pull_rope();

Shizam!

Advertisements

Written by Troy

January 18, 2010 at 6:39 am

Posted in Convesions

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: