Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ newbie questions

newbie questions

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Beven   (3 posts)  Bio
Date Sat 18 Jun 2005 08:53 PM (UTC)
Message
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
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Sat 18 Jun 2005 09:02 PM (UTC)
Message
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...)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Beven   (3 posts)  Bio
Date Reply #2 on Sat 18 Jun 2005 11:40 PM (UTC)
Message
DOH..... ok thanks, that makes perfect sense now that it has been explained...

Beven
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,663 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.