ID:150927
 
When I run this code, everything works fine unless I type something other than a mob name after sigh... 'sigh tree'. I get a message saying 'Invalid argument' or something. I understand why I get the message, I want to know if there is a way to override it to say something else... 'You start to sigh but choke on it' for example.



mob/verb/Sigh(M="" as mob in view())
if(M == "") oview() << ". . . [usr] sighs."
usr << ". . . You sigh."
else
if(M ==usr)
oview() << ". . . [usr] sighs at /himself."
usr << ". . . You sigh at yourself."
else
oview() << ". . . [usr] sighs at [M]"
usr << ". . . You sigh at [M]"

I could use a text variable in the verb, compare that to each mob in view()'s name and respond that way, just wondered if there is a way in general to override default responses.

I did spend the requisite 3 and a half minutes looking over the FAQ, guide, reference, tutorials and demos :) If I missed it, just smack me upside the head and I'll go look some more.
On 7/2/01 6:43 am Flick wrote:
When I run this code, everything works fine unless I type something other than a mob name after sigh... 'sigh tree'. I get a message saying 'Invalid argument' or something. I understand why I get the message, I want to know if there is a way to override it to say something else... 'You start to sigh but choke on it' for example.



mob/verb/Sigh(M="" as mob in view())
if(M == "") oview() << ". . . [usr] sighs."
usr << ". . . You sigh."
else
if(M ==usr)
oview() << ". . . [usr] sighs at /himself."
usr << ". . . You sigh at yourself."
else
oview() << ". . . [usr] sighs at [M]"
usr << ". . . You sigh at [M]"

I could use a text variable in the verb, compare that to each mob in view()'s name and respond that way, just wondered if there is a way in general to override default responses.

I did spend the requisite 3 and a half minutes looking over the FAQ, guide, reference, tutorials and demos :) If I missed it, just smack me upside the head and I'll go look some more.

(M="" as mob in view()) ... aren't you asking for a mob here? Seems like you define it to only accept a mob as input, then expect it to still work when it's not a mob. Try this:

(M="" as mob|obj in view())

That would allow you to sigh at objects as well.
In response to Skysaw

(M="" as mob in view()) ... aren't you asking for a mob here? Seems like you define it to only accept a mob as input, then expect it to still work when it's not a mob. Try this:

(M="" as mob|obj in view())

That would allow you to sigh at objects as well.

True, but thats not really what I want. I want to respond if for example, they misspell a name, or sigh at something that is described in text, but isnt important enough to be an object, or sigh alasdjk just to see what it does :)
In response to Flick
On 7/2/01 7:12 am Flick wrote:
(M="" as mob in view()) ... aren't you asking for a mob here? Seems like you define it to only accept a mob as input, then expect it to still work when it's not a mob. Try this:

(M="" as mob|obj in view())

That would allow you to sigh at objects as well.

True, but thats not really what I want. I want to respond if for example, they misspell a name, or sigh at something that is described in text, but isnt important enough to be an object, or sigh alasdjk just to see what it does :)

Hmm... does (M="" as mob|obj|text) do what you want?
In response to Skysaw
On 7/2/01 7:35 am Skysaw wrote:
On 7/2/01 7:12 am Flick wrote:
(M="" as mob in view()) ... aren't you asking for a mob here? Seems like you define it to only accept a mob as input, then expect it to still work when it's not a mob. Try this:

(M="" as mob|obj in view())

That would allow you to sigh at objects as well.

True, but thats not really what I want. I want to respond if for example, they misspell a name, or sigh at something that is described in text, but isnt important enough to be an object, or sigh alasdjk just to see what it does :)

Hmm... does (M="" as mob|obj|text) do what you want?

Nope.. I get:
Invalid or incomplete argument: alskjd
usage: Sigh ["text"mob|obj]

In response to Flick
On 7/2/01 7:38 am Flick wrote:
On 7/2/01 7:35 am Skysaw wrote:
On 7/2/01 7:12 am Flick wrote:
(M="" as mob in view()) ... aren't you asking for a mob here? Seems like you define it to only accept a mob as input, then expect it to still work when it's not a mob. Try this:

(M="" as mob|obj in view())

That would allow you to sigh at objects as well.

True, but thats not really what I want. I want to respond if for example, they misspell a name, or sigh at something that is described in text, but isnt important enough to be an object, or sigh alasdjk just to see what it does :)

Hmm... does (M="" as mob|obj|text) do what you want?

Nope.. I get:
Invalid or incomplete argument: alskjd
usage: Sigh ["text"mob|obj]

The problem is that text is, by definition, surrounded by " and since you're allowing other input types, DS isn't putting the " in for you. Don't do mob|obj|text, just do text... then make it loop through everything in view and check names against it.
In response to LexyBitch
The problem is that text is, by definition, surrounded by " and since you're allowing other input types, DS isn't putting the " in for you. Don't do mob|obj|text, just do text... then make it loop through everything in view and check names against it.

Yeah, I was trying to avoid that. It seems that if there were a fair number of people around, checking through each of them for names every time someone emotes something would be really wastefull. It would be real nice to just override the default verb error for invalid argument types. Actually, I'd like to override a lot of the errors... 'Unrecognized or inaccessible verb: <verb>' sort of kills the mood in a roleplaying environment.


Sigh

Invalid or incomplete argument:
usage: Sigh [dammit]

In response to Flick
On 7/2/01 7:53 am Flick wrote:

Invalid or incomplete argument:
usage: Sigh [dammit]

Sorry!

This is very good request, one that has been made in the past, I believe. I think that simply accepting the quoteless text in 'as mob|obj|text' would be a reasonable notation, so it's just a matter of getting it to work.