Practice command

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago - 2 years 1 month ago #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: 2 years 1 month ago by JTP.

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

More
2 years 1 month ago #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
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:
extern const char *unused_spellname;

The usual disclaimers apply - forum code, etc.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago #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
2 years 1 month ago #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.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago #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 ?
    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
2 years 1 month ago #6184 by thomas
Replied by thomas on topic Practice command
I would probably rewrite it to help on readability:
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.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago #6185 by JTP
Replied by JTP on topic Practice command
I used that last one you posted, Works just great..thanks alot.

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

Time to create page: 2.709 seconds