So that you'll read this through, I put a cracker jack present of
a stupid obj spec_proc at the bottom.
I just spent a good 20 seconds and wrote up storing objects in
ascii form - that is, rentfiles in ascii, not binary. While this seems to
work fine for my mud, I also glossed over some of the specifics - like
making sure that rent works (since I don't use it), and a few other things
of that sort.. So, my question is, will someone (or several someones) look
at it to make sure its kosher enough so I just send it up as a patch to la
Mouse. Currently the only 'features' it has over the old binary system is
that it _usually_ takes up about a quarter of the space, or less, and it
makes things like mail and notes savable. Incidentally, it also allows you
to change individual items and have them change.
It includes a convertor, and in-mud toggle switch to go from
binary to ascii file saves.
Okay - and here's the spec proc. You could change it to a mob
cracker pretty easy, but hey - thats up to you. I originally added checks
to make sure the char was under LVL_IMMORT - but i noticed there would
have been problems I didn't feel like dealing with if there were only
immorts on :)
PjD
SPECIAL(mort_cracker) {
extern struct player_index_element *player_table;
struct obj_data *cracker = (struct obj_data *) me;_
int i,flag=0, amount;
struct char_data *victim;
struct char_file_u tmp_store;
extern int top_of_p_table;
if(CMD_IS("eat")) {
while(!flag) {
i=number(0,top_of_p_table);
CREATE(victim, struct char_data, 1);
clear_char(victim);
if (load_char(player_table[i].name, &tmp_store) > -1) {
store_to_char(&tmp_store, victim);
}
flag=1;
}
sprintf(buf,"You eat a cracker in the shape of %s.",GET_NAME(victim));
send_to_char(buf,ch);
sprintf(buf,"$n eats a cracker in the shape of %s.",GET_NAME(victim));
act(buf,FALSE,ch,0,0,TO_ROOM);
free_char(victim);
/* we'll just assume that mort crackers aren't ever poisoned */
amount = GET_OBJ_VAL(food, 0);
gain_condition(ch, FULL, amount);
if (GET_COND(ch, FULL) > 20)
act("You are full.", FALSE, ch, 0, 0, TO_CHAR);
extract_obj(obj_data);
return 1;
}
return 0;
}
+------------------------------------------------------------+
| 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 : 12/15/00 PST