Showing Clan Lists in Developer Help
|
|
Code:
mob/verb/View_Clans() set name = "View Clans" set category = "Commands" var/html = {" <table border=2 cellspacing=0 cellpadding=2 bordercolor="blue"> <head><title>Credits</title></head> <body bgcolor=darkblue><center><table bgcolor=black border> <tr><td colspan=100%><font color = white><center><b>Clan List (The Clans Going to Show By Creation Date)<br>Clan Count:</td></tr> <tr><td><font color = white><b>Clan Name<th><font color = white>Members<th><font color = white>Leader</th></td></tr>"}
for(var/clan/c in clans) html+={"<tr><td><b><font color = white><a href=?Action=ClanInformation&src=\ref[src]>[c.name]</a><th><font color = white>[c.members.len]<th><font color = white>[c.owner]</th></td></tr>"}
src << browse(html,"size=400x360,window=Updates")
client/Topic(href,list[]) switch(list["Action"]) if("ClanInformation") var/html = {" <table border=2 cellspacing=0 cellpadding=2 bordercolor="blue"> <head><title>Credits</title></head>"}
for(var/clan/c) html+={"<body bgcolor=darkblue><center><table bgcolor=black border> <tr><td colspan=100%><font color = white><center><b><br>Members: [c.members]</td></tr>"}
src << browse(html,"size=400x360,window=Updates")
|
Problem description:It shows /list where it need to show a player and it shows every single clan when someone clicks on one
|
You need to pass on the clan reference along with the mob reference so client.Topic() knows which clan to read.
Once you do that, instead of doing for(var/clan/c) which is shortcut for for(var/clan/c in world) you can just use do something like var/clan/c = locate(clanreference).
For your last problem about members outputting /list that's because you're not looping through the list. You need to do something like: <pre>for(var/mob/M in members) html += ...html...M.name....html
</pre> So that for each iteration it'll add to the html text file and skip a line.