Author Topic: A Problem With Verbs  (Read 1840 times)

Offline parham

  • Acquaintance
  • *
  • Posts: 30
    • View Profile
A Problem With Verbs
« on: September 03, 2008, 08:13:13 AM »
Hi again!
Well, I'm using the DS mudlib and I was trying to decipher some verb code, and I got to this part. Verb rules. Now, looking at, let's say, the CAST verb, I get:

SetRules("STR", "STR on OBJ", "STR on STR", "STR on STR of OBJ",
      "STR against STR");
    SetErrorMessage("Cast what spell? On whom?");
   
Now if I just type CAST, I get:
"Such a command exists, but no default syntax is known."
while I should be getting the message specified. Now, looking at the give verb:
SetRules("LIV WRD WRD", "WRD WRD to LIV", "OBS LIV", "LIV OBS", "OBS to LIV" );
    SetErrorMessage("Give what to whom?");

It all works when I type GIVE. I get the error message specified. Now, these two verbs have no difference when I look at them... is there something small that I'm missing?

Also, let's say I type: "give test to me". I get:
"There is no Test here."

Now if I type CAST TEST:
2008.09.03-08.09,57
*Bad argument 1 to call_other()
Expected: string or array or object Got: 0.
Object: /secure/save/creators/p/parham (/lib/magic.c) at line 86
'<fake>' at /secure/save/creators/p/parham (/<driver>) at line 0
'cmdAll' at /secure/save/creators/p/parham (/lib/command.c) at line 141
'do_cast_str' at /verbs/players/cast at line 59
'eventPrepareCast' at /secure/save/creators/p/parham (/lib/magic.c) at line 86
Trace written to /log/runtime

Why does this happen?

Thanks!

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: A Problem With Verbs
« Reply #1 on: September 03, 2008, 08:28:15 AM »
Quote
Now if I just type CAST, I get:
"Such a command exists, but no default syntax is known."
while I should be getting the message specified. Now, looking at the give verb:

There are two "cast" verbs, which is odd and is
probably causing your confusion. The reason you
are not getting the error message for the magical
cast is that your verb is "falling through" to the
non-magical (ie casting a fishing pole) cast verb...
and that verb lacks an error message. If you add:

Code: [Select]
    SetErrorMessage("Cast what?");
to the create() of /lib/verbs/rooms/cast.c and
update it, you will see the behavior change.


Quote
Now if I type CAST TEST:
...

Why does this happen?

Because a line in /lib/magic.c is missing a check
for validity, and "TEST" is not a valid spell. Try
changing

Code: [Select]
tmp = spell->eventParse(this_object(), args...);
to

Code: [Select]
if(spell) tmp = spell->eventParse(this_object(), args...);
-Crat