Problem description: As what the title suggests, I need some help fully understanding the Topic() proc because I'm a bit lost. And I'm not talking about using it to link() people to url's, or using it to post
byond:// addresses. Honestly it looks like gibberish to me even after reading the 9th and 11th chapter of the DM guide and using F1 in DreamMaker to gain some guidance. I downloaded and used the HTML Shopkeeper snippet someone (I forgot his name, sorry) made but I'm just not getting it. Honestly I just need someone to break it down for me kindergarten style. What I need help with is using Topic() to connect words with procs. For example, SS13 using Topic() to allow players and admins to speak with each other. Their names are a hyperlink and when you click a player's name or an admin's privatemessage, a box pops up to message them.
Here's what I don't understand. What's the difference of use between this:
atom/Topic(href,href_list[])
and this?
client/Topic(href,href_list[])
Second, I just don't get the syntax used in this here:
html+="<td><a href=byond://?src=\ref[O];action=edit;var=[X]>"
I know I'm not showing the entire code (don't want to cause unnecessary clutter), but it's part of an Edit verb admins have for editing for(var/X) in atom/O on any atom present in the server. I just don't know how one goes about using the Topic() proc to allow a player to click a word and cause another proc to run from it. I don't understand the syntactical connection between them. I couldn't find anything that explain what each component of Topic() (and the arguments inside it) does and how they're used in laymen's terms.
Sorry for the long post.
href: the query string for the link, which is to say everything after ?
href_list: same as params2list(href)
hsrc: same as locate(href_list["src"])
By default, client/Topic() will look to see if there was a src parameter. If so, it will try to look up that object by the given reference (or tag). E.g., src=[0x100000c] would refer to a turf; that value is then used for the hsrc argument. If hsrc is found, then client/Topic() will call hsrc.Topic() with all this same information.
In most SS13 code I've seen, client/Topic() does some work on its own, but it will call ..() near the end to fall back on default behavior. That will pass the message along to hsrc.
client/Topic() is a verb, and atom/Topic() is a pseudo-verb, so these are usr-safe. In each, usr should refer to whoever clicked the link.