ID:164114
 
Well this isn't really a "code problem" so I put this here. I'm trying to set up my htmls for when you talk to people and it's not working how I want it to. I was told you cant use src and things where I am defining it because the mob isn't created yet.

var/quest1html = {"
<b><u>Master Jin</u></b>: "Hello, if you aren't busy, could you help me with something?"
<br><br><br><center><a href='?src=\ref
[src];action=quest1_2'>\[Yes\]</a> <a href='?src=\ref[src];action=close_popup'>\[No\]</a></center>
"}


Error: src:undefined var

How can I make this work the way I want it to without putting it like:

            verb
Talk()
set src in oview(1)
usr << browse({"
<b><u>Master Jin</u></b>: "Hello, if you aren't busy, could you help me with something?"
<br><br><br><center><a href='?src=\ref
[usr];action=quest1_2'>\[Yes\]</a> <a href='?src=\ref[usr];action=close_popup'>\[No\]</a></center>
"}
,"window=popup;display=1;clear=0; size=300x300;border=0;titlebar=0")


Because when you click the links it's going to open different browses and the 2nd method wouldn't work for me.
You would probably have to do
mob/var/quest1html
and set the /ref[src] at runtime.

mob/Login()
..()
src.quest1html = {"
<b><u>Master Jin</u></b>: "Hello, if you aren't busy, could you help me with something?"
<br><br><br><center><a href='?src=\ref
[src];action=quest1_2'>\[Yes\]</a> <a href='?src=\ref[src];action=close_popup'>\[No\]</a></center>
"}


The question really is why you want to store it that way. Do you want to organize all of your HTML into one area? If so, I would suggest using a form datum to handle this stuff for you. That way, you won't have to worry about sending the ref, since Topic() would be handled by the form, and the ref would be the form. At that point, when you want to handle stuff like browser links, you can store the owner of the form (to whoever it is being displayed to) in a variable, and do whatever you want with that.

Here's a fairly simplistic example you can work off of.
form
var/mob/target
New(mob/t)
target = t
DisplayForm()

Del()
CloseForm()
..()

Topic(href, href_list)
..()
if(href_list["action"] == "close")
del(src)
// ...

proc
DisplayForm()
// implementation to be written in child objects
CloseForm()
target << browse(null, "window=\ref[src]")

quest1
Topic(href, href_list)
..()
if(href_list["action"] == "quest1_2")
// ...
DisplayForm()
var/quest1html = {"
<b><u>Master Jin</u></b>: "Hello, if you aren't busy, could you help me with something?"
<br><br><br><center><a href='?src=\ref
[src];action=quest1_2'>\[Yes\]</a> <a href='?src=\ref[src];action=close_popup'>\[No\]</a></center>
"}

target << browse(quest1html, "window=\ref[src];etc")


And to display the form to the user, you can create the form object and send the user you want the form to be sent through the parameter.

new /form/quest1 (target)