Enter()
var/choice = input("TEST!","TEST!") in list("TEST", "TESTER", "TESTING")
if(choice == "TEST")
return
ID:175551
![]() Apr 8 2003, 8:38 am
|
|
For some reason my Enter() wont work...But if i turn it into a verb it works...Could you help me fix it? Here's my code and thanks in advance!
|
This wont work either:
Entered(mob/M) |
Koolguy900095 wrote:
This wont work either: Entered(mob/M) And small wonder, because you're still doing most of the same stuff wrong. You still haven't redirected input() to M instead of usr. M==client is interpreted as M==src.client, and I'm guessing src is a turf (you didn't show that part) which means it has no client. What you should have used instead is if(M.client). You also didn't check if M is a mob, which is rather important lest the M.client check fail at runtime. It would help to know what you're trying to do here. I suspect Entered() is no more right than Enter() for this task, and what you're really trying to do is respond to a bump. Lummox JR |
It works now! The coding im using is:
Entered(mob/M) |
Koolguy900095 wrote:
It works now! The coding im using is: Entered(mob/M) Before you call input() you still need to check that M is a mob, and that M.client is not null. Otherwise objs entering the location, or any non-player mobs, will trigger a runtime error. Lummox JR |
Koolguy900095 wrote:
so do i add if(M = mob) No. You could use the istype() procedure to check if the type is /mob.. if(istype(M,/mob))
Or you could just use the ismob() procedure. if(ismob(M))
~>Volte |
Well, there's all kinds of reasons this would be wrong. First, I imagine you really meant to use Entered() instead of Enter()--since Enter() is a query as to whether or not an atom can enter, not what happens once they do. If you really meant Enter() instead of Entered(), then somewhere in there it should call "return ..()" or some such.
Another problem is that you're calling input() here, which has usr as a default target, and you never changed the target. usr is not valid in Enter()--don't use it or rely on it. What you'd have to do instead would be to take the argument passed to Enter(), which is the atom trying to enter, and check to see first if it's a mob, second if it has a client; then and only then can you use that as a target for input().
Lummox JR