24 Sep, 2010, thaolen wrote in the 1st comment:
Votes: 0
I am working with the NM guide again and need to know what this error is telling me.
TypeError: Load obj failed - it needs a key and destination.

I figured
obj = load_obj(ch, "staff@examples", me, "torso, left arm, right arm")
would be correct on torso, left arm, right arm.


[LOG: Trigger test@examples terminated with an error:
obj = load_obj(ch, "staff@examples", me, "torso, left arm, right arm")
# when a character enters the arena, give them a sword
message(ch, None, obj, None, True, "to_char",
"You have been given $o. Prepare to fight!")


Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: Load obj failed - it needs a key and destination.
]
24 Sep, 2010, Rudha wrote in the 2nd comment:
Votes: 0
You are using incorrect parameters:

Quote
load_obj(…)
load_obj(prototype, where=None, equip_to='')

Generate a new object from the specified prototype. Add it to where.
Where can be a room, character, or container. If where is a character,
add the object to the character's inventory unless a comma-separated
list of bodypart name of positions is specified. Return the created object.


Maya/Rudha
25 Sep, 2010, thaolen wrote in the 3rd comment:
Votes: 0
Quote
quote Rudha:
You are using incorrect parameters:


So I need to make a prototype?
I'll get back to you on this.

I believe I read this too from the NM API
25 Sep, 2010, chrisd wrote in the 4th comment:
Votes: 0
Rudha said, "You are using incorrect parameters."
She did not say, "You need to make a prototype."

Quote
load_obj(…)
load_obj(prototype, where=None, equip_to='')

Generate a new object from the specified prototype. Add it to where.
Where can be a room, character, or container. If where is a character,
add the object to the character's inventory unless a comma-separated
list of bodypart name of positions is specified. Return the created object.


load_obj() takes three arguments. You passed it four arguments, and you passed them in the wrong order.
25 Sep, 2010, thaolen wrote in the 5th comment:
Votes: 0
I seem to do that a lot don't I chrisd: wrong order.

It worked thank you
obj = load_obj("staff@examples", me, " left arm")
# when a character enters the arena, give them a sword
message(ch, None, obj, None, True, "to_char",
"You have been given $o. Prepare to fight!")


I'm understading this a little more, I just can't figure why I spend all day on one function lol even with API.
25 Sep, 2010, Rudha wrote in the 6th comment:
Votes: 0
The first thing I do, when I get an error like that, is to look up the documentation to see if I'm using the right params; its a good habit, as that's the majority of easily-fixed programming errors.

Maya/Rudha
25 Sep, 2010, thaolen wrote in the 7th comment:
Votes: 0
Sometimes i don't know what the params mean even with documentation, things can be trial and error for me. I think that is why I take days to get things done.

At least I get it honest, so it takes longer for me to learn the language, go figure ;)

the documentation is API I mean
25 Sep, 2010, Rudha wrote in the 8th comment:
Votes: 0
Yes, but if you read the API, hopefully you can pick up that it has three params, and not four :)

Maya/Rudha
25 Sep, 2010, thaolen wrote in the 9th comment:
Votes: 0
Quote
Yes, but if you read the API, hopefully you can pick up that it has three params, and not four :)

Maya/Rudha

:biggrin:
Good point
0.0/9