ID:179964
 
i have tried many things this evening to get my users to start with three item cards. here is the first thing i tried:

spawn(1) new/obj/cardA001 (locate(usr))

no errors, or warnings, the only problems was that is didn't do anything. So i tried this

spawn(1) new/obj/cardA001 (locate(usr.contents))

then

spawn(1) new/obj/cardA001 (locate(src.contents))

and those had no effect ither, so i said, well... i guess spawn isn't what i need. So i tried to do this

src.contents += /obj/cardA001

and that compiled fine, how ever had a proc crash saying:
cannot append to list
proc name: Login (/mob/Login)
usr: Nebathemonk (/mob)
src: Nebathemonk (/mob)
call stack:
Nebathemonk (/mob): Login()

there for i guess is am stumbed... don't know what do do now and there for I posted on the message board. To clear this up:

I want to give the player an item (cardA001) at login.

(and yes, i did put this under the login proc, i'm not stupid)
Nebathemonk wrote:
i have tried many things this evening to get my users to start with three item cards. here is the first thing i tried:

spawn(1) new/obj/cardA001 (locate(usr))

no errors, or warnings, the only problems was that is didn't do anything. So i tried this

spawn(1) new/obj/cardA001 (locate(usr.contents))

then

spawn(1) new/obj/cardA001 (locate(src.contents))

and those had no effect ither, so i said, well... i guess spawn isn't what i need. So i tried to do this

src.contents += /obj/cardA001

and that compiled fine, how ever had a proc crash saying:
cannot append to list
proc name: Login (/mob/Login)
usr: Nebathemonk (/mob)
src: Nebathemonk (/mob)
call stack:
Nebathemonk (/mob): Login()

there for i guess is am stumbed... don't know what do do now and there for I posted on the message board. To clear this up:

I want to give the player an item (cardA001) at login.

(and yes, i did put this under the login proc, i'm not stupid)


mob/Login()
world<<"[src] enters"
src.contents+=new/obj/cardA001
..()
In response to Nadrew
well stick a bannana in my pants, snake in my pipe, bite my ear off and call me bertha the great beareded woman from mars! it worked, thanks.
spawn(1) new/obj/cardA001 (locate(usr))

Close. Very close.

spawn(1) new/obj/cardA001 (locate(usr.contents))
spawn(1) new/obj/cardA001 (locate(src.contents))

You were doing better to start with. Locate won't find usr.contents, because contents is just a list, and not an object type for locate to find.

What you want is:
spawn(1) new/obj/cardA001(src)

First, usr is okay to use in Login(), typically (unless you have verbs and such that force calls to Login, in which case Login will become very broken). But its best to get in the habit of using src instead of usr. The only times you should use usr are inside verbs.
Second, locate(usr) attempts to find an object of type usr. Since usr is not a type, it will never find anything. It compiles fine, though, it will just silently fail each time. All you want to do is put it in the player, no locate()ing is necessary.

-AbyssDragon
In response to Nebathemonk
Nebathemonk wrote:
well stick a bannana in my pants, snake in my pipe, bite my ear off and call me bertha the great beareded woman from mars! it worked, thanks.


No problem Bertha,your beard is freaky.