ID:176643
 
How would i make a verb so you can change the name of your pet?
mob/pet/verb/Name(N as text)
set src in oview()
name = N
<code>mob/player verb/name_pet(mob/pet/P,newname as text) P.name=newname</code>
I tried:
Name(mob/pets/Pig,newname as text)
set category = "Pet"
Pig.name=newname

And it gives me a list of Mobs to name not the pig. Please help and thanks in advance!
In response to Koolguy900095
You're defining a variable called Pig of the type mob/pets. If you want to select only pigs, add /P or whatever on the end, so you're making a variable called P of the type mob/pets/Pig.

Garthor's method is probably better, anyway... I'm not thinking straight today. :-)
In response to Crispy
this?:
Name(mob/pets/Pig/P,newname as text)
set category = "Pet"
P.name=newname

If so it still lists some mobs :(
In response to Koolguy900095
That's more or less what I meant, yes. If it lists multiple mobs, then (surprise!) you have more than one mob/pets/Pig in the game.

To restrict it to only the player's pets, rather than everyone elses, keep a running list called pets[] of all the player's pets (make the list belong to the player so it's unique to each person). Then amend the first line to only accept mobs in that list:

Name(mob/pets/Pig/P in src.pets,newname as text)

That might not work, I'm not sure... try it and see, I guess! :-)