This proc just wont work.
Purpose: Keep unwanted visitors out (everyone except me).
mob/proc/zlegendshouse()
if(key==!"Zlegend2")
Enter(1)
usr << "Welcome home Zlegend!"
return 1
else
Enter(0)
usr << "Stay away."
return 0
turf/zlegendshouse
usr.zlegendshouse
The proc just flat out wont work.
ID:148538
![]() Jan 4 2003, 7:41 pm
|
|
usr.zlegendshouse() (correction)
you call the proc using usr. not src. it will come up as an undefined proc. |
Zlegend2 wrote:
usr.zlegendshouse() (correction) Wrong again. usr has no place in movement procs (except in rare cases). Enter() has an argument that's the atom trying to enter, and that's what you use instead. Lummox JR |
No, you dont use usr here. You use src. If it doesnt work its not my fault, but usr will mess you up if you use it to often becuase it doesnt work in all situations.
|
Jotdaniel wrote:
No, you dont use usr here. You use src. If it doesnt work its not my fault, but usr will mess you up if you use it to often becuase it doesnt work in all situations. src isn't correct either, because it's the turf. That's one reason why a lot of people mistakenly switch to usr instead. Among other problems in the original code, a couple of the lines that make zero sense are Enter(1) and Enter(0); those aren't valid calls to Enter(), which takes an atom/movable as an argument. Lummox JR |
Whoops. Sorry bout that then. I guess your right. I didnt think about what src called there, i just didnt think usr was correct either.
|
mob/proc
zlegendshouse() if(src.key!="Zlegend2") Enter(1) usr << "Welcome home Zlegend!" return 1 else Enter(0) usr << "Stay away." return 0 turf/zlegendshouse Enter() usr.zlegendshouse() ----------------------- No matter what my key is, it always says "Stay away." even on Zlegend2. |
Zlegend2 wrote:
No matter what my key is, it always says "Stay away." even on Zlegend2. Well, that doesn't really surprise me, because both procs are still screwed up. You're putting usr in Enter(), which is wrong, and you're using it in the zlegendshouse() proc, which is wrong. The only time usr is really safe to use in a proc, pretty much, is if that proc is exclusively called by verbs. Among those problems, you're also calling Enter() wrong; it's called during Move(), and with an argument corresponding to the atom that's moving (that is, your mob). Enter(1) and Enter(0) are invalid, because that's not supposed to be a number; it takes the mob (or an obj), and returns 1 if the atom can enter, 0 if it can't. You're also not returning any value in Enter() proper, so it's always returning null which is interpreted as 0, and you'll never get in no matter what. area/zlegendshouse Lummox JR |
i get it! thanx again. :P about four months trying to learn DM and i still havent quite got it. But i got a blue book and im studying it sometimes.
|
When you call the proc it should be like this:
as for the proc itself dont use ==! as this does absolutely nothing that i can tell. Just use == .