ID:140904
 
Code:
obj
proc
equip()
Get()
set src in oview(1,usr)
set category = null
if(src.item == Equipment)
usr.contents2 +=new src.type
usr << "You picked up [src]."
del src
if(src.item == Inventory)
src.loc = usr
usr << "You picked up [src]."
verb
Drop()
set src in usr
src.Move(usr.loc)
usr << "You dropped [src]"
DblClick()
if(src in usr.contents)
src.equip()
if(src in oview(1,usr))
Get()


Problem description:
I have divided my items into 2 inventories
the drop verb works for the normal inventory but not for the equipment inventory.. because it isnt the normal usr contents it is a list.. my question is how do i drop an item out of the equipment inventory?
I think so you should put this code in Drop change your script for this
obj
    proc
        equip()
        Get()
            set src in oview(1,usr)
            set category = null
            if(src.item == Equipment)
                usr.contents2 +=new src.type
                usr << "You picked up [src]."
                del src
            if(src.item == Inventory)
                src.loc = usr
                usr << "You picked up [src]."
    verb
        Drop()
            src.loc = locate(usr.x,usr.y-1,usr.z)
            usr << "You dropped [src]"
    DblClick()
        if(src in usr.contents)
            src.equip()
        if(src in oview(1,usr))
            Get()

*Edited*

Note by moderator:
Please avoid the use of offensive language.
This forum is supposed to be suitable for children.
Thank you in advance.
In response to Karffebon
I don't think it works like that.

When you set an objects location to an obj/mob it is added to its contents.


AFAIK You can't set somethings location to a list. Contents is just unique and allows that.
In response to AJX
i noticed that, i did one day a contents2 thing i just dont remember how i droped the itens
In response to Karffebon
Ummm elaborate on that a little... just saying bull crap doesnt make much since o.0
In response to AJX
Ahh but yes i did set it to a list and it shows up and it can be equipped if i want it to, so there must be a way to take its name from the list and set it to a var so that it can be then dropped on the ground

Such as there being a sword in the list u right click that sword and say drop and the sword is then deleted after it's name is saved to a certain var then u take that name find it in your objects and create a new one on the ground at your location....

In response to Xeronin
Xeronin wrote:
Ahh but yes i did set it to a list and it shows up and it can be equipped if i want it to, so there must be a way to take its name from the list and set it to a var so that it can be then dropped on the ground

Such as there being a sword in the list u right click that sword and say drop and the sword is then deleted after it's name is saved to a certain var then u take that name find it in your objects and create a new one on the ground at your location....


You can move things out of your inventory, and you can store them anywhere you want while keeping them in that list. You could jsut set their loc to 0 after adding them to your list... :S
In response to AJX
I don't understand what you mean by setting there location to 0? could you show me this in code 0.0
In response to Xeronin
In response to Xeronin
loc=0


0 is the same as null.
If you set something's location to null it is moved to 0,0,0, which is basically a black abyss. If a player is put there they have a black screen and can't move. If you put an item there without adding it to a list first (like your inventory list) then it will probably be cleared up by the garbage collector.
In response to AJX
so then why whould i set the location to null? i don't want the item to just be gone.. i need to get it out of the list so that i can drop it on the ground 0.0 i mean if i was in a game and could only drop half my items i wouldnt want to play it o.0
obj
proc
equip()
Get()
set src in oview(1,usr)
set category = null
if(src.item == Equipment)
usr.contents2 +=new src.type
del src
else
src.loc = usr
usr << "You picked up [src]."
verb
Drop()
set src in usr
if(src.item == Equipment)
src.loc=usr.loc
usr.contents2-=src
else
src.Move(usr.loc)
usr << "You dropped [src]"
DblClick()
if(src in usr.contents)
src.equip()
if(src in oview(1,usr))
Get()


I have no means of testing right now, but that should do it.
In response to Andre-g1
No sry it didn't , heres another thing to add to this... when i go to the equipment inventory your suppose to be able to right click the object for a list of verbs but u cant... maybe that will help?
In response to Xeronin
The obj should be in your mob's contents in order for you to see the Drop verb. (src setting)
In response to Jemai1
yeah but u see if there already is 1 contents then that means there is a way to make a second contents ... and i mean the inventory works the items go to it i can equip it and put a suffix and overlay and all that good stuff just can't drop the damn thing and its so frustrating ><
In response to Xeronin
Use the same src settings.

Have 2 lists for players, 'inventory' and 'equipment' or any variable names you like.

For the Get() verb, change the obj's loc to usr then add it to usr's inventory or equipment list according to its type.

For the Drop() verb, move the obj to usr.loc then remove it from usr's inventory or equipment list according to its type.

EDIT: Oh, you should change one more thing.. You should display the contents of the inventory and equipment lists in your statpanel.
A verb with "set src in usr" will not show up if it's not in usr. If you want something's verbs with the "in usr" setting to show up without them being in your contents... you can't do that.

More likely you just want your contents filtered on the display, in which case you'd do that where you display them, not elsewhere:

mob
var/list/items = list()
var/list/equipment = list()
Entered(obj/O)
if(isitem(O))
items += O
if(isequipment(O))
equipment += O

Stat()
statpanel("inventory")
stat("items")
stat(items)
stat("equipment")
stat(equipment)
In response to Jemai1
alright i'm not quite sure im getting it...

can u show an example in code, i'm better at reading code than some saying it in english o.0.
In response to Garthor
would i be able to seperate it into 2 different statpanels?
Page: 1 2