Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Yesterday, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
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
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yandex, Google

Members: 0
Guests: 17
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » tradeskills (skills) - Solved
Forum Rules | Mark all | Recent Posts

tradeskills (skills) - Solved
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 10, 2010, 1:45 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

Okay, where to begin...we have added Tradeskills to the code, and it works fine. The problem I'm having is in relation to our prac list and the custom addition of prac dshow which allows players to remove skills/spells/weapons/tongues/songs from the prac list and be hidden to the prac dshow list. Below shows it:
void do_practice(CHAR_DATA *ch, char *argument)
{
  char                    buf[MSL], arg[MSL];
  int                     sn, tshow = SKILL_UNKNOWN;
  bool                    showdshow = FALSE;
  short highspell, highskill, usehigh;

  if(IS_NPC(ch))
    return;

  one_argument(argument, arg);

  if(VLD_STR(arg))
    tshow = get_skill(arg);

  if(VLD_STR(arg) && !str_cmp(arg, "dshow"))
  {
    argument = one_argument(argument, arg);
    showdshow = TRUE;

    if(VLD_STR(argument))
    {
      sn = skill_lookup(argument);

      if((sn == -1) || !CAN_LEARN(ch, sn, TRUE))
      {
        send_to_char("You have no control on seeing something you don't know.\r\n", ch);
        return;
      }
      ch->pcdata->dshowlearned[sn] = !ch->pcdata->dshowlearned[sn];
      ch_printf(ch, "You will %s see that on the practice list display.\r\n", ch->pcdata->dshowlearned[sn] == FALSE ? "now" : "no longer");
      return;
    }
  }

  if(tshow != SKILL_UNKNOWN || !VLD_STR(argument) || showdshow)
  {
    int                     col = 0;
    short                   lasttype = SKILL_UNKNOWN, cnt = 1;

    set_pager_color(AT_CYAN, ch);
    for(sn = 0; sn < top_sn; sn++)
    {
      if(!skill_table[sn]->name)
        break;

      if(tshow != SKILL_UNKNOWN && skill_table[sn]->type != tshow)
        continue;

		if(sn == gsn_mine || sn == gsn_forge || sn == gsn_tan || sn == gsn_bake || sn == gsn_gather || sn == gsn_mix || sn == gsn_hunt)
        continue;

		if(!CAN_LEARN(ch, sn, TRUE))
        continue;

      if(ch->pcdata->learned[sn] <= 0 && SPELL_FLAG(skill_table[sn], SF_SECRETSKILL))
        continue;

      if(!showdshow && ch->pcdata->dshowlearned[sn] == TRUE)  /* Don't show if
                                                               * dshowlearned is TRUE */
        continue;

      if(showdshow && ch->pcdata->dshowlearned[sn] == FALSE)  /* Only show if
                                                               * dshowlearned is FALSE */
        continue;

      if(skill_table[sn]->type != lasttype)
      {
        int                     count, type_length;
        char                    space_buf[MSL];

        if(!cnt)
          send_to_pager("                                   (none)\r\n", ch);
        else if(col % 3 != 0)
          send_to_pager("\r\n", ch);

        space_buf[0] = '\0';
        type_length = ((79 - (strlen(skill_tname[skill_table[sn]->type]) + 11)) / 2);
        for(count = 0; count < type_length; count++)
        {
          mudstrlcat(space_buf, " ", MSL);
        }
        set_pager_color(AT_CYAN, ch);
        pager_printf_color(ch, "%s&C_.:[", space_buf);
        set_pager_color(AT_CYAN, ch);
        pager_printf_color(ch, " &R%s&D ", skill_tname[skill_table[sn]->type]);
        set_pager_color(AT_CYAN, ch);
        send_to_pager_color("&C]:._&D\r\n", ch);
        col = cnt = 0;
      }
	  
	  lasttype = skill_table[sn]->type;

      ++cnt;
      set_pager_color(AT_CYAN, ch);
      pager_printf(ch, "&c%20.20s&D", skill_table[sn]->name);
      if(ch->pcdata->learned[sn] >= get_maxadept(ch, sn, TRUE))
        send_to_pager("&W", ch);
      else if(ch->pcdata->learned[sn] > 0)
        send_to_pager("&w", ch);
      else
        send_to_pager("&z", ch);
      pager_printf(ch, " %3d%%%s&D ", ch->pcdata->learned[sn], (ch->pcdata->learned[sn] <= 0 && VLD_STR(skill_table[sn]->teachers)) ? "&R*" : " ");
      if(++col % 3 == 0)
        send_to_pager("\r\n", ch);
    }
    if(col % 3 != 0)
      send_to_pager("\r\n", ch);
    if(ch->pcdata->tradeclass > 1)
    {
      set_pager_color(AT_CYAN, ch);
      pager_printf_color(ch, "\t\t           &C_.:[");
      set_pager_color(AT_CYAN, ch);
      pager_printf_color(ch, "  &RTrade Skills&D ");
      set_pager_color(AT_CYAN, ch);
      send_to_pager_color("&C]:._&D\r\n", ch);
      col = cnt = 0;
      if(ch->pcdata->tradeclass == 20)
      {
        sn = gsn_mine;
        pager_printf(ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn]);
        sn = gsn_forge;
        pager_printf(ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn]);
      }
      if(ch->pcdata->tradeclass == 21)
      {
        sn = gsn_gather;
        pager_printf(ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn]);
        sn = gsn_bake;
        pager_printf(ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn]);
        sn = gsn_mix;
        pager_printf(ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn]);
      }
      if(ch->pcdata->tradeclass == 22)
      {
        sn = gsn_hunt;
        pager_printf(ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn]);
        sn = gsn_tan;
        pager_printf(ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn]);
      }
    }    

	set_pager_color(AT_CYAN, ch);
    pager_printf(ch, "&cYou have &C%s&c practice sessions left.\r\n", ch->practice > 0 ? num_punct(ch->practice) : "no");
  }
  else
  {
    CHAR_DATA              *mob;

    if(!IS_AWAKE(ch))
    {
      send_to_char("In your dreams, or what?\r\n", ch);
      return;
    }

    for(mob = ch->in_room->first_person; mob; mob = mob->next_in_room)
      if(IS_NPC(mob) && (xIS_SET(mob->act, ACT_PRACTICE) || xIS_SET(mob->act, ACT_NEWBPRACTICE)))
        break;
    if(!mob)
    {
      send_to_char("You can't do that here.\r\n", ch);
      return;
    }

    if(ch->practice <= 0)
    {
      act(AT_TELL, "$n tells you 'You must earn some more practice sessions.'", mob, NULL, ch, TO_VICT);
      return;
    }

    sn = skill_lookup(argument);

    if((sn == -1) || (!IS_NPC(ch) && !CAN_LEARN(ch, sn, TRUE)))
    {
      act(AT_TELL, "$n tells you 'You're not ready to learn that yet...'", mob, NULL, ch, TO_VICT);
      return;
    }

    if(is_name(skill_tname[skill_table[sn]->type], (char *)CANT_PRAC) || !can_teach(ch, mob, sn))
    {
      act(AT_TELL, "\r\n$n tells you 'I don't know how to teach that.'", mob, NULL, ch, TO_VICT);
      send_to_char("\r\n&WType 'help Teacher' for help finding new spells/skills in the realms.\r\n", ch);
      return;
    }

    /*
     * Skill requires a special teacher - run through the list of teachers
     * Check into the possibility of activating mppractice mobs with practice command.
     */
    if(VLD_STR(skill_table[sn]->teachers))
    {
      /*
       * Get the mob vnum here 
       */
      snprintf(buf, MSL, "%d", mob->pIndexData->vnum);
      if(!is_name(buf, skill_table[sn]->teachers))
      {
        act(AT_TELL, "\r\n$n tells you, 'I do not know how to teach that.'", mob, NULL, ch, TO_VICT);
        send_to_char("\r\n&WType 'help Teacher' for help finding new spells/skills in the realms.\r\n", ch);
        return;
      }
    }

    SKILLTYPE              *skill;

    skill = skill_table[sn];

    highskill = (get_curr_str(ch) + get_curr_dex(ch)) / 2;
    highspell = (get_curr_int(ch) + get_curr_wis(ch)) / 2;

    if( skill->type == SKILL_SKILL )
       usehigh = highskill;
    else if( skill->type == SKILL_SPELL )
       usehigh = highspell;

    if(ch->pcdata->learned[sn] > (get_maxadept(ch, sn, TRUE) - 6) || ch->pcdata->learned[sn] > 40)
    {
      act_printf(AT_TELL, mob, NULL, ch, TO_VICT, "$n tells you, 'I've taught you everything I can about %s.'", skill_table[sn]->name);
      act(AT_TELL, "$n tells you, 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT);
    }
    else if( ( skill->type == SKILL_SKILL || skill->type == SKILL_SPELL )
    && ( ( usehigh >= 18 && ch->pcdata->learned[sn] >= 45 )
    || ( ( usehigh > 15 && usehigh < 18 ) && ch->pcdata->learned[sn] >= 40 )
    || ( ( usehigh < 16 && usehigh > 13 ) && ch->pcdata->learned[sn] >= 35 )
    || ( usehigh < 14 && ch->pcdata->learned[sn] >= 30 ) ) )
    {
       act_printf(AT_TELL, mob, NULL, ch, TO_VICT, "$n tells you, 'I've taught you everything I can about %s.'", skill_table[sn]->name);
       act(AT_TELL, "$n tells you, 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT);
    }
    else
    {
      ch->practice--;
      if(ch->pcdata->learned[sn] <= 0)
        ch->pcdata->learned[sn] += 10;
      else
        ch->pcdata->learned[sn] += 5;
      act(AT_ACTION, "You practice $T.", ch, NULL, skill_table[sn]->name, TO_CHAR);
      act(AT_ACTION, "$n practices $T.", ch, NULL, skill_table[sn]->name, TO_ROOM);

      // check if skill and str > certain amount max 45 else 35
      if( skill->type == SKILL_SKILL || skill->type == SKILL_SPELL )
      {
         if( usehigh >= 18 )
         {
            if(ch->pcdata->learned[sn] >= 40 && ch->pcdata->learned[sn] < 50)
            {
               ch->pcdata->learned[sn] = 45;
               act(AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT);
            }
         }
         else if( usehigh > 15 && usehigh < 18)
         {
            if(ch->pcdata->learned[sn] >= 30 && ch->pcdata->learned[sn] < 41)
            {
               ch->pcdata->learned[sn] = 40;
               act(AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT);
            }
         }
         else if( usehigh < 16 && usehigh > 13)
         {
            if( ch->pcdata->learned[sn] >= 30 && ch->pcdata->learned[sn] < 41 )
            {
               ch->pcdata->learned[sn] = 35;
               act(AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT);
            }
         }
         else if( usehigh < 14)
         {
            if(ch->pcdata->learned[sn] >= 20 && ch->pcdata->learned[sn] < 40)
            {
               ch->pcdata->learned[sn] = 30;
               act(AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT);
            }
         }
      }
    }
  }
}

The problem here is two-fold:
1. The tradeskills show up on both the prac and prac dshow lists
2. Utilizing the command prac dshow <tradeskill skill> will not remove it from the prac list. Done again, does not remove it from the prac dshow list.

Any assistance would be appreciated.

Cheers,
Aurin
       
Post is unread #2 Dec 10, 2010, 3:36 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

void do_practice(CHAR_DATA *ch, char *argument)
{
   char buf[MSL], arg[MSL];
   int sn, tshow = SKILL_UNKNOWN;
   bool showdshow = FALSE;
   short highspell, highskill, usehigh;

   if( IS_NPC( ch ) )
      return;

   one_argument( argument, arg );

   if( VLD_STR( arg ) )
      tshow = get_skill( arg );

   if( VLD_STR( arg ) && !str_cmp( arg, "dshow" ) )
   {
      argument = one_argument( argument, arg );
      showdshow = TRUE;

      if( VLD_STR( argument ) )
      {
         sn = skill_lookup( argument );

         if( ( sn == -1 ) || !CAN_LEARN( ch, sn, TRUE ) )
         {
            send_to_char( "You have no control on seeing something you don't know.\r\n", ch );
            return;
         }
         ch->pcdata->dshowlearned[sn] = !ch->pcdata->dshowlearned[sn];
         ch_printf( ch, "You will %s see that on the practice list display.\r\n", ch->pcdata->dshowlearned[sn] == FALSE ? "now" : "no longer" );
         return;
      }
   }

   if( tshow != SKILL_UNKNOWN || !VLD_STR( argument ) || showdshow )
   {
      int col = 0;
      short lasttype = SKILL_UNKNOWN, cnt = 1;

      set_pager_color( AT_CYAN, ch );
      for( sn = 0; sn < top_sn; sn++ )
      {
         if( !skill_table[sn]->name )
            break;

         if( tshow != SKILL_UNKNOWN && skill_table[sn]->type != tshow )
            continue;

         if( sn == gsn_mine || sn == gsn_forge || sn == gsn_tan || sn == gsn_bake || sn == gsn_gather || sn == gsn_mix || sn == gsn_hunt )
            continue;

         if( !CAN_LEARN( ch, sn, TRUE ) )
            continue;

         if( ch->pcdata->learned[sn] <= 0 && SPELL_FLAG( skill_table[sn], SF_SECRETSKILL ) )
            continue;

         if( !showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) /* Don't show if dshowlearned is TRUE */
            continue;

         if( showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) /* Only show if dshowlearned is FALSE */
            continue;

         if( skill_table[sn]->type != lasttype )
         {
            int count, type_length;
            char space_buf[MSL];

            if( !cnt )
               send_to_pager( "                                   (none)\r\n", ch );
            else if( col % 3 != 0 )
               send_to_pager("\r\n", ch);

            space_buf[0] = '\0';
            type_length = ( ( 79 - ( strlen( skill_tname[skill_table[sn]->type] ) + 11 ) ) / 2 );
            for( count = 0; count < type_length; count++ )
            {
               mudstrlcat( space_buf, " ", MSL );
            }
            set_pager_color(AT_CYAN, ch);
            pager_printf_color(ch, "%s&C_.:[", space_buf);
            set_pager_color(AT_CYAN, ch);
            pager_printf_color(ch, " &R%s&D ", skill_tname[skill_table[sn]->type]);
            set_pager_color(AT_CYAN, ch);
            send_to_pager_color("&C]:._&D\r\n", ch);
            col = cnt = 0;
         }

         lasttype = skill_table[sn]->type;

         ++cnt;
         set_pager_color( AT_CYAN, ch );
         pager_printf( ch, "&c%20.20s&D", skill_table[sn]->name );
         if( ch->pcdata->learned[sn] >= get_maxadept( ch, sn, TRUE ) )
            send_to_pager( "&W", ch );
         else if( ch->pcdata->learned[sn] > 0 )
            send_to_pager( "&w", ch );
         else
            send_to_pager( "&z", ch );
         pager_printf( ch, " %3d%%%s&D ", ch->pcdata->learned[sn], ( ch->pcdata->learned[sn] <= 0 && VLD_STR( skill_table[sn]->teachers ) ) ? "&R*" : " " );
         if( ++col % 3 == 0 )
            send_to_pager( "\r\n", ch );
      }
      if( col % 3 != 0 )
         send_to_pager( "\r\n", ch );
      if( ch->pcdata->tradeclass > 1 )
      {
         set_pager_color( AT_CYAN, ch );
         pager_printf_color( ch, "\t\t           &C_.:[" );
         set_pager_color( AT_CYAN, ch );
         pager_printf_color( ch, "  &RTrade Skills&D " );
         set_pager_color( AT_CYAN, ch );
         send_to_pager_color( "&C]:._&D\r\n", ch );
         col = cnt = 0;
         if( ch->pcdata->tradeclass == 20 )
         {
            sn = gsn_mine;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_forge;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn] );
         }
         if( ch->pcdata->tradeclass == 21 )
         {
            sn = gsn_gather;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_bake;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_mix;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn] );
         }
         if( ch->pcdata->tradeclass == 22 )
         {
            sn = gsn_hunt;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_tan;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% \r\n", skill_table[sn]->name, ch->pcdata->learned[sn] );
         }
      }

      set_pager_color( AT_CYAN, ch );
      pager_printf( ch, "&cYou have &C%s&c practice sessions left.\r\n", ch->practice > 0 ? num_punct( ch->practice ) : "no" );
   }
   else
   {
      CHAR_DATA *mob;

      if( !IS_AWAKE( ch ) )
      {
         send_to_char( "In your dreams, or what?\r\n", ch );
         return;
      }

      for( mob = ch->in_room->first_person; mob; mob = mob->next_in_room )
         if( IS_NPC( mob ) && ( xIS_SET( mob->act, ACT_PRACTICE ) || xIS_SET( mob->act, ACT_NEWBPRACTICE ) ) )
            break;
      if( !mob )
      {
         send_to_char( "You can't do that here.\r\n", ch );
         return;
      }

      if( ch->practice <= 0 )
      {
         act( AT_TELL, "$n tells you 'You must earn some more practice sessions.'", mob, NULL, ch, TO_VICT );
         return;
      }

      sn = skill_lookup( argument );

      if( ( sn == -1 ) || ( !IS_NPC( ch ) && !CAN_LEARN( ch, sn, TRUE ) ) )
      {
         act( AT_TELL, "$n tells you 'You're not ready to learn that yet...'", mob, NULL, ch, TO_VICT );
         return;
      }

      if( is_name( skill_tname[skill_table[sn]->type], (char *)CANT_PRAC ) || !can_teach( ch, mob, sn ) )
      {
         act( AT_TELL, "\r\n$n tells you 'I don't know how to teach that.'", mob, NULL, ch, TO_VICT );
         send_to_char( "\r\n&WType 'help Teacher' for help finding new spells/skills in the realms.\r\n", ch );
         return;
      }

      /*
       * Skill requires a special teacher - run through the list of teachers
       * Check into the possibility of activating mppractice mobs with practice command.
       */
      if( VLD_STR( skill_table[sn]->teachers ) )
      {
         /*
          * Get the mob vnum here 
          */
         snprintf( buf, MSL, "%d", mob->pIndexData->vnum );
         if( !is_name( buf, skill_table[sn]->teachers ) )
         {
            act( AT_TELL, "\r\n$n tells you, 'I do not know how to teach that.'", mob, NULL, ch, TO_VICT );
            send_to_char( "\r\n&WType 'help Teacher' for help finding new spells/skills in the realms.\r\n", ch );
            return;
         }
      }

      SKILLTYPE *skill;

      skill = skill_table[sn];

      highskill = ( get_curr_str( ch ) + get_curr_dex( ch ) ) / 2;
      highspell = ( get_curr_int( ch ) + get_curr_wis( ch ) ) / 2;

      if( skill->type == SKILL_SKILL )
         usehigh = highskill;
      else if( skill->type == SKILL_SPELL )
         usehigh = highspell;

      if( ch->pcdata->learned[sn] > ( get_maxadept( ch, sn, TRUE ) - 6 ) || ch->pcdata->learned[sn] > 40 )
      {
         act_printf( AT_TELL, mob, NULL, ch, TO_VICT, "$n tells you, 'I've taught you everything I can about %s.'", skill_table[sn]->name );
         act( AT_TELL, "$n tells you, 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
      }
      else if( ( skill->type == SKILL_SKILL || skill->type == SKILL_SPELL )
      && ( ( usehigh >= 18 && ch->pcdata->learned[sn] >= 45 )
      || ( ( usehigh > 15 && usehigh < 18 ) && ch->pcdata->learned[sn] >= 40 )
      || ( ( usehigh < 16 && usehigh > 13 ) && ch->pcdata->learned[sn] >= 35 )
      || ( usehigh < 14 && ch->pcdata->learned[sn] >= 30 ) ) )
      {
          act_printf( AT_TELL, mob, NULL, ch, TO_VICT, "$n tells you, 'I've taught you everything I can about %s.'", skill_table[sn]->name );
          act( AT_TELL, "$n tells you, 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
      }
      else
      {
         ch->practice--;
         if( ch->pcdata->learned[sn] <= 0 )
            ch->pcdata->learned[sn] += 10;
         else
            ch->pcdata->learned[sn] += 5;
         act( AT_ACTION, "You practice $T.", ch, NULL, skill_table[sn]->name, TO_CHAR );
         act( AT_ACTION, "$n practices $T.", ch, NULL, skill_table[sn]->name, TO_ROOM );

         // check if skill and str > certain amount max 45 else 35
         if( skill->type == SKILL_SKILL || skill->type == SKILL_SPELL )
         {
            if( usehigh >= 18 )
            {
               if( ch->pcdata->learned[sn] >= 40 && ch->pcdata->learned[sn] < 50 )
               {
                  ch->pcdata->learned[sn] = 45;
                  act( AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
               }
            }
            else if( usehigh > 15 && usehigh < 18 )
            {
               if( ch->pcdata->learned[sn] >= 30 && ch->pcdata->learned[sn] < 41 )
               {
                  ch->pcdata->learned[sn] = 40;
                  act( AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
               }
            }
            else if( usehigh < 16 && usehigh > 13 )
            {
               if( ch->pcdata->learned[sn] >= 30 && ch->pcdata->learned[sn] < 41 )
               {
                  ch->pcdata->learned[sn] = 35;
                  act( AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
               }
            }
            else if( usehigh < 14 )
            {
               if( ch->pcdata->learned[sn] >= 20 && ch->pcdata->learned[sn] < 40 )
               {
                  ch->pcdata->learned[sn] = 30;
                  act( AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
               }
            }
         }
      }
   }
}

The way it was meant it was suppose to show it every time. This should take into consideration if it should be shown or not. The only thing that might be a bit annoying is if you have it so it doesn't show any trade skills but it still shows the header for the trade skills. You could make it only do it if one is shown but would take quite a bit of lines and all to make sure it only shows it when one of the trade skills is being shown.
       
Post is unread #3 Dec 10, 2010, 5:16 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

Thanks for the help Remcon! Can't believe how simple that was. Also updated the returns in there a bit so that there was a return regardless of which skill was hidden--currently only set for the second/third skills...first skills never had a return, while second and third skills always had a \r\n. heh Now it's uniform to the rest of the module. :)

Cheers,
Aurin
       
Post is unread #4 Dec 11, 2010, 5:15 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Your welcome. Lol, I didn't even pay that any attention till you mentioned it. Instead of doing a \r\n for each I would try to do it like the rest of the skills. If it only shows 2 trade skills return after the second one if it shows 3 return after the third, etc...
       
Post is unread #5 Dec 11, 2010, 8:01 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

I did this and it works beautifully. :)

 if( ch->pcdata->tradeclass > 1 )
      {
         set_pager_color( AT_CYAN, ch );
         pager_printf_color( ch, "\t\t           &C_.:[" );
         set_pager_color( AT_CYAN, ch );
         pager_printf_color( ch, "  &RTrade Skills&D " );
         set_pager_color( AT_CYAN, ch );
         send_to_pager_color( "&C]:._&D\r\n", ch );
         col = cnt = 0;
         if( ch->pcdata->tradeclass == 20 )
         {
            sn = gsn_mine;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_forge;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
         }
         if( ch->pcdata->tradeclass == 21 )
         {
            sn = gsn_gather;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_bake;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_mix;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
         }
         if( ch->pcdata->tradeclass == 22 )
         {
            sn = gsn_hunt;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
            sn = gsn_tan;
            if( ( showdshow && ch->pcdata->dshowlearned[sn] == TRUE ) || ( !showdshow && ch->pcdata->dshowlearned[sn] == FALSE ) )
               pager_printf( ch, "&c%20s &W%3d%% ", skill_table[sn]->name, ch->pcdata->learned[sn] );
         }
// This was the addition
      if( col % 3 == 0 )
        send_to_pager("\r\n", ch);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      }


And with the removal of all the /r/n's, that last check worked just fine. heh
       
Post is unread #6 Dec 12, 2010, 8:29 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Well col is set to 0 at the top col = cnt = 0; and is never modified during the process. So you could take that out and the if( col % 3 == 0 ) parts and just do the send_to_char( "\r\n", ch ); and it work the same way :).
       
Post is unread #7 Dec 13, 2010, 10:28 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

Figures I'd make it more difficult for myself. :headbang: :rolleyes: :lol:
       
Post is unread #8 Dec 14, 2010, 4:59 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

You should see some of the difficulty I've created for myself over the years lol.
       
Post is unread #9 Dec 15, 2010, 7:38 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Remcon said:

You should see some of the difficulty I've created for myself over the years lol.

I can vouch for some of those. ;) :lol:
       
Post is unread #10 Dec 16, 2010, 12:53 am
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

so I'll just continue to gain experience the easy way: by asking for help when I get stuck, instead of trying to muddle through on my own. :whistle: :lol:
       
Post is unread #11 Dec 16, 2010, 4:23 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Lol, yes you can Conner and so can Aurin (even if he doesn't know it yet) lol.

Aurin is working on code I did long ago up to some (very little) that was in the past year or so lol.
       
Post is unread #12 Dec 18, 2010, 3:54 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Ribbing aside, Aurin, you're in good hands with Remcon. :)
       
Post is unread #13 Dec 18, 2010, 6:24 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

yeah, i know...have talked with Remcon on numerous occasions about random things. i trust what is said, just need some things explained so i can learn ands not look like such an idiot next time heh :P
       
Post is unread #14 Dec 19, 2010, 7:09 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Don't fret it, noone here ever thinks someone's an idiot because they missed something or didn't understand something (or, at least, if they do think it they are kind enough to not say it. ;))
       
Post is unread #15 Dec 20, 2010, 4:43 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Never just trust what I say, I'm the first one to say I'll make a mistake, be it just not paying attention, or I misunderstand the desired affect so always test what I say out to find out if you get the desired result.

Lol, Conner plenty of people will think it and some will even say it, a lot of the time though it is a failure in communication or understanding of the problem. All you can really do is try to keep calm (as hard as it may be) and retry to explain your position on it etc... I have even looked at code I did long ago and wonder what the hell I was thinking when I did it lol.
       
Post is unread #16 Dec 20, 2010, 5:21 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Don't let Remcon talk you into mistrusting his skills, if he says do it this way, it's probably safe to do it this way. If doing it the way he suggests doesn't yield what you're expecting though, be quick to call him on it and he'll usually be really quick to point out for you what he got wrong and why as well as how to make it right. ;)

Yes, Remy, plenty of folks might think it but they usually won't say it here.. they might take it to ichat but they usually won't just blurt it here.. :P
And, yes, once you get to a reasonable competence level with the code, most of the time the problems you encounter here are miscommunication or trying to solve the wrong aspect. As for that last part, that's where comments and backups are most helpful. :lol:
       
Post is unread #17 Dec 20, 2010, 6:26 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

I always test everything on a localhost. heh that way I can tweak every number and see how it effects everything. ...to include crashing the game! :lol:
       
Post is unread #18 Dec 21, 2010, 7:26 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Sounds like a wise practice. :)
       
Pages:<< prev 1 next >>