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
➜ How do ya add a new item type?
|
How do ya add a new item type?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Longbow
(102 posts) Bio
|
| Date
| Tue 09 Aug 2005 06:23 PM (UTC) |
| Message
| Ok, I've gone and done it this time. I know it's probably a very newbish question to ask, but hey, I'm a very newbish fellow. :) How do you add a new ITEM_TYPE? I grepped Item_Ring and put instances of the new type in each of the places where Item_Ring was, and then when that didn't work I grepped other types too. I've searched the forum's server FAQ and I've even taken the amazing step of actually visiting the SMAUG homepage FAQ, and still no go.
What I'd like is a list of all the places that a new item type should be inserted into the code. If anyone could please post one here I'd be very appriecative.
Thanks and Godbless,
Longbow | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #1 on Tue 09 Aug 2005 06:27 PM (UTC) |
| Message
| | Where have you inserted it so far and how is its "not-workingness" manifested? |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Longbow
(102 posts) Bio
|
| Date
| Reply #2 on Tue 09 Aug 2005 08:49 PM (UTC) |
| Message
| It's not working in the sense that I can't set an object to be that type. I put an entry under mud.h's itemtypes, in db.c, and in act_obj.c, which are the only places I know to put them. Is there somewhere else, or perhaps do I have to set the type ingame somehow?
Thanks and Godbless,
Longbow | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #3 on Tue 09 Aug 2005 09:03 PM (UTC) |
| Message
| | In build.c there is an array called o_types that corresponds one-to-one with your item types. You need to add a string entry there in the same relative position as your type is in the mud.h definitions. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Longbow
(102 posts) Bio
|
| Date
| Reply #4 on Tue 09 Aug 2005 09:31 PM (UTC) Amended on Tue 09 Aug 2005 09:43 PM (UTC) by Longbow
|
| Message
| Ok, I added the lines and it seems to recognize that they are to some sense existant, but when I try to assign the type to an object it says it works, but when you ostat it it says the type is unknown! What would cause this? Perhaps my otype lineup is not correct?
Godbless,
Longbow
| | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #5 on Tue 09 Aug 2005 09:37 PM (UTC) |
| Message
| | That is the most likely cause. Unfortunately I don't have the original SMAUG code on-hand to help you; I reworked that part of the code a fair while ago. I don't have the o_types array anymore, for instance. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Longbow
(102 posts) Bio
|
| Date
| Reply #6 on Tue 09 Aug 2005 09:44 PM (UTC) |
| Message
| | Hmm, that's not it. I also went and changed the MAX_ITEM_TYPE definition below the object types in mud.h to read my new type instead of ITEM_CHANCE. Still no go. Something else I need to change, and did I need to change that definition? | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #7 on Tue 09 Aug 2005 10:10 PM (UTC) |
| Message
| | You'll have to look at the code in do_ostat that picks up the item type. Look at what it's doing, and make sure that you've added fields wherever it's reading from. I can't help you much more since I don't have the code at hand. Consider it a very, very useful learning experience. :-) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Samryn
United Kingdom (60 posts) Bio
|
| Date
| Reply #8 on Mon 22 Aug 2005 01:32 PM (UTC) |
| Message
| I've just done the same thing, and tried to encounted EVERY problem you've had.
Heres some questions for you.
- When you declared you ITEM_<NAME> did you put a comma at the end? if you did, remove the last comma. (im sounding like a help desk now, lol) because you souldn't have one there.
- Did you mis-spell anything? easy mistake i do it all the time...
- on o_types did you add a comma after "chance" ? and did you remember to not put a comma on the new one?
- And when you type Ostat are you getting any logs? if so cant you add them on here, cheers.
Hope this helps,
Samryn
ps sorry about sounding like a help desk. |
Samryn Medri | | 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.
29,864 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top