newbie questions

Posted by Beven on Sat 18 Jun 2005 08:53 PM — 3 posts, 12,908 views.

#0
Ok, I am basicly new to 'C', and almost compleatly new to
smaug. I compiled the server under linux just fine.
I found a nice banking snipit, and thought it might be a good first addition to the code. Its the banking with account creations system form Taltos. (who modified work by Minas Ravenblood) . I followed the directions for instalation just fine until the last bit :

Add ACT_BANKER as an act flag -- make sure to edit the list of flags in build.c

Being a total Noob I had no real idea how to fo that so I dug around and guessed and probably got it wrong.

I added ACT_BANKER to mud.h like this:

#define ACT_SENTINEL 1 /* Stays in one room */
#define ACT_SCAVENGER 2 /* Picks up objects */
#define ACT_BANKER 3 /* banker */
/* bit 4 is unused here */
#define ACT_AGGRESSIVE 5 /* Attacks PC's */
#define ACT_STAY_AREA 6 /* Won't leave area */

and added ACT_BANKER to build.c like this:

char * const act_flags [] =
{
"npc", "sentinel", "scavenger", "r1", "r2", "aggressive", "stayarea",
"wimpy", "pet", "train", "practice", "immortal", "deadly", "polyself",
"meta_aggr", "guardian", "running", "nowander", "mountable", "mounted",
"scholar", "secretive", "hardhat", "mobinvis", "noassist", "autonomous",
"pacifist", "noattack", "annoying", "statshield", "prototype", "r14",
"ACT_BANKER"
);

compiled without error and run the code
added commands for bank and bankinfo and bankedit

everything is fine except that the bank command gives the "you are not in a bank" message regardless of the existance of a mob with the ACT_BANKER flag set in the room.
mstat banker shows the flag.

I commented out the check for the mob compleatly and the bank command worked ok (from ANY room on the mud)
the info and edit commands worked as expected

remove the comments and it's back to "your not in a bank"

I suspect that I have overlooked something I need to do to make the act flag correctly.

Can anyone tell me what I have done wrong/not done ????

Beven
USA #1
The array of strings (flag names) has to be in the same order as your ACT_... defines. Since you put ACT_BANKER after ACT_SCAVENGER, then you need to replace the entry after "scavenger" with "banker".

The array is basically a mapping of flag number to string name. The fourth flag will have its name defined in the fourth slot of the array. (Note that 'fourth' really means index 3...)
#2
DOH..... ok thanks, that makes perfect sense now that it has been explained...

Beven