Ive got this code and it moves the shopkeeper not the item to the inventory how would i move the item to the inventory?
mob/shopkeeper/Click()
switch(input("Item","What do you want?") in list("Scouter","Nothing"))
if("Scouter")
if("Nothing")
return 0
usr<<"Cya come again!"
ID:180001
![]() Sep 21 2001, 12:47 pm
|
|
Skysaw wrote:
Valderalgx wrote: oops here is the code mob/shopkeeper/Click() switch(input("Item","What do you want?") in list (Scouter","Nothing")) if("Scouter")src.Move(usr) if("Nothing") return 0 usr<<"Cya come again!" There |
Valderalgx wrote:
Skysaw wrote: src.Move(usr) moves the source to the user, none of those has to do with any kind of object.I suggest you read up on some basics first. (FAQ, Guide, Reference, Look at some demos, tutorials, and Libraries) Alathon |
Valderalgx wrote:
mob/shopkeeper/Click() The reason the shopkeeper is the one that's moving is because the shopkeeper is src. What you probably want to do is create a new object for "Scouter", and then move that into usr. Lummox JR |
Alathon wrote:
Valderalgx wrote: ok, now why wont this work? mob/shopkeeper/Click() switch(input("Item","What do you want?") in list("Scouter","Nothing")) if("Scouter")/obj/scouter.loc=locate(usr) if("Nothing") return 0 usr<<"Cya come again!" obj/scouter |
Valderalgx wrote:
Alathon wrote: Read up on the "new" proc in the reference. Here's a handy-dandy link for you: http://www.byond.com/docs/ref/info.html#/proc/new |
Skysaw wrote:
Valderalgx wrote: ok so now i have mob/shopkeeper/Click() switch(input("Item","What do you want?") in list("Scouter","Nothing")) if("Scouter")var/obj/scouter = new(src) if("Nothing") usr<<"Cya come again!" return 0 obj/scouter and it gives me this:Shop2.dm:9:scouter :warning: variable defined but not used |
Skysaw wrote: Valderalgx wrote: ok so now i have mob/shopkeeper/Click() switch(input("Item","What do you want?") in list("Scouter","Nothing")) if("Scouter")var/obj/scouter = new(src) if("Nothing") usr<<"Cya come again!" return 0 obj/scouter and it gives me this:Shop2.dm:9:scouter :warning: variable defined but not used How would i make scouter locates in the usr's inventory if they hit scouter? |
Nadrew wrote:
Try something along the lines of this: OHHHH! I got VERY close, but i guess precision matters. Thanks! |
doesn't look like it moves anything anywhere.
where's the move statement?