ID:170213
 
I go to the shop keeper. Click him, adds a menu to the screen and it calls a proc so i can choose what to buy. Now what I need is a way to know who's the shopkeeper because once it switches to a proc it does not know who the shop keeper is only the player.

mob/var/mob/shopkeeper
mob/NPC/Shopkeeper
text = "<font color=#66CD00>@</font>"
density = 1
var/TagSave = 1
var/list/inventory = list(new/obj/Stick)
Click()
if(src in oview(4))
usr.shopkeeper = src
usr.client.screen += new/obj/SHUD/BG1

mob/proc/Buy(mob/shopkeeper/M)
var/choice = input("What do you want to buy?") as null|obj in M.inventory // Line 35
if(choice == null)
return
if(src.gold >= choice:price)
src.contents += choice
M.inventory -= choice // Line 40
src.gold -= choice:price
else
alert("You don't have enough gold")

obj/SHUD/BG1
text = "<font bgcolor=#A52A2A>B</font>"
layer=MOB_LAYER+11
screen_loc="5,8"
Click()
usr.Buy(usr.shopkeeper)


I tried that but i get this:

Test.dm:35:error:M.inventory:undefined type: M.inventory
Test.dm:40:error:M.inventory:undefined type: M.inventory


~>Jiskuha
Save it in a variable...that should work.
Try creating the Stick in New() and then adding it to the list rather than creating the stick in the list it self.
In response to N1ghtW1ng
Both of your replies did not help me. Sorry =(
Anyone else ?

~>Jiskuha
In response to Jiskuha
Jiskuha wrote:
Both of your replies did not help me. Sorry =(
Anyone else ?

~>Jiskuha

I can help you.
Don't use the : operator incorrectly, in this case...
. > :
In response to Hell Ramen
Why is everyone helping me with everything else? I want help with what the problem is please.

~>Jiskuha
In response to Jiskuha
Jiskuha wrote:
Why is everyone helping me with everything else? I want help with what the problem is please.

~>Jiskuha

Those could lead to later bugs in the game, leading to a bug like this, except durring run time. :P