ID:149727
 
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.
picked.Move(usr.loc)


Thanks in advance.

-Rcet
Rcet wrote:
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.
picked.Move(usr.loc)


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
In response to Lummox JR
*smacks himself* Of course! I feel like an idiot.. thanks :]

-Rcet
In response to Rcet
I tried that, and when i use the verb, it says cannot execute null.Move. Any ideas?

-Rcet
In response to 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
In response to Lummox JR
Thanks, i got that, but, now it gives me a type mismatch error.

This is annoying :P

-Rcet
In response to Rcet
Are you actually putting mobs into the list? :oP
In response to Foomer
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
In response to 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
In response to Lummox JR
I figured that out a while ago. I was about to edit my post. I feel like an idiot..well.. I always do, so thats no change :]

-Rcet