On Wed, 24 Jan 2001, Kaun Lazaro wrote: > don't pass down the argument beyond matching it with a target, so how do I > send a prompt to the character for an argument, ie: If I understand you correctly you want to be able to do something like: cast 'a spell' victim on a stick and then have "victim on a stick" be passed all the way into MANUAL_SPELL(). This is not impossible (I was about to say of course :), but it's not "just done" either ;-). I did this with help from Circlelist some years back ;-), this is a recipy on how to do it.. Warning, this is mostly done from memory (and a bit of code tracing) so you might want to double backup your code :). This is one way (And while looking at it, I found that it could be made more optimal): do_cast needs to be redefined: Around where you find the target it should currently look like this: --- SNIP --- /* find the target */ if (t != NULL) { one_argument(strcpy(arg, t), t); skip_spaces(&t); } --- SNIP --- it should look like: /* Find the target */ if (t != NULL) { if (!IS_SET(SINFO.targets, TAR_IGNORE)) { one_argument(strcpy(arg, t), t); skip_spaces(&t); } else { strcpy(arg,t); } } -- SNIP -- This way you pass the entire arg into the MANUAL_SPELL (once you're finished :) A bit later in the same function the code does: --- SNIP --- if (cast_spell(ch, tch, tobj, spellnum)) { --- SNIP --- Change that to: --- SNIP --- if (cast_spell(ch, tch, tobj, spellnum, t)) { --- SNIP --- So far so good, as you can see you also need to change cast_spell to fit the calling of it in do_cast it should look like (from stock circle that is) --SNIP-- int cast_spell(struct char_data * ch, struct char_data * tch, struct obj_data * tobj, int spellnum) --SNIP-- Change to --SNIP-- int cast_spell(struct char_data * ch, struct char_data * tch, struct obj_data * tobj, int spellnum, char * tar_str) --SNIP-- Woop, now cast_spell understands that as well. a bit later in cast_spell the function does a call_magic that looks like so --- SNIP --- return (call_magic(ch, tch, tobj, spellnum, GET_LEVEL(ch), CAST_SPELL)); --- SNIP --- Change it to: --- SNIP --- return (call_magic(ch, tch, tobj, spellnum, GET_LEVEL(ch), CAST_SPELL, tar_str)); --- SNIP --- Of course then call_magic needs to be redefined as well, it should look like so: --- SNIP--- int call_magic(struct char_data * caster, struct char_data * cvict, struct obj_data * ovict, int spellnum, int level, int casttype) --- SNIP --- Change to: --- SNIP --- int call_magic(struct char_data * caster, struct char_data * cvict, struct obj_data * ovict, int spellnum, int level, int casttype, char * tar_str); ---- SNIP --- Now you're close to have something working.. all you need to change is the definition of MANUAL_SPELL to include the tar_str as well.. It is located in spells.h and looks like: --- SNIP -- spells.h:#define MANUAL_SPELL(spellname) spellname(level, caster, cvict,ovict); --- SNIP --- Change it to: --- SNIP --- spells.h:#define MANUAL_SPELL(spellname) spellname(level, caster, cvict,ovict,tar_str); --- SNIP --- Hopla, that should be about it (I might have overlooked somethign somewhere).. and a manual spell could be (I take it you know where the different functions go): spello(SPELL_A_SPELL, "a spell", 30,15,3, POS_STANDIING, TAR_IGNORE, FALSE, MAG_MANUAL); MANUAL_SPELL(a_spell) { char lbuf[MAX_INPUT_LENGTH] = ""; snprintf(lbuf, sizeof(lbuf), "your complete args were:%s\r\n", tar_str); send_to_char(lbuf, ch); } That should be about it.. :) of course it could be improved by having a TAR_STR instead so that it will only copy arg into tar_str when that mode is set. /S There's no place like ~ -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/03/01 PST