ID:264816
 
Code:
mob/Topic(href,href_list[])
var a = href_list["clan"]
var/html = {"
<table border=2 cellspacing=0 cellpadding=2 bordercolor="blue">
<head><title>Clan
[a]</title></head>
<body bgcolor=darkblue><center><table bgcolor=black border>
<tr><td colspan=100%><font color = white><center><b>
[a.leader]</td></tr>
"}

src << browse(html,"size=400x360,window=Updates")


Problem description: Works fine, but i get undefined var when i do a.leader. It's a Clan Datum System. The variables are:

clan/var
leader


That's because you're not type-casting the variable.

IE:
//YOURS
var/a

//SHOULD BE
var/clan/a //or what ever the path of your datum type is
In response to Teh Governator
runtime error: Cannot read "n".leader
proc name: Topic (/mob/Topic)
usr: Ocean King (/mob)
src: Ocean King (/mob)
call stack:
Ocean King (/mob): Topic("src=\[0x3000000];clan=n", /list (/list))
In response to Ocean King
You're setting the variable to, "n". You're passing the datum incorrectly in Topic().
In response to Teh Governator
Teh Governator wrote:
You're setting the variable to, "n". You're passing the datum incorrectly in Topic()..

To expand on that, you should be using the \ref macro to pass the reference string of the clan datum in the link. Then, you should retrieve that from the associative list and use locate() to get a reference to the actual object.
In response to Teh Governator
Passing the datum in a different manner isn't going to make it work, because you can't get an object out of a link, just a text string.

What's needed is to use the \ref macro to get the tag of the object, construct the link using that, and then use locate() in Topic() to find the actual object.
In response to Garthor
Actually, don't know if i'm correct. But, i did this:

mob/Topic(href,href_list[])
var/clan/string = clan
var/html = {"
<table border=2 cellspacing=0 cellpadding=2 bordercolor="blue">
<head><title>Clan
[string.name]</title></head>
<body bgcolor=darkblue><center><table bgcolor=black border>
<tr><td colspan=100%><font color = white><center><b>
[string.name]</td></tr>
<tr><td>Members:
[string.members.len]</tr></td>




"}

src << browse(html,"size=400x360,window=Updates")