Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Bing, bastian

Members: 1
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
614
BenitoVirg
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » clans on char creation?
Forum Rules | Mark all | Recent Posts

clans on char creation?
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jun 7, 2006, 12:05 pm
Go to the top of the page
Go to the bottom of the page

theKarn

GroupMembers
Posts8
JoinedOct 5, 2005

anyone know a way to allow premade clans to be set to a person when they create a profile?

DBSaga(Smaug 1.4) Codebase Dun think it makes to big a diffrence just thought i'd put it out there.
       
Post is unread #2 Jun 7, 2006, 2:59 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

To a specific clan, or they can pick? If it's specific, that's easy. Just one or two lines in the code in comm.c.

If you want them to pick, it'd be a bit harder. You'd have to make a new constate and stuff. Let me know if you need examples of doing either.
       
Post is unread #3 Jun 7, 2006, 3:59 pm
Go to the top of the page
Go to the bottom of the page

theKarn

GroupMembers
Posts8
JoinedOct 5, 2005

like:

Do you want to join a clan(Y/N) Y

Join "The Alliance"(Y/N)

       
Post is unread #4 Jun 7, 2006, 6:15 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

You mean you'd go through asking Y/N to each clan? Or just that one?

Why not do something like:

Select a clan:
Alliance Other Blah Blah2 None
       
Post is unread #5 Jun 7, 2006, 7:20 pm   Last edited Jun 7, 2006, 7:48 pm by theKarn
Go to the top of the page
Go to the bottom of the page

theKarn

GroupMembers
Posts8
JoinedOct 5, 2005

        send_to_desc_color( "\n\r", d );
        send_to_desc_color( pHelp->text, d );
        send_to_desc_color( "\n\r&wDo you want to be in a clan? (Y/N)\n\r", d );
        return;
      }
      switch ( *argument )
      {
        case 'n':
        case 'N':
          send_to_desc_color( "\n\r&wOkay, you are not in a clan!.&D\n\r", d );
          write_to_buffer( d, echo_on_str, 0 );
          break;

        case 'y':
        case 'Y':
          send_to_desc_color( "\n\r&wOkay, your in a clan!.&D\n\r", d );
          ch->pcdata->clanRank = 7;
// This next line is not correct and is cauing crashes when creating.
          ch->pcdata->clan->name = "Judgement";
          write_to_buffer( d, echo_on_str, 0 );
          break;

        default:
          send_to_desc_color( "\n\r&wPlease type [&WY&w]es or [&WN&w].&D\n\r", d );
          return;
      }



that was what i had.... and that is what i am looking at i just couldn't figure out for. That code is what i was using. the clans were made as well.
       
Post is unread #6 Jun 7, 2006, 8:23 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Ah well, there's a problem. Even if ch and pcdata exists, the clan struct on that does not. You can't just assign the name, you have to assign the struct first. Look into how do_induct works.
       
Post is unread #7 Jun 8, 2006, 1:23 am
Go to the top of the page
Go to the bottom of the page

theKarn

GroupMembers
Posts8
JoinedOct 5, 2005

ok it seems my previous


DBSaga(Smaug 1.4) Codebase Dun think it makes to big a diffrence just thought i'd put it out there.


was totally wrong as it had a lot to do with it, because in the codebase this shows up:

   case CON_READ_MOTD:
    {
      char motdbuf[MAX_STRING_LENGTH];

      sprintf( motdbuf, "\n\rWelcome to %s&D...\n\r", sysdata.mud_name );
      send_to_desc_color( motdbuf, d );
    }
      add_char( ch );
      d->connected = CON_PLAYING;
      /*
       * hopefully clear up some ansi changing issues   -Nopey 
       */
      set_char_color( AT_DGREEN, ch );
      if( !xIS_SET( ch->act, PLR_ANSI ) && d->ansi == TRUE )
        d->ansi = FALSE;
      else if( xIS_SET( ch->act, PLR_ANSI ) && d->ansi == FALSE )
        d->ansi = TRUE;

      if( ch->level == 0 )
      {
        OBJ_DATA *obj;
        int iLang;

        ch->pcdata->upgradeL = CURRENT_UPGRADE_LEVEL;

        ch->pcdata->clan_name = STRALLOC( "" );
        ch->pcdata->clan = NULL;


commenting out the last two lines of that allows the code to function they way i wanted it,

          ch->pcdata->clan = get_clan( "clan name here" );


was what I was looking for.

Thank you Zeno for your help.
       
Post is unread #8 Jun 8, 2006, 8:11 am
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

If clan_name really is a variable in pcdata, then you'll need to make sure that's changed as well.
       
Post is unread #9 Jun 8, 2006, 3:08 pm
Go to the top of the page
Go to the bottom of the page

theKarn

GroupMembers
Posts8
JoinedOct 5, 2005

huh?
       
Post is unread #10 Jun 21, 2006, 10:18 am
Go to the top of the page
Go to the bottom of the page

theKarn

GroupMembers
Posts8
JoinedOct 5, 2005

ok this doesn't seem to fully work.

i'll post a code i made that works and the code that fails to work... hope someone can help me.

Working:
void do_joinclan( CHAR_DATA * ch, char *argument )
{
    CLAN_DATA *clan;

    if( IS_NPC( ch ) )
    {
      send_to_char( "Not on NPC's.\n\r", ch );
      return;
    }

    if( !argument || argument[0] == '\0' )
    {
       send_to_char( "You must pick a clan first.\n\r",ch );
       return;
    }
    if ( ch->pcdata->clan != NULL )
    {
     send_to_char( "You are already in a clan.\n\r",ch );
     return;
    }
    if ( ch->pcdata->quest_curr < 5 )
    {
     send_to_char( "You don't have enough RPP.\n\r",ch );
     return;
    }
    clan = get_clan( argument );
    if( !clan )
    {
      send_to_char( "No such clan.\n\r", ch );
      return;
    }
    STRFREE( ch->pcdata->clan_name );
    ch->pcdata->clan_name = QUICKLINK( clan->name );
    ch->pcdata->clan = clan;
    ch->pcdata->quest_curr -= 5;
    ch->pcdata->clanRank = 7;
    ch->pcdata->clanZeniDonated = 0;
    ch->pcdata->clanZeniClanTax = 0;
    ch->pcdata->clanItemsDonated = 0;
   if ( !IS_IMMORTAL( ch ) )
    {
    if( ch->sex == SEX_FEMALE )
    clan->fRank7Count++;
    else
    clan->mRank7Count++;
    }
    return;
}


Non working:
          if ( IS_EVIL(ch) )
          {
          ch->pcdata->clan = get_clan( "Dark Horizon" );
          ch->pcdata->clanRank = 7;
          ch->pcdata->clanZeniDonated = 0;
          ch->pcdata->clanZeniClanTax = 0;
          ch->pcdata->clanItemsDonated = 0;
          if( ch->sex == SEX_FEMALE )
          get_clan( "Dark Horizon" )->fRank7Count++;
          else
          get_clan( "Dark Horizon" )->mRank7Count++;
          write_to_buffer( d, echo_on_str, 0 );
          break;


the non working code is from the smaug setup. the problem here is when a char is made it sets them but when they log off and relog it looses the clan settings. i've tried using:

    STRFREE( ch->pcdata->clan_name );
    ch->pcdata->clan_name = QUICKLINK( clan->name );


in there but it keeps messing up... any help would be great.
       
Post is unread #11 Jun 21, 2006, 5:04 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

get_clan( "Dark Horizon" )->fRank7Count++;

What is that for? Can't you just:
ch->pcdata->clan->fRank7Count++;

?

Look in fwrite_char, how is a clan saved to a pfile?
       
Post is unread #12 Jun 21, 2006, 10:39 pm
Go to the top of the page
Go to the bottom of the page

theKarn

GroupMembers
Posts8
JoinedOct 5, 2005

no because i have to actually specify a clan. this isn't from the command line inside the mud I have to make the mud do it automaticly. but that has nothing to do with it sadly... because the clan is not sticking to the playerfile for some reasion
       
Post is unread #13 Jun 22, 2006, 6:35 am
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

What? You are specifying a clan with the code. The clan they're in, is what you're specifying. Where did this "command line" stuff come into play?

Again: look in fwrite_char, how is a clan saved to a pfile?
       
Pages:<< prev 1 next >>