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
➜ Sheath/Draw
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #15 on Sun 15 Apr 2007 02:59 AM (UTC) |
Message
| What is obj 1000? Sheath or weapon? And that's the error you're still getting? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #16 on Sun 15 Apr 2007 03:01 AM (UTC) |
Message
| In do_sheath, you probably want to actually unequip the weapon, and not just do obj_from_char. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Shawncplus
USA (21 posts) Bio
|
Date
| Reply #17 on Sun 15 Apr 2007 03:19 AM (UTC) |
Message
| I just tested that and it seem to be working so now I just have to work on Draw. The thing I need to fix is that it's checking the wrong thing. It should be doing
w_weapon = get_obj_list( ch, argument, w_sheath->first_content )
instead of checking to see if it's equipped.
This is what I have for Draw
void do_draw( CHAR_DATA * ch, char *argument )
{
OBJ_DATA *w_weapon;
OBJ_DATA *w_sheath;
w_weapon = get_obj_list( ch, argument, w_sheath->first_content);
if( !w_weapon )
{
send_to_char( "Draw what?\r\n", ch );
return;
}
if( ( w_sheath = get_eq_char(ch, WEAR_SHEATH ) ) == NULL )
{
send_to_char("\nYou don't even have a sheath to draw from.\r\n", ch);
return;
}
else
{
get_obj( ch, w_weapon, w_sheath );
obj_to_char( w_weapon, ch );
equip_char( ch, w_weapon, WEAR_WIELD );
ch_printf(ch, "You quickly draw %s from %s", w_weapon->short_descr, w_sheath->short_descr);
return;
}
}
This is giving me a core dump and I can't figure out why (though it's probably fairly obvious) |
Shawn B.
LazyCode.info
"I find myself in an industry that is identified by the frustration it causes it's customers." | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #18 on Sun 15 Apr 2007 03:21 AM (UTC) |
Message
| You could use gdb to track down at least what line is the problem. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Shawncplus
USA (21 posts) Bio
|
Date
| Reply #19 on Sun 15 Apr 2007 03:23 AM (UTC) |
Message
| Yeah I have GDC and I'm not sure how to use it with Cygwin.
Any tips? |
Shawn B.
LazyCode.info
"I find myself in an industry that is identified by the frustration it causes it's customers." | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #20 on Sun 15 Apr 2007 03:25 AM (UTC) |
Message
| |
Posted by
| Shawncplus
USA (21 posts) Bio
|
Date
| Reply #21 on Sun 15 Apr 2007 03:46 AM (UTC) Amended on Sun 15 Apr 2007 03:53 AM (UTC) by Shawncplus
|
Message
| OK, I've got it working without GDC. It works fine without bugs but it gives me the get message along with the draw message because I use get_obj() Here is the code:
void do_draw( CHAR_DATA * ch, char *argument )
{
OBJ_DATA *w_weapon;
OBJ_DATA *w_sheath;
if( argument == '\0' )
{
send_to_char( "Draw what?\r\n", ch );
return;
}
if( ( w_sheath = get_eq_char(ch, WEAR_SHEATH ) ) == NULL )
{
send_to_char("\nYou don't even have a sheath to draw from.\r\n", ch);
return;
}
else
{
w_weapon = get_obj_list( ch, argument, w_sheath->first_content);
if( !w_weapon )
{
act( AT_PLAIN, "There is no $T sheathed.", ch, NULL, argument, TO_CHAR );
return;
}
get_obj( ch, w_weapon, w_sheath );
obj_to_char( w_weapon, ch );
equip_char( ch, w_weapon, WEAR_WIELD );
ch_printf(ch, "You quickly draw %s from %s", w_weapon->short_descr, w_sheath->short_descr);
return;
}
}
If you guys/gals know a good substitution for get_obj()
please let me know, Zeno you've been a huge help
EDIT: I replaced get_obj() with obj_from_obj() and it _seems_ to be working bug free (keyword seems). |
Shawn B.
LazyCode.info
"I find myself in an industry that is identified by the frustration it causes it's customers." | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #22 on Sun 15 Apr 2007 06:48 AM (UTC) |
Message
| Yes, obj_from_obj is what you want to be using, not get_obj. Typically a good strategy is to look at how another function is implemented, like the get command, and imitate it; for example, get calls get_obj which then uses obj_from_obj.
By the way, it's gdb, not gdc. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Shawncplus
USA (21 posts) Bio
|
Date
| Reply #23 on Sun 15 Apr 2007 03:04 PM (UTC) |
Message
| GDB is GNU DeBugger, GDC is GNU Debugger for Cygwin |
Shawn B.
LazyCode.info
"I find myself in an industry that is identified by the frustration it causes it's customers." | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #24 on Sun 15 Apr 2007 06:51 PM (UTC) |
Message
| Are you using a non-standard Cygwin distribution? Even under Cygwin the package is named gdb:
http://www.cygwin.com/packages/
The gnu-gdc package is a compiler for the D programming language. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Shawncplus
USA (21 posts) Bio
|
Date
| Reply #25 on Mon 16 Apr 2007 05:40 PM (UTC) |
Message
| Either way it's done and this is a log of it in action.
<wielded> a shortsword named "Snakebite"
<worn as sheath> (PROTO) a newly created sheath
You dextrously slide a shortsword named "Snakebite" into a newly created sheath
You are using:
<worn as sheath> (PROTO) a newly created sheath (a shortsword named "Snakebite")
You quickly draw a shortsword named "Snakebite" from a newly created sheath
You are using:
<wielded> a shortsword named "Snakebite"
<worn as sheath> (PROTO) a newly created sheath |
Shawn B.
LazyCode.info
"I find myself in an industry that is identified by the frustration it causes it's customers." | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #26 on Mon 16 Apr 2007 05:49 PM (UTC) |
Message
| Well, I was just curious, because I'd never heard of gdb being specialized for Cygwin, and if it had been, that'd be pretty neat. I couldn't find it in the package list, so I wasn't sure what you were referring to.
That code is pretty neat. One thing you might want to check for is making sure the sheath/scabbard doesn't have something in it already. And if you want multiple things in the sheath, also test to see that things still work if I take a weapon, sheathe it, then take another, sheathe it, and so forth. And also make sure that things don't break if you draw when something is sheathed. And finally, if you have dual-wield, make sure that works as expected too. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Shawncplus
USA (21 posts) Bio
|
Date
| Reply #27 on Mon 16 Apr 2007 05:54 PM (UTC) Amended on Mon 16 Apr 2007 05:59 PM (UTC) by Shawncplus
|
Message
| Well the entire sheath/draw system was just to test my abilities so I probably won't do anything with dual wield unless I plan on making it a more advanced system. Then again Dual wield is taken from a different iWear so who knows :P.
I am definitely adding a check to see if there is already something in it. Thanks for all the help guys and I might release it if I don't feel lazy and actually get motivated enough to find all the tiny little changes that were required to do the things I wanted it to. |
Shawn B.
LazyCode.info
"I find myself in an industry that is identified by the frustration it causes it's customers." | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #28 on Mon 16 Apr 2007 05:58 PM (UTC) |
Message
| If you have a version of your code before these changes, the diff tool is an excellent and easy way to generate a comprehensive list of changes. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
Date
| Reply #29 on Tue 17 Apr 2007 02:04 AM (UTC) |
Message
| one thing you need to do is make sure they aren't already wielding something when drawing something from their sheath. as it is they will draw it out of the sheath regardless but not have them wield it, in fact i'm not too sure what will happen to the item, just that the player will get mixed messages that they dextrously pulled it or whatever and that they couldn't wield it. | 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.
70,181 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top