setdeity - no help file

Posted by Whisperedecho on Thu 15 May 2008 07:54 PM — 12 posts, 39,732 views.

USA #0
There is no helpfile in Smaug for the setdeity command.

I already checked the Commmand section of the website and it didn't have any description for the fields.

Could someone tell me what each field is for? Thanks.

EDIT:

Cross posted on SmaugMUDS: http://www.smaugmuds.org/index.php?a=topic&t=3709&p=15215#p15215
Amended on Thu 15 May 2008 10:58 PM by Whisperedecho
USA #1
I don't know the answer to your question, unfortunately, but here is how I would find out: I would go look at the code for do_setdeity and inspect how it handles each of its arguments. The nice thing about having the source is that you can look up exactly what the code actually does, as opposed to what help files say it does (assuming they exist in the first place).
USA #2
Thanks for your suggestion Dave.

I looked through the code but I couldn't find anything that suggests what they do. Maybe I'm just not looking in the right place. I looked in deity.c and all I found was ifchecks that let the user know that the flag is set. *shrug*

I'll keep looking and see what I can find.
USA #3
One of the nice things about SMAUG is that the organization of functions is fairly intuitive. Almost all commands are declared in alphabetical order in mud.h with "do_" in front of their names. The definitions for the functions are then found throughout the .c files.

An incredibly helpful unix command that you might not be aware of is 'grep'. It searches all specified files and returns the line(s) in each file that match your string. For instance,

$ grep -n 'do_setdeity' *.c

in the src directory returns

deity.c:356:void do_setdeity( CHAR_DATA * ch, char *argument)
deity.c:906:   do_setdeity( ch, "" );

From here, you can find line 356 in deity.c and examine each identified argument in the do_setdeity function.
Amended on Tue 20 May 2008 05:05 PM by Mase
USA #4
Mase,

I already tried that. Basically for each field, it just checks the argument and then outputs "Done" to the screen. Still doesn't explain what each field does. I've pretty much figured out what all of them do at this point through trial and error.
USA #5
Here's something you've seen already if we're looking at the same file, but since we're clearly on different pages, I'll post it.

$grep -n '!str_cmp( arg2, "\w*" )' deity.c
423:   if( !str_cmp( arg2, "delete" ) )
454:   if( !str_cmp( arg2, "name" ) )
475:   if( !str_cmp( arg2, "filename" ) )
493:   if( !str_cmp( arg2, "description" ) )

And the list goes on, alignment, flee, flee_npcrace, etc. What you're saying, if I'm interpreting you correctly (why don't you post some of the code that merely outputs "Done" to the screen?), is that within each of these if statements, nothing happens.

Maybe you have a bad .c file, but each if statement should accomplish what it says it does. Small example from the file that I have:

if( !str_cmp( arg2, "description" ) )
{
   if( ch->substate == SUB_REPEATCMD )
      ch->tempnum = SUB_REPEATCMD;
   else
      ch->tempnum = SUB_NONE;
   ch->substate = SUB_DEITYDESC;
   ch->dest_buf = deity;
   start_editing( ch, deity->description );
   return;
}

Should be set up the same way for you.
USA #6
The if statements look like this:


if( !str_cmp( arg2, "flee_npcrace" ) )
   {
      deity->flee_npcrace = atoi( argument );
      send_to_char( "Done.\r\n", ch );
      save_deity( deity );
      return;
   }


I believe our files are the same as I found the description field from your code above and it was the same

Maybe it's just me and I'm not looking at the code right but to me, this doesn't tell me what flee_npcrace does.

I know from trial and error that it adjusts your favor when you flee from whatever race is set as npcrace but I can't find in the code where I could tell that without going through trial and error.
Amended on Tue 20 May 2008 10:13 PM by Whisperedecho
Australia Forum Administrator #7
Some of these admin commands have built-in help. Did you try just typing "setdeity"? I did, and this is what I saw:


setdeity

Log: Admin: setdeity
Usage: setdeity <deity> <field> <toggle>

Field being one of:
filename name description type alignment worshippers npcfoe susceptnum
race race2 npcrace class element sex affected suscept elementnum affectednum

Favor adjustments:
flee flee_npcrace kill kill_npcrace kill_magic
die die_npcrace dig_corpse bury_corpse spell_aid
steal backstab aid aid_spell sac kill_npcfoe
die_npcfoe flee_npcfoe

Favor requirements for supplicate:
scorpse savatar sdeityobj srecall

Objstat - being one of:
str int wis con dex cha lck
 0 - 1 - 2 - 3 - 4 - 5 - 6


Amended on Tue 20 May 2008 10:47 PM by Nick Gammon
USA #8
Yep I already did that. Actually that was the first thing I did lol.

Maybe I am confusing everyone. I know that those fields adjust favor. I was just curious as to what each one did.

For example, kill_magic:

Does that mean that every time you kill a magic mob or player that it affects your favor negatively/positively?

Like I said before, I figured out most of them just by trial and error while messing around in my MUD but I was just curious.
USA #9
Okay, so you're saying that most of these routines merely set a value for the deity you're modifying. In your example, deity->flee_npcrace is set to the following argument.

I don't want to sound like a broken record in my third post on these forums, but the best way to determine the role of an object like deity->flee_npcrace is to search any relevant .c files for 'deity->flee_npcrace' and examine the places it's referenced.
Australia Forum Administrator #10
Take a look at the file doc/SMAUGDOC which comes with Smaug. Amongst other things, it says:


*npcfoe -- This is the # of the race that the deity "dislikes" so you get more
        favour of killing a mob of this race. For example to set this deities
        npcfoe to coder which lets say is race #4, you could do either:
                setdeity shaddai npcfoe 4               OR
                setdeity shaddai npcfoe coder

*susceptnum -- This sets the amount of favour needed otherwise, you get
        set to any suscepts the deity has.  For example if it was set to
        500 and your favour was 400, you would be susceptible to whatever
        this deities suscepts are.
                setdeity shaddai susceptnum 500

*race   -- If this is set then this deity only accepts worshippers of a certain
        race.  This too can be set by the name of the race or by the number.
        So for example if you wanted the deity so only humans can devote to
        it you would do:
                setdeity shaddai race human
        To clear this value set it to -1, like this:
                setdeity shaddai race -1

*race2  -- If this is set 2 races can devote to this deity, but it will only be
        checked if race is set as well.  So if you wanted Shaddai deity to
        have worshippers of humans AND dwarfs, you would do this:
                setdeity shaddai race2 dwarf
        Just like above to clear this flag set it to -1.

*npcrace -- This is similar to npcfoe, but you get a little less favour from
        killing these than a npcfoe.
                setdeity shaddai npcrace human


Now starting with that, and checking out deity.c to see what the fields for adjust_favor are:


/*
Internal function to adjust favor.
Fields are:
0 = flee                5 = sac                 10 = backstab   
1 = flee_npcrace        6 = bury_corpse         11 = die
2 = kill                7 = aid_spell           12 = die_npcrace
3 = kill_npcrace        8 = aid                 13 = spell_aid
4 = kill_magic          9 = steal               14 = dig_corpse
15 = die_npcfoe        16 = flee_npcfoe         17 = kill_npcfoe
*/
void adjust_favor( CHAR_DATA * ch, int field, int mod )


I now do a grep adjust_favor to see where it is called:


$ grep adjust_favor *.c
act_obj.c:      adjust_favor( ch, 6, 1 );
act_obj.c:      adjust_favor( ch, 5, 1 );
deity.c:void adjust_favor( CHAR_DATA * ch, int field, int mod )
fight.c:               adjust_favor( ch, 3, level_ratio );
fight.c:               adjust_favor( ch, 17, level_ratio );
fight.c:               adjust_favor( ch, 2, level_ratio );
fight.c:         adjust_favor( victim, 11, 1 );
fight.c:         adjust_favor( ch, 2, 1 );
fight.c:               adjust_favor( victim, 12, level_ratio );
fight.c:               adjust_favor( victim, 15, level_ratio );
fight.c:               adjust_favor( victim, 11, level_ratio );
fight.c:               adjust_favor( ch, 1, level_ratio );
fight.c:               adjust_favor( ch, 16, level_ratio );
fight.c:               adjust_favor( ch, 0, level_ratio );
magic.c:      adjust_favor( ch, 7, 1 );
magic.c:      adjust_favor( victim, 13, 1 );
magic.c:      adjust_favor( ch, 4, 1 );
polymorph.c:         adjust_favor( ch, -1, 1 );
skills.c:      adjust_favor( ch, 14, 1 );
skills.c:   adjust_favor( ch, 9, 1 );
skills.c:      adjust_favor( ch, 10, 1 );
skills.c:   adjust_favor( ch, 8, 1 );
skills.c:      adjust_favor( ch, 9, 1 );
skills.c:      adjust_favor( ch, 9, 1 );
skills.c:      adjust_favor( ch, 9, 1 );
skills.c:   adjust_favor( ch, 8, 1 );
skills.c:      adjust_favor( ch, 10, 1 );


Burrowing into fight.c it seems that you get 3 possible favor adjustments:

  • A standard "flee"
  • One for fleeing from the deity's npc race
  • One for fleeing from the deity's npc foe


If you work out what it all means you are welcome to add to the wiki at:

http://www.gammon.com.au/forum/?wiki=setdeity


USA #11
Ok, thanks Nick. I will definitely add it to the wiki.