ID:179454
 
Well, when you try to lock/unlock a door from an HQ that you are not a part of, it gives you a "link" to click and that "link" refers you to a proc. That part works. Its just that the proc doesn't. It keeps on telling me null.master. I can lock/unlock HQ doors and that works. It uses the master var, so I don't know whats wrong.
turf
HQ_Door
name = "Cheap HQ Door"
density = 1
var/master = ""
var/list/members[] = newlist()
//Lock/Unlock door stuff here
Click()
if(master == "")
var/buy = input("Do you wish to buy this HQ?It will send ya back $500!") in list("Yea!","Hell No!")
if(buy == "Yea!")
usr.money -= 500
master = "[usr.key]"
src.density = 0
else
usr << "HQ: We don't need your stinkin' businuss!"
*************
proc here
*************
proc
Join()
src.master << "[usr] wants to join your HQ"
var/buy = input("Do you want to let him join?") in list("Yes","No")
if(buy == "Yes")
src.master << "[usr] has join your HQ"
world << "\yellow[usr] has joined [src.master]'s HQ!"
members.Add(usr.key)
else
usr << "\yellow You have not been accepted."
src.master << "\yellow [usr] has not joined your HQ."

******
This is where I call the proc from
******

client/Topic(href)
if(href == "join")
/turf/CheapHQ/HQ_Door/proc/Join()
********
Yes, I know that gives me a warning, I couldn't figure out how to do it with a call(). It was kind of late and I was frustrated.

When you try to lock/unlock a door and you are not an HQ member, it gives you this message. And you can click join to use
*******

usr<<"Click <a href=?join>here</a> to join"


When somebody tries to join the HQ, I get this error:

runtime error: Cannot read null.master.
proc name: Join (/turf/CheapHQ/HQ_Door/proc/Join)



Thanks in advance.

-Sariat


Sariat wrote:
Well, when you try to lock/unlock a door from an HQ that you are not a part of, it gives you a "link" to click and that "link" refers you to a proc. That part works. Its just that the proc doesn't. It keeps on telling me null.master.

First, please add this to your code so that your error messages will show line numbers:

#define DEBUG


Second, this simply doesn't work:

>       /turf/CheapHQ/HQ_Door/proc/Join()


Nor would you use call() for this. In object oriented programming to call the proc for an object, you have to have a reference to that object. If you don't have the actual turf, then the game has no idea what object you are talking about.

You need to store the turf in some manner -- in a global, or get it by using locate() -- then call it like so:

door_turf.Join()