GetExitByLink ( object from room , object to room )

imamy
20 Jul 2013, 15:50
GetExitByLink ( object from room , object to room ) returns a string or null.

How do I use this? I get this error message: Error running script: Object reference not set to an instance of an object.

Sorry, had to edit... What I'm trying to do is check to see if I had created an exit so I wouldn't create the same exit later (with the same name. I'm assuming that too would generate an error). If I hadn't created an exit, is there something else I can use to check for this? At this point, I'm not sure how to handle the errors and I am trying to make it so my game generates exits randomly each time it starts.

Thanks.
Q GetExitByLink 1.png

jaynabonne
20 Jul 2013, 18:03
You can call GetObject to get the actual exit object.

s = GetExitByLink(Room111, Room311)

if (s = null) {
msg("There is no such exit")
} else {
exit = GetObject(s)
msg("exit " + exit.name + " from " + exit.parent + " to " + exit.to)
}


(I hope it's ok I just write in direct script. It should be translatable to the GUI. If it's not, ask and I'll help.)

imamy
21 Jul 2013, 01:43
I'll try this. Thanks :) I like the code. Any examples (especially short ones) will help.