Re: [CODE] Tried and failed this function...

From: Sean Daley (
Date: 11/24/98

>Then I added ints like this. int dur = 0, eff = 0, targ = 0;
>dur += (strlen(arg2)-2);
>eff += (strlen(arg2)-1);
>targ += strlen(arg2);
>Then, I added some message, showing how much the dur, eff, and targ became
>when I casted the spell. I casted shield on myself with 000 (zero extra on
>duration, effect, and targets, thus making the spell "normal"), but it
>showed You shield yourself. Dur(1)  Eff(0)  Tar(3), which isn't right as
>it really should show You shield yourself. Dur(0)  Eff(0)  Tar(0).
>What could be wrong with the above strlen checks??

Well, I'll assume you store 000 in arg2 and I have one question, are
you sure Eff is 0 and not 2?

strlen(arg2) returns the length of arg2 which is 3 if it's 000,
so strlen(arg2)-2 = 1 (dur = 1)
strlen(arg2)-1    = 2 (eff = 2) (you say 0 which is kind of neat)
strlen(arg2)      = 3 (tar = 3)

So, to answer your question, I don't think anything is wrong
with the above strlen checks.  They're working just fine
(short of that eff = 2).  I don't think they're what
you want to use though.


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST