Coding Tutorial: How do I add skills to SMAUG?

Posted by Aqueus on Fri 16 Feb 2007 05:27 AM — 9 posts, 28,558 views.

USA #0
Ok, I just a quick run-by on what all to add.

I'm pretty sure you need to add the gsn_constant for that specific skill to the mud.h (perhaps twice...) add the two different ifchecks to tables.c...

Can anyone just go over the places I need to update to add a skill to SMAUG? I'm drawing a blank. The MUD compiles cleanly, but I get these after-compile errors:

tables.o(.text+0x7f40):/home/mirage21/dbsc/src/tables.c:1542: undefined reference to `do_rename'
tables.o(.text+0x7f95):/home/mirage21/dbsc/src/tables.c:1547: undefined reference to `do_radar'

That's just two... there're like... ~100 more... I must be missing something important.
USA #1
Seems like you forgot the do_ lines in mud.h, and maybe tables.c.

Why not just follow how another skill is coded in? Like punch?
USA #2
I tried that, but couldn't figure out where I'd gone wrong, I had hoped that someone would spot the error and be able to say "Oh! You simply forgot to put the skills (or do_ calls, or whatever) <here>."

Sadness!

Also, I think this would be a good idea to have on hand. Basically a checklist of what exactly to do whenever you want to implement a skill.

Lastly, it's REALLY hard to tell where all a string of text touches. I'm not really sure I know all the places "do_punch" is used. So, again... a little help, please? >.>
USA #3
grep do_punch *.[ch]

grep gsn_punch *.[ch]


Don't forget to do a clean compile, which seems like something you might have forgotten.
USA #4
Are all those skills that don't have references things you added, or stock skills? It's very strange that skills would suddenly stop working... you must have broken something. Do you have a specific log of what you changed? You can download a stock copy of your code base and do "diff" to compare files.

I'd make sure you didn't mess up your Makefile by removing object files, but I'm not sure what you'd have been doing in there doing that.
USA #5
Those are skills that I've added. I think it's because I haven't actually defined the functions, it's a long story, but again, I was really hoping for a kind of tutorial, afraid that I was missing some vital place to mention the skill, though I will try that grep, it'd be cool if you explained exactly what that string of characters searched for, I'm quite the newbie at using grep.
USA #6
Wait... if you haven't actually defined the skill functions, why is it surprising that the linker is unable to find them? Or is that not what you meant?

Maybe it would help if you said what exactly you have done, so we can have a better picture of what's going on.
USA #7
I've always planned to write some tutorials for Smaug (how to add new command, skill, etc). Maybe I'll start doing that now.

[EDIT] Tutorial: http://www.mudbytes.net/index.php?a=articles&s=smaug_add_skill
Amended on Fri 16 Feb 2007 10:06 PM by Zeno
USA #8
Excellent! Thank you so much Zeno! I think I forgot some lines in db.c and a declare in tables.c. Ok, many thanks all!

Bai!