Lib Discussion => LPMud 2.x and Amylaar => Topic started by: Andras on June 09, 2010, 03:40:35 pm

Title: Hiho Andras here
Post by: Andras on June 09, 2010, 03:40:35 pm
Hi, I use DGD which I guess is based on Lpmud 2.4.5 sins its a map in there named so.
Very clean mud, not that much files in it.

Ive solved some of my problems, which was I wanted weapons and npcs in their own files, then wanted to add
them to the room and add weapon to the npc. After checking throw like all files I finally found a way to do it.
yeye Its kinda simple but it was something like move_object("/object/xxx/xxx/", this_object); nothing biggy.
then command("fatta " + "svärdet"); to get the npc to wield the sword. all good there. Just showing Ive
looked throw files :P

now to my question.
Im trying to fix a guild object. Ive found a file which ive modified alittle so you cant drop the object.
The thing with a guild is you want to be able to join and leave, and then the biggest thing, the guild

There are no files with "channels" or so. So my guess Is I need to modify the "shout" thing and
add that to the guild object. Is that correct?
Modify so only those with the object can hear the shout.
and well rename the shout to something like

guildchat hi
guildchat andras says: Hi!

Title: Re: Hiho Andras here
Post by: Andras on June 10, 2010, 04:23:22 am
add_action("quitguild","lämnagillet"); <--- works, that will destruct the object.
add_action("quitguild","lämna gillet"); <--- dosnt work, anyone know how to fix it? or dosnt it work in the standard plain lpmud 2.4.5 (dgd)?
Title: Re: Hiho Andras here
Post by: vexcesban on June 11, 2010, 11:51:05 pm
maybe this is what you're looking for, i dont know


quitguild(string s){
  if(!s || s != "gillet"){
    write("lämna what?\n");
    return 1;
  return 1;
Title: Re: Hiho Andras here
Post by: Andras on June 12, 2010, 04:42:47 am
thanks, modified it alittle and it works. :) Thanks for the help
Title: Re: Hiho Andras here
Post by: Andras on June 13, 2010, 03:16:38 am
Code: [Select]
#define GK_OLD(x) gk(x)
#define gk(x) gTellstring=x; filter_objects(users(),"filter_tell",this_object())

static string gTellstring;
static int listen_to_shouts_from_level;

filter_tell(ob) {
    if (ob == this_player())
return 0;
    return ob->catch_shout(gTellstring);

/* This is called for every shouted string to this player.
    if (this_player()->query_level() >= listen_to_shouts_from_level) {
return 1;
    return 0;

Can this be used, with alittle modifying for the guildchat.
The thing I want is, or atleast what I think I want is.
"gk hello" -> sends hello to the guildobject which sends
it to the players whom has the gobj.
"guildchat andras: hello"

ps. I have this code in the gobj.c
Title: Re: Hiho Andras here
Post by: paven on January 14, 2013, 05:21:32 pm
You can certainly modify that to work.  Most of the time in 2.4.5 I've seen the guild object actually be an object.  You then parse through users() to find out if the object is present.

so in your object   add_action("guild_talk", "gt");

int guild_talk(string str) {
  object *guildpeeps;
  int n;

  if (!str) {
    notify_fail("Syntax: gt <str>\n");
    return 0;

  guildpeeps = users();

  for (n = 0; n < sizeof(guildpeeps); n++) {
    if (present("guild_object_id", guildpeeps[n] );
      tell_object(guildpeeps[n], "Guildchat " +
                                                this_player()->query_name() +
                                                ": " + str + "\n");
  return 1;

Or something like that.