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 ➜ A few questions.

A few questions.

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


Pages: 1  2  3  4 5  6  

Posted by Longbow   (102 posts)  Bio
Date Reply #45 on Thu 12 May 2005 12:32 AM (UTC)

Amended on Thu 12 May 2005 08:50 PM (UTC) by Longbow

Message
Ok, I got that fixed. Thanks. Now another question. I'm trying to extend the time it takes to get hungry, as it is really getting on my nerves with the continuous feeding process. However I cannot seem to find out which variable to change. I grepped hunger_mod but it doesn't seem to be the right one. Which variable would it be?

More critically, I keep getting a segmentation fault(core dumped) message that crashes the mud. It always seems to come after wildlands.are is reset but it resets that area at other times without problem. Why is this?


Thanks and Godbless,
Longbow
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #46 on Thu 12 May 2005 09:01 PM (UTC)
Message
It all happens in a function called gain_condition, as for a suitable way to modify it im at a loss without reading throught it and all the places it is called.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Longbow   (102 posts)  Bio
Date Reply #47 on Fri 13 May 2005 01:51 AM (UTC)
Message
Ok thanks. Now about the segmentation fault(core dumped) error. I've narrowed it down to an area file, but what in it would cause it?


Thanks

Godbless,
Longbow
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #48 on Fri 13 May 2005 02:04 AM (UTC)
Message
Have you tried gdb? It helps a lot.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Longbow   (102 posts)  Bio
Date Reply #49 on Fri 13 May 2005 02:10 AM (UTC)
Message
I'm sorry, I don't know what that is.


Longbow
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #50 on Fri 13 May 2005 02:23 AM (UTC)
Message
Right at the top of the Smaug coding page there's a guide.

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3653

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #51 on Fri 13 May 2005 06:49 AM (UTC)
Message
Like grep to find things you need to make GDB your friend, gdb will help you in most cases pinpoint where a problem is occuring.

Nicks tutorial is fantastic but when i first read it i was overwelmed by the amount of detail he gave and was in some ways lost in all the details.

There are 2 main ways you can use it, by having it analize a core file, or by running the program within gdb while debuging, this is my preference while working on my local machine because for some unknown reason i donot make core files localy.

cd into your area directory,
run gdb
type file ../src/smaug (or the path to your executable)
type run

You now have smaug running in gdb, login to the mud and cause it to crash.

Go back into gdb,

Type bt (backtrace will show you the last bunch of functions called befor the crash)

frame <number> will take you to function you think caused the crash.

then you can type LIST to see the section of code.

Print <variable name> will show you what the variable contains.


Hope this helps you some.

Peace.


Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Longbow   (102 posts)  Bio
Date Reply #52 on Fri 13 May 2005 04:52 PM (UTC)
Message
Ok thanks guys. It appears to be fixed. Now I went to put in the slice skill(it came with Smaug) and everytime I try to slice something it says:
"Can not find mob for value[2] of corpse, do_slice".
Now how would one fix that? I know that it needs to be set to a value of two, but how do I do that? Newbish question I know, but I'm getting there. :)

Thanks for all your help and Godbless,
Longbow

Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #53 on Fri 13 May 2005 05:26 PM (UTC)
Message
In the code? Then something like this:
obj->value[2] = whatever;

Or use oset to set it in the mud. I assume it is using v2 to lookup a mob vnum.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Longbow   (102 posts)  Bio
Date Reply #54 on Fri 13 May 2005 06:48 PM (UTC)
Message
I think you're right, but I don't understand as to whether I need to oset just the corpse or every mob or what? What needs its value2 set?

Longbow
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #55 on Fri 13 May 2005 09:16 PM (UTC)
Message
From my quick read of do_slice, v2 is used to determine a food value for the mob corpse in question, beacuse if slice is successfull you end up with vnum 24 and i think thats a chunk of meat.

Now if you look through the code you will see that V2 never gets used at all within the function, but V3 does.

ALso if you kill something and ostat the corpse object you will find that V2 is set on the object but not in the index object and its checking the index value.

Index Values : 0 0 0 1 0 0.
Object Values: 0 0 6 1 0 0.

I would just remove the whole V2 check as its there for no reason that i can tell, and posibly change the values in v3 as 75 seems a little high when i got a value of 1 for the biggest mob in my game.


Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Longbow   (102 posts)  Bio
Date Reply #56 on Sat 14 May 2005 11:36 PM (UTC)
Message
I've tried deleting it but when I make it says it may be called anyway or something like that. Running the game and trying to slice the corpse results in a crash by a segmentation fault. What would one to do delete that function, or what could I change the command to so that it does something useless but thinks it's doing something?

Thanks and Godbless,
Longbow
Top

Posted by Longbow   (102 posts)  Bio
Date Reply #57 on Tue 17 May 2005 12:36 AM (UTC)
Message
Sorry guys, I'm kinda boggled. What should I do since I can't delete the line of code? It's still calling from somewhere so it crashes when I run it. What could I set that command to so it will never be called?

Thanks, Godbless,
Longbow
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #58 on Tue 17 May 2005 12:41 AM (UTC)

Amended on Tue 17 May 2005 12:51 AM (UTC) by Robert Powell

Message
There are some other changes that need to be made in order to make it work right. It uses pMobindex->blaa its trying to set values on a mobile when it should be setting them on an object, corpse->blaa, the other change is slice->value3 = this makes the food item poison so delete it and set values for v0 (food value) and v1 (condition).

void do_slice( CHAR_DATA *ch, char *argument )
{
  OBJ_DATA *corpse;
  OBJ_DATA *obj;
  OBJ_DATA *slice;
  bool found;
  char buf[MAX_STRING_LENGTH];
  char buf1[MAX_STRING_LENGTH];
  found = FALSE;

  if ( !IS_NPC(ch) && !IS_IMMORTAL(ch)
  &&   ch->level < skill_table[gsn_slice]->skill_level[ch->class] )
  {
    send_to_char("You are not learned in this skill.\n\r", ch );
    return;
  }

  if ( argument[0] == '\0' )
  { 
    send_to_char("From what do you wish to slice meat?\n\r", ch);
    return;
  }


  if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL
  ||   ( obj->value[3] != 1 && obj->value[3] != 2 && obj->value[3] != 3
      && obj->value[3] != 11) )
  {
    send_to_char( "You need to wield a sharp weapon.\n\r", ch);
    return;
  }

  if ( (corpse = get_obj_here( ch, argument )) == NULL)
  {  
    send_to_char("You can't find that here.\n\r", ch);
    return;
  }

 if (corpse->item_type != ITEM_CORPSE_NPC )
  {
    send_to_char("That is not a suitable source of meat.\n\r", ch);
    return;
  } 

 if ( get_obj_index(OBJ_VNUM_SLICE) == NULL )
  {
    bug("Vnum 24 not found for do_slice!", 0);
    return;
  }

  if ( !can_use_skill(ch, number_percent(), gsn_slice ) && !IS_IMMORTAL(ch))
  { 
    send_to_char("You fail to slice the meat properly.\n\r", ch);
    learn_from_failure(ch, gsn_slice); /* Just in case they die :> */
    if ( number_percent() + (get_curr_dex(ch) - 13) < 10)   
    {
      act(AT_BLOOD, "You cut yourself!", ch, NULL, NULL, TO_CHAR);
      damage(ch, ch, ch->level, gsn_slice);
    }
    return;
  }

  slice = create_object( get_obj_index(OBJ_VNUM_SLICE), 0 );

  sprintf(buf, "meat fresh slice %s", corpse->name);
  STRFREE(slice->name);
  slice->name = STRALLOC(buf);

  sprintf(buf, "a slice of raw meat from %s", corpse->short_descr);
  STRFREE(slice->short_descr);
  slice->short_descr = STRALLOC(buf);

  sprintf(buf1, "A slice of raw meat from %s lies on the ground.", corpse->short_descr);
  STRFREE(slice->description);
  slice->description = STRALLOC(buf1);
    
  act( AT_BLOOD, "$n cuts a slice of meat from $p.", ch, corpse, NULL, TO_ROOM);
  act( AT_BLOOD, "You cut a slice of meat from $p.", ch, corpse, NULL, TO_CHAR);
  slice->value[0] = 25;
slice->value[0] = 13;
  obj_to_char(slice, ch);
  
  learn_from_success(ch, gsn_slice);
  return;
}


There is one other thing you might want to do and thats remove the corpse after the meat has been sliced, otherwise you could slice meat for all eternity.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Gatewaysysop2   USA  (146 posts)  Bio
Date Reply #59 on Wed 18 May 2005 01:27 AM (UTC)

Amended on Wed 18 May 2005 01:28 AM (UTC) by Gatewaysysop2

Message
I'm confused about this part:


  act( AT_BLOOD, "$n cuts a slice of meat from $p.", ch, corpse, NULL, TO_ROOM);
  act( AT_BLOOD, "You cut a slice of meat from $p.", ch, corpse, NULL, TO_CHAR);
slice->value[0] = 25;
slice->value[0] = 13;
  obj_to_char(slice, ch);



Why is slice->value[0] being set to 25 and then to 13? Why not just do one or the other? Is there a typo here?

"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence
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.


222,514 views.

This is page 4, subject is 6 pages long:  [Previous page]  1  2  3  4 5  6  [Next page]

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.