ID:166024
 
But I want him to take up two spaces.

        NPC/Shopkeeper
verb
Purchase_From_Store()
set category = "Shop"
set src = view(4)
var/shop = {"
<html>
<head>
<title>General Shop</title>
<STYLE>
BODY {background:#000000;color:white;}
TABLE {background: black;color=white; size=1;}

.:link {text-decoration: none; color: silver;}
.:visited {text-decoration: none; color: silver;}
.:hover {text-decoration: underline; color: white;}

</STYLE>
</head>
<body bgcolor=black>
<center>
<u><b>Objects</b></u>
<table border=1>
<tr>
<td>
<a href=?Simple>Simple Athame</a>
</td>
<td>
25
</td>
</tr>
<tr>
<td>
<a href=?Paper>Paper</a>
</td>
<td>
1
</td>
</tr>
<tr>
<td>
<a href=?Candle>Candle</a>
</td>
<td>
5
</td>
</tr>
<tr>
<td>
<a href=?Book>Book</a>
</td>
<td>
15
</td>
</tr>
<tr>
<td>
<a href=?herb>Herbs</a>
</td>
<td>
1
</td>
</tr>
<tr>
<td>
<a href=?bottle>Empty Bottle</a>
</td>
<td>
5
</td>
</tr>
<tr>
<td>
<a href=?pot>Pot</a>
</td>
<td>
15
</td>
</tr>
</table>
</center>
</body>
<a href=?Close>Close</a></html>
"}
In this case, we do not need a code snippet >_>


If you want a multi-tiled object, you have to code it as such, there are many methods and I'll show you one of the most common ones:
mob/Death
icon='Death.dmi'
icon_state="bottom_half"

New()//Following will happen when the object is created.
var/atom/O=new
O.icon=icon('Death',"top_half")//sets the icon for O of what we want
O.pixel_y=32//moves the image up by one tile
overlays+=O //overlays the image
..()//allows creation of mob and so forth


The above example shows how to add a top half to a bottom half icon via overlays method... ofcourse since it is an overlay, chances are that it won't have a verb when right-clicked >_> But you can make an object of it placed one step ahead of the bottom half rather than overlaying it.

Remember, there's more than one way to skin a kitten and cook them in a soup.

BTW, do you know how to put icons on a map or was your main question how to put an icon on the map that's 2+ tiles wide?

- GhostAnime
In response to GhostAnime
I want my shop keeper that I made the code for to go on the map as a two tiled mob.
In response to Miran94
Than my code should work. When placing it, it'll show as a one-mob tiled object but when you run it, there will be two

Alternatively, you can do the following:

1) Code in each part, or

2) Instead of importing it into a .dmi, have the image as is.. what I mean is instead of splitting a two-tiled mob from .PNG into .DMI, keep it as .PNG

mob/Death
icon='Death.png'


If the Death.png file was two tiles big, than the icon will be like that. Likewise, if the file was ~4x3 tiles big, it'll be shown like that, even when mapping.

- GhostAnime

Remember, these are the accepted file formats: .DMI, .PNG and .BMP (which is worse than .PNG in space consumption - .PNG all the way!)
Two things:

  • Don't bump your post until 24 hours have passed and it no longer appears on the main page of the forum where you posted it.
  • That long bit of HTML should probably be broken up. You need your shops to be more streamlined, so you can simply have a list of items available and their prices. For example:
var/list/shopitems = list(\
"Simple Athame", /obj/item/weapon/athame, 25,
"Paper", /obj/item/paper, 1,
"Candle", /obj/item/candle, 5,
...)


Then to use that list:

var/shop = GenerateHTMLHeader(title="General Shop")
shop += "<center>\n<h1>Objects</h1>\n<table border=1>\n"
shop += "<tr><th>Item</th><th>Price</th></tr>\n"
for(var/i=1, i<=shopitems.len, i+=3)
shop += "<tr><td><a href=\"byond://?src=\ref[src];item=[url_encode(shopitems[i])]\">[shopitems[i]]</td>"
shop += "<td>[shopitems[i+2]]</td></tr>\n"
shop+="</table>\n</center>\n" + GenerateHTMLFooter()


When an item is selected, use Find() to locate the item in the list.
var/which = shopitems.Find(selection)
if(!which || which%3!=1) // not a valid item
return
var/price = shopitems[which+2]
if(buyer.gold < price) return
buyer.gold -= price
var/newitem = shopitems[which+1]
new newitem(buyer)
buyer << "Thank you for your purchase."

Lummox JR
In response to Lummox JR
thanks but I just wana know how to use my code not a new one with a mob on the map.