I am trying to add a knock spell and am having problems
manipulating the argument.
I want the syntax of the spell to be as follows:
cast 'knock' east (or any of the other 5 dirs)
Thus I am trying to run tests on the argument which
is getting passed to the spell with a leading space.
For some reason, skip_spaces(&arg) is crashing and
also giving me a compile time warning.
Here is the spell:
65 ASPELL(spell_knock)
66 {
67 int x = 0, found = 0;
68
69
70 if (ch == NULL) {
71 log("SYSERR: spell_knock: NULL *ch passed to function.");
72 return;
73 }
74
75 if (IN_ROOM(ch) == NOWHERE) {
76 sprintf(buf, "SYSERR: spell_knock: %s casting spell in
non-existing room.", GET_NAME(ch));
77 log(buf);
78 return;
79 }
80
81
82 sprintf(buf, "arg=%s\r\n", arg);
83 send_to_char(buf, ch); // Here is prints out with a leading
space
84
85 for (x = 0; x < NUM_OF_DIRS; x++)
86 if (!strcmp(arg, dirs[x])) {
87 found = TRUE;
88 break;
89 }
90
91 if (!found) {
92 send_to_char("There is no such exit leading in that
direction.\r\n", ch);
93 return;
94 }
95
96
97 send_to_char("We found it!\r\n", ch);
98
99 }
I know this spell looks a little funny right now, I am just trying to do
the sanity
checks first, the rest is cake. How can I strip this leading space from
*arg?
Thanks in advance
Chuck
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST