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
➜ code needed - Only show skills learned
code needed - Only show skills learned
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Alyce
(43 posts) Bio
|
Date
| Wed 31 Aug 2016 07:36 AM (UTC) |
Message
| using Smaugfuss
void do_practice( CHAR_DATA* ch, const char* )
{
CHAR_DATA *mob;
int sn;
if( IS_NPC( 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 ) )
break;
int col;
short lasttype, cnt;
bool is_ok;
col = cnt = 0;
lasttype = SKILL_SPELL;
set_pager_color( AT_MAGIC, ch );
for( sn = 0; sn < num_skills; ++sn )
{
const SKILLTYPE *skill;
int normalSn;
// the first num_sorted_skills are sorted by type, so we don't want
// to index into skill_table -- that is sorted alphabetically -- so
// we need to do the following dance to check if we are in the
// sorted section or the unsorted section.
if( sn < num_sorted_skills )
{
skill = skill_table_bytype[sn];
// we are looping over the skills sorted by type.
// So, we need to get the normal sn as well.
normalSn = skill_lookup( skill->name );
}
else
{
skill = skill_table[sn];
normalSn = sn;
}
if( !skill || !skill->name || skill->name[0] == '\0' )
continue;
if( strcmp( skill->name, "reserved" ) == 0 && ( IS_IMMORTAL( ch ) || !CAN_CAST( ch ) ) )
{
if( col % 3 != 0 )
send_to_pager( "\r\n", ch );
set_pager_color( AT_MAGIC, ch );
send_to_pager_color( " &R[&WSpells&R]&W----------------------------------------------------------------------&z\r\n",
ch );
col = 0;
}
if( skill->type != lasttype )
{
if( !cnt )
send_to_pager( " (none)\r\n", ch );
else if( col % 3 != 0 )
send_to_pager( "\r\n", ch );
set_pager_color( AT_MAGIC, ch );
pager_printf_color( ch,
" &R[&W%ss&R]&W----------------------------------------------------------------------&z\r\n",
skill_tname[skill->type] );
col = cnt = 0;
}
lasttype = skill->type;
if( !IS_IMMORTAL( ch )
&& ( skill->guild != CLASS_NONE && ( !IS_GUILDED( ch ) || ( ch->pcdata->clan->Class != skill->guild ) ) ) )
continue;
if( mob )
{
if( skill->skill_level[mob->Class] > mob->level && skill->race_level[mob->race] > mob->level )
continue;
}
else
{
is_ok = FALSE;
if( ch->level >= skill->skill_level[ch->Class] )
is_ok = TRUE;
if( ch->level >= skill->race_level[ch->race] )
is_ok = TRUE;
if( !is_ok )
continue;
}
if( ch->pcdata->learned[sn] <= 0 && SPELL_FLAG( skill, SF_SECRETSKILL ) )
continue;
++cnt;
set_pager_color( AT_MAGIC, ch );
pager_printf( ch, "%22.20s", skill->name );
if( ch->pcdata->learned[normalSn] > 99 )
send_to_char( " &W[&GX&W]&z", ch);
else
if( ch->pcdata->learned[normalSn] < 99 )
send_to_char( " &W[ ]&z", ch);
if( ++col % 3 == 0 )
send_to_pager( "\r\n", ch );
}
if( col % 3 != 0 )
send_to_pager( "\r\n", ch );
what do I need to change so it only shows what I HAVE learned, not what i CAN learn? | Top |
|
Posted by
| Alyce
(43 posts) Bio
|
Date
| Reply #1 on Thu 01 Sep 2016 11:53 AM (UTC) |
Message
| Ok... I got it to show only the skills I've learned so far by changing the section area above to this
if( ch->pcdata->learned[sn] <= 0 && SPELL_FLAG( skill, SF_SECRETSKILL ) )
continue;
++cnt;
if( ch->pcdata->learned[normalSn] > 99 )
pager_printf( ch, "%22.20s", skill->name );
if( ++col % 3 == 0 )
send_to_pager( "\r\n", ch );
}
if( col % 3 != 0 )
send_to_pager( "\r\n", ch );
However I'm still getting large spaces of "blank-ness" any idea how to reduce that? | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Thu 01 Sep 2016 08:33 PM (UTC) |
Message
| Well, you are sending \r\n anyway, whether or not you print the spell name.
You probably want to change it to something like:
if( ch->pcdata->learned[sn] <= 0 && SPELL_FLAG( skill, SF_SECRETSKILL ) )
continue;
// skip spells we haven't learned
if ( ch->pcdata->learned[normalSn] <= 99 )
continue;
++cnt;
pager_printf( ch, "%22.20s", skill->name );
// and the rest
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Alyce
(43 posts) Bio
|
Date
| Reply #3 on Fri 02 Sep 2016 03:21 AM (UTC) |
Message
| Thank you! I got it working PERFECTLY how I want it to. This forum rocks. Sometimes I think I post too much, but then I get to thinking that MUDs aren't as popular as they used to be, so the forums aren't as active.
If I start to annoy you, let me know :) | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Fri 02 Sep 2016 09:51 PM (UTC) |
Message
| With luck you will help revive interest in MUDS. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
15,582 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top