[newbie] [dg scripts] foolish errors and some notes

From: Mathew Earle Reuther (graymere@zipcon.net)
Date: 06/26/02


Been working on integrating the latest CVS version, Oasis 2.0.1, and DG
Scripts.  I started with an almost completely happy CVS snapshot+OLC.
Quick note on the error I began with before I continue:

medit.c has an array subtype char, relevant code below:

          "%sQ%s) Quit\r\n"
          "Enter choice : ",

          grn, nrm, yel, position_types[(int)GET_POS(mob)],
          grn, nrm, yel, position_types[(int)GET_DEFAULT_POS(mob)],
here-->   grn, nrm, yel, attack_hit_text[GET_ATTACK(mob)].singular,
          grn, nrm, cyn, buf1,
          grn, nrm, cyn, buf2,
#if CONFIG_OASIS_MPROG
          grn, nrm, cyn, (OLC_MPROGL(d) ? "Set." : "Not Set."),
#endif

Any concise explanations/thoughts/demands that I read a c manual
appreciated.

Now, on to the DG Scripts issues.

First off, SEND_TO_Q was liberally used, so anyone melding current circle
with the most recent DG should watch all such things . . . as well as
send_to_char (since it's been reversed since DG was last updated).  I
*think* I managed to get it to function using write_to_output and such, of
course I cannot boot and test yet. :)

George removed get_obj from the most recent CVS, and DG actually uses it.
I tossed the prototype back in handler.h as a kludge.  Relevant DG code
follows if anyone feels like taking a stab at why it calls it:

This is from sub_write in dg_comm.c

        case '`':
            /* get obj_data, move to next token */
            type[i] = *p;
            *s = '\0';
            p = any_one_name(++p, name);
            (obj_data *)otokens[i] =
                find_invis ? (obj = get_obj(name)) :
                    ((obj = get_obj_in_list_vis(ch, name, NULL,
                                world[IN_ROOM(ch)].contents)) ? obj :
                     (obj = get_obj_in_equip_vis(ch, name,
                                                    &tmp, ch->equipment ))
?
                     obj :
                     (obj = get_obj_in_list_vis(ch, name, NULL,
ch->carrying)));
            (obj_data *)otokens[i] = obj;
            tokens[++i] = ++s;
            break;

*shrug* I cannot follow what it's attempting here at all.  (And yes, there
is plenty of code I can follow!  I know it doesn't SEEM like it!)  Anyone
with an idea of why it would be using a non-existant function, please let
me in on the secret?

Now, for my big "showstopper" right now.  Posting this before bed,
hopefully when I wake up someone will have made some sense to me.

dg_db_scripts.c: In function `parse_trigger':
dg_db_scripts.c:55: `buf2' undeclared (first use in this function)

relevant code:

void parse_trigger(FILE *trig_f, int nr)
{
    int t[2], k, attach_type;
    char line[256], *cmds, *s, flags[256];
    struct cmdlist_element *cle;
    index_data *index;
    trig_data *trig;

    CREATE(trig, trig_data, 1);
    CREATE(index, index_data, 1);

    index->vnum = nr;
    index->number = 0;
    index->func = NULL;
    index->proto = trig;

->  sprintf(buf2, "trig vnum %d", nr);

    trig->nr = top_of_trigt;
    trig->name = fread_string(trig_f, buf2);

I've been over the other files which use sprintf (oh so many) and can't
find a difference between the way this function is using it and the way
they do.  However, I've got novice eyes, as we're all aware. :)

Thanks in advance for any and all help/explanations/demands that I enroll
in a c course immediately. ;)

-Mathew

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT