Re: Wear positions

From: Fizal (amustapa@yahoo.com)
Date: 02/01/00


At 09:02 PM 1/31/00 -0500, Jerry Billings <Jubjubsoft@aol.com> wrote:
>also another question, i want to make these extra positions i added
>permanant, meaning once you put something there you cant take it
>off with out a piece of special equipment (i.e. implants and an implant
>extraction tool) has anyone ever done this before if so any pointers?

Brandon's suggestion to create new item types is one way to do this.
However, I personally prefer not to create item types unless I'm sure that
I'll be using it to create a lot of things. You might be creating a lot of
items for implants, so adding ITEM_IMPLANT might be a good idea. But, if
you're only going to let them extract or place the implant using specific
items (very few in total) you can just use ITEM_TRASH or something else for
it. But again... it's all up to you.

According to you, you created 2 more slots. Let's assume that the slot for
the implant is declared as WEAR_IMPLANT. To stop players from removing the
implants, you'll need to do several checks:

ACMD(do_remove)
{
....
  if (dotmode == FIND_ALL) {
    found = 0;
    for (i = 0; i < NUM_WEARS; i++)
>> if (GET_EQ(ch, i) &&  i != WEAR_IMPLANT) {
        perform_remove(ch, i);
        found = 1;
      }
....
    else {
      found = 0;
      for (i = 0; i < NUM_WEARS; i++)
>>  if (GET_EQ(ch, i) && i != WEAR_IMPLANT && CAN_SEE_OBJ(ch, GET_EQ(ch,
i)) &&
            isname(arg, GET_EQ(ch, i)->name)) {
          perform_remove(ch, i);
          found = 1;
....
    if (!get_object_in_equip_vis(ch, arg, ch->equipment, &i)) {
      sprintf(buf, "You don't seem to be using %s %s.\r\n", AN(arg), arg);
      send_to_char(buf, ch);
>>  } else if (i == WEAR_IMPLANT)
>>     send_to_char("Sorry, you can't remove the implant!\r\n", ch);
>>    else
      perform_remove(ch, i);
  }
}

I believe that should settle the prob. As for removing the implant. There's
2 ways of doing it[1]. You can either create a command for it, or you can
create a spec proc for it. Both have their own advantages and disadvantages:

command
- Can be used anywhere.
- Need to search for the items (both implant and remover) before letting
players do anything. So, if each implant requires specific remover, then
you'll need to do a check for a match. For this situation, creating an item
type will be better for the remover.
- Requires a specific command. If the command exists, then you'll need to
change the coding for that command to include whatever you want it to do.
- Good if the command will be used often and anywhere in the game.

spec proc
- Can only be used when the object with the spec proc is in the same room
or in inventory.
- Need only to search for the implant, since the remover is the object that
has the spec proc.
- Can simulate existing commands since we can check what command was used
and react accordingly. One good thing about spec proc is that even tho the
command is supposed to do another thing, we can trap it. The actual command
function will not be executed if there is a spec proc that caters to it.[2]
- Good if it's not often used or only used in certain places. (eg: bank and
mail spec procs)

Think about how you want it to be done. Both methods above are somewhat
different. Once you've figured out how you want it to be done, then you can
start thinking about how it should go (in terms of coding). I'm willing to
help, since I need to take a break from this project I'm currently in at
work. [3]

G'luck! :)

[1]  Actually, might be able to use DGScript as well to do this. You'll
need to talk to someone who's an good in it tho...
[2] At least from what I remember.... Shelved the mud for several months
now due to project. I might be wrong.
[3] Heh... my housemates are wondering what type of "break" I'm talking
about since I'll be running from one programming into another....


---

Afizal Mustapa
Petaling Jaya, Selangor, Malaysia.
(amustapa@hotmail.com)

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT