Re: Transportation devices

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 08/15/98


Phillip A. Ames wrote:
> problems with them.  First of all, they don't work :)  Whenever they
> are loaded, all commands that are typed by anyone simply don't do
> anything.

Sounds like an infinite loop to me. Or, at least, a really, really long
loop.

> SPECIAL(comm_badge) {
> int beamdown_room;
> int beamup_room;

Ack. I realize that this code is probably auto-formatted by MSVC or
whatever IDE/editor you use, however, it is *not* for us. It'd help a
lot if you took the time out to format the code before sending it along
the list. More people would be encouraged to actually look through it
than skip your message because the code is unreadable.

> if (CMD_IS("beamup")){
>   vehicle = find_vehicle_by_vnum(GET_OBJ_VAL(comm_badge, 0));
>   if (!vehicle) {
>     send_to_char("ERROR!  Vehicle doesn't exist!  Somebody's been ...
>     return 1;
>   }
>   if (GET_OBJ_VAL(comm_badge, 2) = 0) {

Oh, my, you want "==". How you have it, this should always evaluate to
false (should, anyway). Also, use some "else" statements. They're very
convenient and will make your code more readable. This code block could
be,

  if (!GET_OBJ_VAL(comm_badge, 2)) {
    .
    .
    .
  } else {
    .
    .
    .
  }

> char_to_room(ch, beamup_room);

Is that a real num or virtual num? Also, you want to start off your
spec-proc with "if (!cmd) return 0;" since it's not going to be doing
anything if it's not called by a command. You want to "return 1;"
whenever they fail to beam-up for some reason, so that the code
doesn't continue past that point.

If problems persist, please repost the code in formatted form, so we
can actually read it and perhaps see your problem.

-dak


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