[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Specific containers

Specific containers

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


Posted by Gadush   (92 posts)  [Biography] bio
Date Mon 09 Feb 2004 03:01 PM (UTC)
Message
I am interested in developing/implementing a new container type specific_container, that will only allow a certain object to be put into it. Does anyone think this is possible?
My first idea would be to use this for sheaths and scabbards, that would only hold specific weapons. Then I could implement a Draw and Sheathe command for taking the weapon out and automatically wielding it, or unwielding the weapon and automatically putting it into the sheath container, which is worn.
How hard is it to implement a new container type?
Any help/thoughts on this are appreciated.
Gadush
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #1 on Mon 09 Feb 2004 03:46 PM (UTC)
Message
I think the easiest thing to do would be to simply use existing container, but utilize the unused value fields. For example, you could put a check in do_put:
if (obj->value[3] > 0 && obj->value[3] != putobj->type)
send_to_char("That container cannot hold that type of item!", ch);
return;


Then in build.c, you could simple use "oset <obj> v3 <itemvalue>", or write something that would accept a word rather than a number. This could be done by copying "oset <obj> type <word>", but make it affect v3 instead of obj->type, since its stored as a number anyways.

This avoids a large headache with new container, because there is lots of code dealing with them that might be above a beginners head. Plus this method does not require more fields or object type, just a little bit more code.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Gadush   (92 posts)  [Biography] bio
Date Reply #2 on Mon 09 Feb 2004 04:21 PM (UTC)
Message
Thanks Greven, that is an excellent suggestion. Now I have a direction to go in. By the way, you may have noticed I am trying to work on smaller things, to help with learning, rather than my favorite idea of tactical movement. But someday, after I have learned more, I will revisit that idea, and thanks to folks like you, maybe I will actually make it work.
Gadush
[Go to top] 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.


10,531 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]