var/picked = input("Which One?") in usr.mob_list //mob_list is a mob/var, that contains mobs.
picked.Move(usr.loc)
Thanks in advance.
-Rcet
ID:149727
![]() Feb 27 2002, 9:30 am
|
|
How would I move a mob with a var? Heres an example:
var/picked = input("Which One?") in usr.mob_list //mob_list is a mob/var, that contains mobs. Thanks in advance. -Rcet |
Rcet wrote:
I tried that, and when i use the verb, it says cannot execute null.Move. Any ideas? This means the value assigned by input() to picked is null, which means that, in this case, usr.mob_list is empty. You never saw a dialog box pop up asking you to choose from the list (I infer this from your description of the error) because there was never anything in it. Lummox JR |
I got that to work, but when I try to move the mob into the list, it gives me this error: runtime error: undefined proc or verb /list/Enter().
Can you help me out? :] -Rcet |
Rcet wrote:
I got that to work, but when I try to move the mob into the list, it gives me this error: runtime error: undefined proc or verb /list/Enter(). I'm gonna have to break down and flat-out say "Duh!" here. Move() is for changing an atom's loc var, if the right conditions are met; loc is always another atom, which is to say, a thing that can "physically" hold other things. It has nothing to do with any lists whatsoever (except atom.contents, but that really doesn't count). A list is not a place; it's an abstract concept--just like your top 10 favorite music groups don't actually live in a 10-slot parking lot in your head, and when you change the list you don't physically move anything around. Don't think of adding to a list in terms of "moving" things into it; actual moving is no more involved in the process than writing "eggs" on a grocery list would instantly transport them to your fridge. Nothing is being moved. No moving. This is adding to a list, not putting in a place. To add a mob to a list, you need to do this: the_list += a_mob Or, if you want to associate something with it: the_list[a_mob] = a_value Lummox JR |
This one's easy: Just declare picked as a mob:
var/mob/picked
If everything in the list is a mob, it will cast correctly, and you'll have no trouble.
Lummox JR