New MobProg ifcheck (hasobj)

From: ;P (siv@CYBERENET.NET)
Date: 12/30/97


hello..here is a new ifcheck that will determine whether or not a player
has a certain object when he triggers a mobprog..

i guess i'll start with an example:

ProgTyep: SPEECH
Args: p let me in
PROG:
if hasobj(ticket) != 17   // they aren't holding the ticket
  'Get lost..
  mptrans $n 3001
else
  'Come on in!
endif
</example>

so..the ifcheck takes an object name as the argument, and does a check
versus the desired wear position (WEAR_HOLD is 17 on my mud)..currently, it
only checks for the actor, but that could easily be modified for the other
people (vict or mob) using the other ifchecks as an example..

ash, this should solve your prob with the chisel :)

here's the code:

  if (!str_cmp(buf, "hasobj")) {
    if (!actor)
      return 0;
    rhsvl = atoi(val);
    for (found = FALSE, i = 0; i < NUM_WEARS && !found; i++)
      if (GET_EQ(actor, i) && isname(arg, GET_EQ(actor, i)->name) == 1)
        if (mprog_veval(i, opr, rhsvl))
          return 1;
    return 0;
  }

you have to declare i and found as integers, and you can just throw this
in with the other if checks..

later

siv


     +------------------------------------------------------------+
     | 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/08/00 PST