ID:180722
 
How would i make a verb so you could put somthing inside a bag?
Thanx shane
On 3/7/01 9:56 pm Shane wrote:
How would i make a verb so you could put somthing inside a bag?
Thanx shane

ALso while yer at it, can you, and how can you, make the container have a verb to look what it's containing and do something with the contents to simulate putting together certain things in say a sewing kit and hitting a verb called sew to combine them into another article? Don't need all the code, just the verb and how to search what is in itself, if that's all possible?
In response to karver
On 3/7/01 10:09 pm Karver wrote:
On 3/7/01 9:56 pm Shane wrote:
How would i make a verb so you could put somthing inside a bag?
Thanx shane

ALso while yer at it, can you, and how can you, make the container have a verb to look what it's containing and do something with the contents to simulate putting together certain things in say a sewing kit and hitting a verb called sew to combine them into another article? Don't need all the code, just the verb and how to search what is in itself, if that's all possible?

Remember, that you can always move something into an object by setting an items loc to the object. For example,

obj/verb/get()
set src in oview(1)
src.loc = usr //move into usr

The same logic applies to putting things into a bag.

obj/verb/put_in_bag(obj/bag in usr)
set src in usr
src.loc = bag //move into bag

And looking at an item's contents is a cinch; recall that to look at a user's inventory, you use:

mob/verb/inventory()
for(var/obj/O in usr)
usr << "\an [O]"

So likewise the same logic applies to looking in objects:

obj/bag/verb/look_in()
set src in usr
for(var/obj/O in src)
usr << "\an [O]"

To check to see if you have the required materials to create another object, you can try this. I actually like that idea... I'll make a specialised code that allows you to do that.

This can be improved to use actual object names rather than types (with some work and a bit more difficulty to an unseasoned DM Wizard), but this prototype should work:

obj/sewing_kit
verb/put_in(obj/O)
set src in usr
if(!istype(O,/obj/sewing))
usr << "You can't put that in [src]."
else
usr << "You put [O] in [src]."
O.loc = src
verb/sew(type in typesof(/obj/clothing)-/obj/clothing)
var/obj/clothing = new type
var/materials_to_use[0]
for(var/F in clothing.materials)
var/found = 0
for(var/obj/O in src)
if(istype(O,F) && !materials_to_use.Find(O))
found = 1
materials_to_use += O
if(!found)
usr << "You are missing a required material to make an item of that type."
del clothing
return
for(var/obj/doomed in materials)
del(doomed)
clothing.loc = usr
usr << "You make a new [clothing.name]."

obj/clothing
var/materials[0]

shirt/New()
..()
materials += /obj/sewing/cloth
materials += /obj/sewing/cloth
materials += /obj/sewing/thread
materials += /obj/sewing/elastic

pants/New()
..()
materials += /obj/sewing/......

obj/sewing
gender = "plural"
cloth
thread

I'll make a full-fledged version that allows you to put together "construction kits" easily, following a similar format but with a lot less code.

(After all, though The Great Zipping removed my ability to work on my other games, I did include the clause that I will continue working on my tutorials and libraries! So here I go. =)
In response to Spuzzum
I'll make a full-fledged version that allows you to put together "construction kits" easily, following a similar format but with a lot less code.

Okay, here you go:

[Garden of Eden Creation Kit]
In response to Spuzzum
Okay, here you go:

[Garden of Eden Creation Kit]

Its not the one in fallout, is it?
In response to sunzoner
On 3/8/01 4:10 am sunzoner wrote:
Okay, here you go:

[Garden of Eden Creation Kit]

Its not the one in fallout, is it?

No, it isn't. The name is similar, the acronym is similar, the ability to create something new from it is similar, but no, it's not quite the same. =)

What it does is provide a code base to make little kits where you can assemble materials inside them, and then construct objects from them.

So yes, if you wanted to make a GECK that could create a 60's suburb, then that's up to you. =)


Next on my list is the Mr. Handy combining library, which allows you to stick object A together with object B to create object C. Stick object C together with object D to create the superobject E. Etc. If you wanted to make a robot that could walk your dog, clean your house, and otherwise be really "handy", then again that's up to you. =)
In response to Spuzzum
You DA man Spuzz!
In response to karver
On 3/8/01 4:15 pm Karver wrote:
You DA man Spuzz!

This is what i am saying. (Sorry for the "Mad About You" quote but it works...)