Coding skills [BEGINNER]

Posted by Helsing on Tue 10 Apr 2012 06:55 AM — 5 posts, 21,323 views.

#0
Hello! We are a couple of friends learning as we go with the SmaugFUSS 1.9 codebase.
What we would like to do is remove the "Tongues" from the practice list (and the game), so that there is only one language. The first thing we have tried is going into the tables.c file, and we found this line:

const char *skill_tname[] = { "unknown", "Spell", "Skill", "Weapon", ["Tongues",] "Herb", "Racial", "Disease" };

(We deleted the word 'Tongues'.)

Now, the tongues are still there in the skill list, but the heading is "Herbs". While it was not completely unforeseen, the task of actually removing the Tongues from the game is daunting indeed...any help would be much appreciated, at the very least as to the true nature of the scope of this task. Actual coding help would be cool, too...like I said, this is a learning project. :)
USA Global Moderator #1
It would be nice if you put a more relevant subject on this thread. Something like "Removing Tongues from game and practice list".

Quote:
(We deleted the word 'Tongues'.)

Now, the tongues are still there in the skill list, but the heading is "Herbs".


I'm curious what happens with Disease now. You can't usually just erase an item from an array like that. You'll index off the end and horrible things will happen.
Amended on Tue 10 Apr 2012 01:18 PM by Fiendish
#2
Where exactly would one go to just remove it from the prac list? Instead of just trying to eradicate it from code just having it so the player knows that it doesn't exist.

Im assuming I'll need to brush up on arrays since its been two years of not coding, oh boy.

On a scale of 1-10 how difficult would it be just to remove languages from the stock code (smaugfuss 1.9)
#3
Okay I removed all the instances of find_tongue and skill_tongue. Now when I type prac It's set into the unknown section. I just want it removed from the prac list, it's not important but it's just an ascetic thing to get me back into the swing of coding.
#4
Sounds like the player doing the command 'prac' still has the tongue as a skill.

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,
" ----------------------------------&C%ss&B----------------------------------\r\n",
skill_tname[skill->type] );
col = cnt = 0;
}
lasttype = skill->type;


See, it looks for the lasttype which is assigned by skill->table. If you have a skill set to a character which type had been removed from the table (because you removed it), it not going to know how to view it, so it defaults to the first in the list, unknown. You can see this when it does a pager_printf_color.

Short answer fix: remove the tongues from the skills.dat.

If you want to keep the functionality but don't want them to be shown, incorporate an 'if' statement that checks skill->type against SKILL_TONGUE.

Hope this helps.