Here's the (so far) final copy. It solves all the problems and works how I want, it's quite different from both previous posts, a bit more simple but more advanced as well. Sometimes those if's, then's and else's start stacking up and messing with your head. Realistically it could be modified at the very end of the command to detect if the player has the object already, and print out that "they already have it and don't need to take it" if that's the case, and "I don't know what you're talking about" if not. I found this complete enough and hopefully it will give anyone interested some insight into the process that is creating a more realistic inventory for Quest games.
COMMAND CODE
command <take #@object[userid]#> if here <#object[userid]#> then {
set string <mainhand[userid]; $objectproperty(player%userid%; hands.mainhand)$>
set string <offhand[userid]; $objectproperty(player%userid%; hands.offhand)$>
if ( $objectproperty(player%userid%; hands.#mainhand[userid]#)$ = nothing ) then {
set string <take.obj[userid]; #object[userid]#>
set string <take.hand[userid]; #mainhand[userid]#>
set string <take.floc[userid]; $objectproperty(#take.obj[userid]#; loc)$>
set string <take.tloc[userid]; hands.#mainhand[userid]#>
doaction <#take.obj[userid]#; take>
}
else {
if ( $objectproperty(player%userid%; hands.#offhand[userid]#)$ = nothing ) then {
set string <take.obj[userid]; #object[userid]#>
set string <take.hand[userid]; #offhand[userid]#>
set string <take.floc[userid]; $objectproperty(#take.obj[userid]#; loc)$>
set string <take.tloc[userid]; hands.#offhand[userid]#>
doaction <#take.obj[userid]#; take>
}
else msg <Both of your hands are full.|n>
}
}
else msg <I could not find what you were referring to.|n>
OBJECT ACTION CODE
action <take> {
move <#take.obj[userid]#; player%userid%>
property <#take.obj[userid]#; loc=#take.tloc[userid]#>
property <player%userid%; #take.tloc[userid]#=#take.obj[userid]#>
property <player%userid%; hands.#take.hand[userid]#.display=$objectproperty(#take.obj[userid]#; display.long)$>
msg <You pick up $objectproperty(#take.obj[userid]#; display.long)$ with your #take.hand[userid]# hand.|n>
}
And for reference on how objects are setup to react with this code... an object type looks like this...
define type <pants>
type <clothing>
alias = pants
prefix = a pair of
displaytype = Clothing
article = it
gender = it
pocket
weight = 2
locations.wear = 1
locations.wear.1 = legs.clothing
end define
And to give you a general idea on the structure of the player object housing the inventory...
property <player%userid%; alias=$name(player%userid%)$> 'Default is player's name, but can be changed to support things like metamorphosis, shapechanging, disguises, etc.
property <player%userid%; name=$name(player%userid%)$> 'This value is the player's name, never should change, used to restore from ^this, this^ and...... this^.
property <player%userid%; head.accessory=nothing> 'This is the place for objects like fake beards, eye patches, glasses, etc.
property <player%userid%; head.armor=nothing> 'This property is for any armor type object upon the head, but can also reference armor worn that covers the head.
property <player%userid%; head.clothing=nothing> 'This is the place for objects like hats, caps, etc.
property <player%userid%; neck.accessory1=nothing> '- - - - - - - - - - - - - - - - - - - -
property <player%userid%; neck.accessory2=nothing> ' These are for necklaces, amulets, etc
property <player%userid%; neck.accessory3=nothing> '- - - - - - - - - - - - - - - - - - - -
property <player%userid%; neck.armor=nothing> ' This is for any neck armor(coif's and such), but can also reference armor worn that covers the neck.
property <player%userid%; neck.clothing=nothing> ' This is the place for objects like scarfs, torqs, etc.
property <player%userid%; shoulders.accessory=nothing> 'This is the place for objects like capes, cloaks, greatcloaks, etc.
property <player%userid%; shoulders.clothing=nothing> 'This is the place for objects like robes, shawls, etc.
property <player%userid%; shoulders.left=nothing> ' This is the place for objects worn slung over the shoulder like satchel, weapon harness, purse, etc.
property <player%userid%; shoulders.right=nothing> ' This is the place for objects worn slung over the shoulder like satchel, weapon harness, purse, etc.
property <player%userid%; arms.accessory=nothing> ' This is the place for objects like armband, etc.
property <player%userid%; arms.armor=nothing> ' This is for any arm armor(arm greaves), but can also reference armor worn that covers the arms.
property <player%userid%; arms.clothing=nothing> ' This is the place for clothes worn on the arm, I can't think of any right now though.
property <player%userid%; wrists.accessory1=nothing> ' This is the place for objects like bracelets, etc.
property <player%userid%; wrists.accessory2=nothing> ' This is the place for objects like bracelets, etc.
property <player%userid%; wrists.armor=nothing> ' This is for any wrist armor(gauntlets, bracers), but can also reference armor worn that covers the wrists.
property <player%userid%; wrists.clothing=nothing> ' This is the place for objects like gloves, etc.
property <player%userid%; hands.accessory1=nothing> '- - - - - - - - - - - - - - - - - - - - - - - -
property <player%userid%; hands.accessory2=nothing> ' This is the place for objects like rings,
property <player%userid%; hands.accessory3=nothing> '
property <player%userid%; hands.accessory4=nothing> ' bands, etc.
property <player%userid%; hands.accessory5=nothing> '
property <player%userid%; hands.accessory6=nothing> '
property <player%userid%; hands.accessory7=nothing> '
property <player%userid%; hands.accessory8=nothing> '
property <player%userid%; hands.accessory9=nothing> '
property <player%userid%; hands.accessory10=nothing>'- - - - - - - - - - - - - - - - - - - - - - - -
property <player%userid%; hands.armor=nothing> ' This is for any hand armor(none comes to mind), but can also reference armor worn that covers the hands.
property <player%userid%; hands.left=nothing> ' These are for holding objects in the left and right hands, it should only be altered by commands.
property <player%userid%; hands.left.display=nothing> 'This is for holding a full description of the item held in the left hand, 'TAKE' command should alter it.
property <player%userid%; hands.right=nothing> ' These are for holding objects in the left and right hands, it should only be altered by commands.
property <player%userid%; hands.right.display=nothing> 'This is for holding a full description of the item held in the right hand. 'TAKE' command should alter it.
property <player%userid%; hands.mainhand=right> 'This specifies the "main hand" which determines if the player is right or left handed. default here is right.
property <player%userid%; hands.offhand=left> ' This specifies the "off hand" which is the remaining of the two after "main hand" is set. default here is left.
property <player%userid%; torso.accessory=nothing> ' This is the place for objects like brooches, emblems, etc.
property <player%userid%; torso.armor=nothing> ' This is for any torso armor, but can also reference armor worn that covers the torso.
property <player%userid%; torso.clothing=nothing> ' This is the place for objects like shirts, tunics, dresses, etc.
property <player%userid%; waist.accessory1=nothing> '- - - - - - - - - - - - - - - - - - - - - - -
property <player%userid%; waist.accessory2=nothing> ' This is the place for objects like sacks,
property <player%userid%; waist.accessory3=nothing> '
property <player%userid%; waist.accessory4=nothing> ' pouches, etc.
property <player%userid%; waist.accessory5=nothing> '- - - - - - - - - - - - - - - - - - - - - - -
property <player%userid%; waist.armor=nothing> ' This is the place for any waist armor, but can also reference armor worn that covers the waist.
property <player%userid%; waist.clothing=nothing> ' This is the place for objects like belts, girdles, etc.
property <player%userid%; legs.accessory1=nothing> ' This is the place for objects like thigh pouch, thigh sheath, leg brace, etc.
property <player%userid%; legs.accessory2=nothing> ' This is the place for objects like thigh pouch, thigh sheath, leg brace, etc.
property <player%userid%; legs.armor=nothing> ' This is for any leg armor(leg greaves), but can also reference armor worn that covers the legs.
property <player%userid%; legs.clothing=nothing> ' This is the place for objects like pants, trousers, skirts, etc.
property <player%userid%; feet.accessory=nothing> ' This is the place for objects like toe rings, climbing spikes, socks, etc.
property <player%userid%; feet.armor=nothing> ' This is for any foot armor, but can also reference armor worn that covers the feet.
property <player%userid%; feet.clothing=nothing> ' This is the place for objects like shoes, boots, etc.