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!
|
In response to Lummox JR
|
|
This wont work either:
Entered(mob/M) |
In response to Koolguy900095
|
|
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 |
In response to Lummox JR
|
|
Im trying to make it so when you go over a planet u get the option to do things like Land and leave
|
In response to Koolguy900095
|
|
It works now! The coding im using is:
Entered(mob/M) |
In response to Koolguy900095
|
|
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 |
In response to Lummox JR
|
|
so do i add if(M = mob)
|
In response to Koolguy900095
|
|
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 |
In response to Volte
|
|
I still get a runtime error if an NPC goes above the planet
|
In response to Koolguy900095
|
|
Check if (M.client) is true. If it's true, then M is a player; if it's false, then M is an NPC.
|
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