On Sat, 13 Apr 1996, Ben Leibig wrote: > What exactly does half_chop do? > > What i am assuming is it takes a var and splits it into 2. What if i want to > split it into 5 > can i do a > half_chop(arg, arg1, i) > half_chop(i,arg2,i) > half_chop(i,arg3,i) > like that? You've got the right idea, and I think that will work, as long as you keep in mind that it chops at the spaces between words. For example, if you've got a command that lets players bonk up to five other players, you might have something like this: ACMD(do_bonk5) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char arg3[MAX_INPUT_LENGTH]; char arg4[MAX_INPUT_LENGTH]; char arg5[MAX_INPUT_LENGTH]; half_chop(argument, arg1, arg2); if(!*arg1) { send_to_char("Bonk who??\r\n", ch); return; } /* code to bonk victim #1 */ /* chop arg2 into 2 arguments, check arg2 for null string, etc */ /* repeat as necessary for all 5 */ Sam
This archive was generated by hypermail 2b30 : 12/18/00 PST