Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Global Boards

Global Boards

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Orik   USA  (182 posts)  Bio
Date Mon 15 Jan 2007 11:53 PM (UTC)
Message
I searched for global boards and most of them came back with Erwins snippet which I don't want to mess with. I want one global board that all will be able to read from anywhere in the mud. I've narrowed it down to these peices of code that I believe to be the culprit to change in order to set it correctly and not have to worry about people being in the room:


BOARD_DATA *get_board( OBJ_DATA * obj )
{
   BOARD_DATA *board;

   for( board = first_board; board; board = board->next )
      if( board->board_obj == obj->pIndexData->vnum )
         return board;
   return NULL;
}

BOARD_DATA *find_board( CHAR_DATA * ch )
{
   OBJ_DATA *obj;
   BOARD_DATA *board;

   for( obj = ch->in_room->first_content; obj; obj = obj->next_content )
   {
      if( ( board = get_board( obj ) ) != NULL )
         return board;
   }

   return NULL;
}


I figure I need to change them somehow. I defined OBJ_VNUM_GBOARD as vnum 100 in mud.h

So something along the lines of:

board == OBJ_VNUM_GBOARD

get rid of the ch->in_room somehow to not check to see if they are in room.

Any thoughts or ideas?
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #1 on Tue 16 Jan 2007 12:18 AM (UTC)
Message
Here's what I did:


BOARD_DATA *get_board( OBJ_DATA * obj )
{
   BOARD_DATA *board;

   for( board = first_board; board; board = board->next )
      if( board->board_obj == OBJ_VNUM_GBOARD )
         return board;
   return NULL;
}

BOARD_DATA *find_board( CHAR_DATA * ch )
{
   OBJ_DATA *obj;
   BOARD_DATA *board;

   board = get_board ( obj );

   return board;
}


That works mudwide whereever you are. Now I'll have to figure out how to make it so that you get like a * beside it if the note is new and you hadn't read it yet.

I'll look at that mudmagic snippet real quick.

Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Tue 16 Jan 2007 05:29 PM (UTC)
Message
I wouldn't use the old note system. Probably write your own code. Shouldn't be too hard, just an array for the boards, notes are written to a file, etc.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #3 on Tue 16 Jan 2007 06:58 PM (UTC)
Message
it would be a lot easier to just use erwins board code, its a pretty good system.
Top

Posted by Conner   USA  (381 posts)  Bio
Date Reply #4 on Tue 16 Jan 2007 07:06 PM (UTC)
Message
From what I've seen & heard about it, Erwin's is certainly passable, if not pretty nice, once you get past all the bugs and glitches in it. But don't take my word for it, do a search for global boards or gboards on the fuss forums. ;)

-=Conner=-
--
Come test your mettle in the Land of Legends at telnet://tcdbbs.zapto.org:4000
or, for a little family oriented medieval fun, come join us at The Castle's Dungeon BBS at telnet://tcdbbs.zapto.org
or, if you just want information about either, check our web page at http://tcdbbs.zapto.org
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #5 on Tue 16 Jan 2007 11:54 PM (UTC)
Message
Ok, I've put in the code from mudmagic, but I'm getting a warning from it. Here is the warning:


boards.c: In function 'chk_unread':
boards.c:2074: warning: comparison between pointer and integer
make[1]: *** [o/boards.o] Error 1
Make: *** [all] Error 2


Here is the code:


void chk_unread( CHAR_DATA *ch )
{
    BOARD_DATA *board;
    NOTE_DATA *newnote;
    short unread = 0;
    char buf[MAX_INPUT_LENGTH];
    struct stat fst;
    short count = 0;

    sprintf( buf, "%s%c/%s", PLAYER_DIR, tolower(ch->name[0]), ch->name );
    if ( stat( buf, &fst ) != -1 )
    {
      sprintf( buf, "You were last on: %s\r", ctime( &fst.st_mtime ) );
      send_to_char( buf, ch );
    }
    else
    {
      send_to_char( "For some reason, you weren't found in the player database.\n\r", ch );
      return;
    }

    for ( board = first_board; board; board = board->next )
    {
        if ( board->num_posts == 0
        || board->min_read_level > ch->level
        || board->type != BOARD_NOTE )
            continue;

        for ( newnote = board->first_note; newnote; newnote = newnote->next )
        {
            if ( newnote->time > ch->pcdata->last_read )<----offending warning 2074.
                unread += 1;
        }

        if ( unread != 0 )
        {
            sprintf( buf, "You have %d new note%s.\n\r",
            unread, unread == 1 ? "" : "s" );
            send_to_char( buf, ch );
            unread = 0;
            count += 1;
        }
    }
    if ( count == 0 )
        send_to_char( "You have no new messages on ANY boards.\n\r", ch );
    return;
}


In mud.h I've put at the end:


char * time;


in the "struct note_data"
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #6 on Wed 17 Jan 2007 12:07 AM (UTC)
Message
Why is the time data member a char*? The warning you're getting is actually significant, because you're trying to compare a string to a number, and the result will be something nonsensical. Where do newnote->time and ch->pcdata->last_read get set?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #7 on Wed 17 Jan 2007 02:07 AM (UTC)
Message
time is in mud.h struct note_data

last read is:

time_t last_read; in the pc_data struct
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #8 on Wed 17 Jan 2007 02:46 AM (UTC)
Message
I don't think that's the snippet you want. All it does (I believe) is checks if you have any unread notes on any boards. It doesn't allow you to globally post or anything.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #9 on Wed 17 Jan 2007 03:35 AM (UTC)
Message
That's also unfortunately not the question I asked... I wanted to know where they get assigned a value (i.e. get set), not where they are declared. Seeing where they are set can give hints as to the intention of the snippet.

But, Zeno's comment seems to have a higher priority! :-) "This is not the snippet you're looking for", to paraphrase an old friend.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #10 on Wed 17 Jan 2007 09:47 PM (UTC)
Message
Well, I have already made my boards global just by making one board and using that one board as OBJ_VNUM_GBOARD. Notes can be checked anywhere in game without having to be in a board room. Note list will check the board. SO that's not the problem. The problem I'm encountering is when I want to show people when they have new notes. So this check unread is doing that. It's just encountering a bug. I don't see any problems in my initial board code right now except the time isn't working correctly.

The newnote->time is not in any other structure I don't think. I don't see where it is set a value. This is the first time it's used. I guess that's the problem eh? heh.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #11 on Wed 17 Jan 2007 10:29 PM (UTC)
Message
Well, you have to set the time somewhere if you're going to test it against last_read. Somewhere, you need to set some reasonable time for each individual note, as well as making sure it gets loaded and saved to board files. I can't really help much more because I don't know anything about the snippet you're using.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #12 on Wed 17 Jan 2007 11:11 PM (UTC)
Message
Here's where I got the snippet.

http://www.mudmagic.com/codes/server-snippet/1097

I went through that and it never said to set the time anywhere.
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #13 on Thu 18 Jan 2007 12:13 AM (UTC)
Message
Ok, I figured it out. I used the int vnum from the posts and changed last_read to an int in pc_data.

if (vnum > ch->pcdata->last_read)

I now have global boards and can check everytime I log on to see the new notes I have.

Just curios though, Zeno.

What's wrong with this board.c? Is there memory leaks on it or what? I know you said you didn't like it so you made your own. Could you give me a glimpse of what was wrong so I can fix it? I haven't found anything wrong with it yet.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #14 on Thu 18 Jan 2007 12:37 AM (UTC)
Message
I don't remember saying anything was wrong with board.c or that I made my own.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


91,674 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.