The token command is for Rom2.4 Muds using a questpoint system as seen in Vassago's Auto-Quest code, where the qp are a part of the CHAR_DATA. This allows the players to make physical qp to trade with other players or to pay off immortals with. Pretty handy for the players. For this, I made a new item type, ITEM_TOKEN to use. If you use this code, all I ask is that you e-mail me at indigo@wworld.com, and let me know you're using it, if you can. No powertrips here.....I'd just like to know that someone's using it. Enjoy.... *********************************************************************** ->in merc.h *You'll need to add a reference to the object that your tokens will be. Try to find *an empty object space in Limbo, and add this to merc.h with the other OBJ_VNUM macros: +#define OBJ_VNUM_TOKEN 24 /* or any free vnum in Limbo that you wanna use */ *Define the new item type with the other item types in merc.h : +#define ITEM_TOKEN 35 /* or next number in line */ ->in act_obj.c *in the do_eat function, look for this line : - if ( obj->item_type != ITEM_FOOD && obj->item_type != ITEM_PILL ) *and change it to this : + if ( obj->item_type != ITEM_FOOD && obj->item_type != ITEM_PILL && obj->item_type != ITEM_TOKEN ) *down towards the bottom of do_eat, just after the *case ITEM_PILL statement, add this new case : + case ITEM_TOKEN: + value = obj->value[0]; + ch->questpoints += value; + break; *This fixes it so players put the quest points back into their totals by EATING the tokens. *Seemed like a fun and unusual way to do it. If you want, you could, I suppose, write *a "do_absorb" function, that'd do something similar. But at least this way, the extraction *of the token is already there. Seemed easier to me at the time. ->in const.c *in const struct item_type, add this line towards the bottom : + { ITEM_TOKEN, "token" }, ->in db.c *in the OBJ_DATA *create_object, add this case statement (mine's just *after the case ITEM_MONEY case) : + case ITEM_TOKEN: + if (!pObjIndex->new_format ) + obj->value[0] = number_fuzzy( number_fuzzy( obj->value[0]) ); + break; ->in db2.c *in the void convert_object function, again add this new case statement after *the case ITEM_MONEY : + case ITEM_TOKEN: + pObjIndex->value[0] = pObjIndex->value[0]; + break; **For Ivan's OLC-using Muds, add the next** ->in olc_act.c *in void show_obj_values, add this case statement somewhere within the function : + case ITEM_TOKEN: + sprintf( buf, + "[v0] Quest point value: [%d]\n\r", + obj->value[0]); + send_to_char( buf, ch ); + break; *in bool set_obj_values, add THIS case statement in with the others : + case ITEM_TOKEN: + switch ( value_num ) + { + default: + do_help( ch, "ITEM_TOKEN" ); + return FALSE; + case 0: + send_to_char ( "QP VALUE OF TOKEN SET.\n\r\n\r", ch ); + pObj->value[0] = atoi( argument ); + break; + } + break; ->in tables.c *in the const struct flag_type type_flags table, add the following at the end of *of the table, before the NULL line : + { "token", ITEM_TOKEN, TRUE }, **Now, find a place to stick the do_token command. Mine's at the bottom of our quest.c **but it could probably go anywhere you have room. Just make sure to add an entry **for the command in interp.c and interp.h If you're not sure how, just follow the **other entries, making sure your new ones refer to do_token, recompile, and you should be set. void do_token ( CHAR_DATA *ch, char *argument ) { OBJ_DATA *obj=NULL; char buf[MAX_STRING_LENGTH]; char arg[MAX_STRING_LENGTH]; int value; one_argument( argument, arg ); if (IS_NPC(ch)) return; if (arg[0] == '\0') { send_to_char("How many qp should the token be worth?\n\r", ch); return; } if (ch->questpoints <= 0 ) { send_to_char("You have no qp left to spend!\n\r", ch); return; } else { value = atoi(arg); if (value <= 0 ) { send_to_char("Tokens may only by made for positive amounts.\n\r", ch); return; } else if (value > ch->questpoints ) { send_to_char("You don't have that many quest points.\n\r",ch); return; } else { obj = create_object(get_obj_index(OBJ_VNUM_TOKEN), 0); sprintf( buf, obj->short_descr, value ); free_string( obj->short_descr ); obj->short_descr = str_dup( buf ); sprintf( buf, obj->description, value ); free_string( obj->description ); obj->description = str_dup( buf ); obj->value[0] = value; ch->questpoints -= value; obj_to_char(obj,ch); act( "You snap your fingers and produce a quest token!", ch, NULL, NULL,TO_CHAR); act( "$n snaps $s fingers and produces a quest token!", ch, NULL, NULL, TO_ROOM); return; } } return; } *Now just make a new item in Limbo with the same vnum as you set aside for the tokens, *of object type token(after the reboot, of course) and enjoy!