Author Topic: Hiho Andras here  (Read 4703 times)

Offline Andras

  • Acquaintance
  • *
  • Posts: 15
    • View Profile
Hiho Andras here
« 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
chat!

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!


Offline Andras

  • Acquaintance
  • *
  • Posts: 15
    • View Profile
Re: Hiho Andras here
« Reply #1 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)?

Offline vexcesban

  • Acquaintance
  • *
  • Posts: 25
  • -Noobie Mud Admin-
    • View Profile
Re: Hiho Andras here
« Reply #2 on: June 11, 2010, 11:51:05 PM »
maybe this is what you're looking for, i dont know

add_action("quitguild","lämna");

quitguild(string s){
  if(!s || s != "gillet"){
    write("lämna what?\n");
    return 1;
  }
  player->quit_guild();
  return 1;
}

Offline Andras

  • Acquaintance
  • *
  • Posts: 15
    • View Profile
Re: Hiho Andras here
« Reply #3 on: June 12, 2010, 04:42:47 AM »
thanks, modified it alittle and it works. :) Thanks for the help
« Last Edit: June 12, 2010, 04:46:27 AM by Andras »

Offline Andras

  • Acquaintance
  • *
  • Posts: 15
    • View Profile
Re: Hiho Andras here
« Reply #4 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.
*/
catch_shout(str)
{
    if (this_player()->query_level() >= listen_to_shouts_from_level) {
tell_object(this_object(),str);
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

Offline paven

  • Acquaintance
  • *
  • Posts: 20
    • View Profile
Re: Hiho Andras here
« Reply #5 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.

Pav