mob
var
mob/shopkeeper/shopkeeper
client/Topic(href,href_list[])
var/item_type = href_list["type"]
if(item_type)
var/obj/i = new item_type()
if(usr.zenni >= i.cost)
usr << "Enjoy your new item!"
usr.zenni -= i.cost
i.Move(usr)
usr.shopkeeper:Shopkeeper2()
else
usr << "Sorry you dont have enough money!"
usr.shopkeeper:Shopkeeper2()
mob
shopkeeper
Shopkeeper2
name = "-NPC- Shopkeeper"
icon = 'New Human.dmi'
icon_state = "person"
var/html
verb
Buy()
set src in oview(1)
usr.shopkeeper = src
Shopkeeper2(usr)
proc
Shopkeeper2()
html = {"
<style>
body{background:#C0C0C0}
</style>
<b>Welcome to my shop!</b>
<p>Here we supply all of the needs for the modern player!</p>
<table border = "3" cellspacing = "1" cellpadding = "1">
<Caption>Items</Caption>
"}
for(var/obj/A in src.contents)
html += {"
<tr><td align = "center">[A.name]</td>
<td align = "center">Price : $[A.cost]</td>
<td align = "center"><a href='?src=\ref[usr];type=[A.type];action=buy'>Get</a></td>
</tr>
"}
usr << browse(html)
New()
src.contents += list(new /obj/items/Sword,new /obj/items/Gi,new /obj/items/Glasses)
Problem description:
This is what I'm using as a shopkeeper code.
BUT, when I run the game, I get frozen at the Login Screen.
(I'm using Deadrons Character Handling)
Any way I could modify this to go around that problem?
I tried turning
client/Topic(href,href_list[])
client/h/Topic(href,href_list[])
but when I run the game I can access the Shopkeeper, but I cannot buy anything. Suggestions?
Try that. You were overwriting client/Topic(). To prevent that, use ..() or .=..() . I'm not exactly sure what the difference is between the two, but one is longer. Use it at the beggining of client/Topic(), or in an else statement at the end. By the way, use it in both client/Topic() procs you have, or better yet, combine them. If you are using a link, set a reference to the src, hopefully it a mob proc? Then just use mpb/Topic() to access the link. If I were use, I'd only use client/Topic() for forms.