Talos Mud Development Blog

One mans quest to blog about Mud Development

Posts Tagged ‘conversion

SEASON_D Changes

leave a comment »

Well I am still converting my old 2.1.18 code to 3.0 and had to start hacking on the SEASONS_D

I’ve added the following time Sections: Evening, Afternoon and I had to put the weather changes aside until I have more time.  To fix an issue that I had with one of my NPC’s I had to add some sefuns:

int query_noon()  { return (SEASONS_D->GetTimeOfDay() == “noon”); }
int query_afternoon(){return (SEASONS_D->GetTimeOfDay() == “afternoon”); }
int query_evening() { return (SEASONS_D->GetTimeOfDay() == “evening”); }
int query_dawn()   { return (SEASONS_D->GetTimeOfDay() == “dawn”); }
int query_morning() { return (SEASONS_D->GetTimeOfDay() == “morning”); }
int query_twilight(){ return (SEASONS_D->GetTimeOfDay() == “twilight”); }
int query_night()  { return (SEASONS_D->GetTimeOfDay() == “night”); }
int query_midnight(){ return (SEASONS_D->GetTimeOfDay() == “midnight”) ; }

Advertisements

Written by Troy

January 18, 2010 at 8:55 am

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!

Written by Troy

January 18, 2010 at 6:39 am

Posted in Convesions

Tagged with , ,