Welcome to the Builder Academy

Question Practice command

More
27 Sep 2016 22:03 - 28 Sep 2016 13:21 #6177 by JTP
Practice command was created by JTP
Hey

When i type practice, then i see this:

!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
!UNUSED! (superb)
animate dead (superb)
armor (superb)


Why do i get all those !UNUSED!, before my spells/skills shows ?

Its just this way on immortals...players dont see unused
Last edit: 28 Sep 2016 13:21 by JTP.

Please Log in or Create an account to join the conversation.

More
28 Sep 2016 20:51 #6178 by thomas
Replied by thomas on topic Practice command
this line in spell_parser.c sets the level to LVL_IMMORT and the name to !UNUSED! for all spells. Subsequent definitions adjust this for actual set skills and spells.
github.com/tbamud/tbamud/blob/2f12752373.../spell_parser.c#L723

But, somewhere there must be a check missing when listing them back out.

In lists_skills in spec_procs.c (practice is part of the guild_master special procedure), adjust this loop:
github.com/tbamud/tbamud/blob/2f12752373...rc/spec_procs.c#L112
Code:
for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) { i = spell_sort_info[sortpos]; - if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) { + if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)] && spell_info[i].name != unused_spellname) { ret = snprintf(buf2 + len, sizeof(buf2) - len, "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i))); if (ret < 0 || len + ret >= sizeof(buf2)) break; len += ret; } }

You may need to add this line below the #imports at the top of the file:
Code:
extern const char *unused_spellname;

The usual disclaimers apply - forum code, etc.

Please Log in or Create an account to join the conversation.

More
28 Sep 2016 21:39 #6179 by JTP
Replied by JTP on topic Practice command
So you also experienced this problem ?

Please Log in or Create an account to join the conversation.

More
28 Sep 2016 22:02 #6180 by thomas
Replied by thomas on topic Practice command
It looks like it's a tbamud issue, yes

Please Log in or Create an account to join the conversation.

More
29 Sep 2016 11:46 #6182 by JTP
Replied by JTP on topic Practice command
I have this line to also show skills learned not from guildmaster. How would you add it to that ?
Code:
if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)] || GET_SKILL(ch, i) > 0) { nlen = snprintf(buf2 + len, sizeof(buf2) - len, "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i)));

Please Log in or Create an account to join the conversation.

More
29 Sep 2016 19:11 #6184 by thomas
Replied by thomas on topic Practice command
I would probably rewrite it to help on readability:
Code:
for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) { i = spell_sort_info[sortpos]; if (spell_info[i].name == unused_spellname) { continue; } if (GET_LEVEL(ch) < spell_info[i].min_level[(int) GET_CLASS(ch)] && GET_SKILL(ch, i) == 0) { continue; } ret = snprintf(buf2 + len, sizeof(buf2) - len, "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i))); if (ret < 0 || len + ret >= sizeof(buf2)) break; len += ret; }
Disclaimers still apply - this has not been compiled.

Please Log in or Create an account to join the conversation.

Time to create page: 0.254 seconds