Melissa Jadwinski I was tired of repeated reboots whenever I wanted to create a new ATM in my mud. So, in true mud implementor tradition, I hacked up the existing ATM special and replaced it. This version allows players to deposit money into each other's accounts. [Copy originally from http://www.meersan.net/snippets/atm.txt -- Ed.] Snippet to replace the bank special in CircleMUD. structs.h #define ITEM_ATM 24 /* or whatever # is not yet taken */ interpreter.h #define SCMD_BALANCE 0 #define SCMD_DEPOSIT 1 #define SCMD_WITHDRAW 2 interpreter.c { "balance" , do_gen_atm , POS_STANDING, 1 , SCMD_BALANCE }, { "deposit" , do_gen_atm , POS_STANDING, 1 , SCMD_DEPOSIT }, { "withdraw" , do_gen_atm , POS_STANDING, 1 , SCMD_WITHDRAW }, act.other.c: /* local functions */ int atm_is_in_room(struct char_data *ch); ACMD(do_gen_bank); /* at end of file */ /* would be just as easy to make a MOB_BANKER flag and check for one here */ int atm_is_in_room(struct char_data *ch) { struct obj_data *obj; int i; /* any atm in the room */ for (obj = world[ch->in_room].contents; obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_ATM) return (1); /* carrying a bankcard */ for (obj = ch->carrying; obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_ATM && (find_eq_pos(ch, obj, NULL) < 0)) return (1); /* wearing a bankcard */ for (i = 0; i < NUM_WEARS; i++) if (GET_EQ(ch, i) && GET_OBJ_TYPE(GET_EQ(ch, i)) == ITEM_ATM) return (1); return (0); } AMCD(do_gen_bank) { int amount; struct char_data * vict; if (IS_NPC(ch)) return; if (!atm_is_in_room(ch)) { send_to_char("You can''t do that here!\r\n", ch); return; } switch (subcmd) case SCMD_BALANCE: if (GET_BANK_GOLD(ch) > 0) sprintf(buf, "Your current balance is %d coins.\r\n", GET_BANK_GOLD(ch)); else sprintf(buf, "You currently have no money deposited.\r\n"); send_to_char(buf, ch); break; case SCMD_DEPOSIT: skip_spaces(&argument); two_arguments(argument, buf, buf2); if (!*buf2) { /* do normal deposit */ if ((amount = atoi(argument)) <= 0) send_to_char("How much do you want to deposit?\r\n", ch); else if (GET_GOLD(ch) < amount) { send_to_char("You don''t have that many coins!\r\n", ch); else { GET_GOLD(ch) -= amount; GET_BANK_GOLD(ch) += amount; sprintf(buf, "You deposit %d coins.\r\n", amount); send_to_char(buf, ch); } } else { /* attempt transfer deposit */ if (!(vict = get_char_vis(ch, buf, FIND_CHAR_WORLD))) { send_to_char(NOPERSON, ch); else if ((vict == ch) || IS_NPC(vict)) send_to_char("What''s the point of that?\r\n", ch); else if ((amount = atoi(buf2)) <= 0) send_to_char("How much do you want to deposit?\r\n", ch); else if (GET_GOLD(ch) < amount) send_to_char("You don''t have that many coins!\r\n", ch); else { GET_GOLD(ch) -= amount; GET_BANK_GOLD(vict) += amount; /* if you allow manual saving you will want do a couple save_char''s here */ sprintf(buf, "You deposit %d coins into $N''s account.", amount); act(buf, FALSE, ch, 0, vict, TO_CHAR); sprintf(buf, "$n deposits %d coins into your account.", amount); act(buf, FALSE, ch, 0, vict, TO_VICT); act("$n makes a bank transaction.", TRUE, ch, 0, vict, TO_ROOM); } } break; case SCMD_WITHDRAW: if ((amount = atoi(argument)) <= 0) send_to_char("How much do you want to withdraw?\r\n", ch); else if (GET_BANK_GOLD(ch) < amount) { send_to_char("You don''t have that many coins deposited!\r\n", ch); else { GET_GOLD(ch) += amount; GET_BANK_GOLD(ch) -= amount; sprintf(buf, "You withdraw %d coins.\r\n", amount); send_to_char(buf, ch); act("$n makes a bank transaction.", TRUE, ch, 0, FALSE, TO_ROOM); } break; default: log("SYSERR: Unknown subcmd %d passed to do_gen_bank.", subcmd); break; } } That''s it! You may now rip out the ASSIGNOBJ(XXXX, bank) statements in spec_assign.c and change your existing ATMs to type ITEM_ATM. -- mjj 1999 meer@meersan.net