> > Does any one know where the code is, or can give me an idea how to set > the MUD up so instead of seeing: > > bread > bread > bread > > You see: > > [3] bread > It can be solved in 2 ways (that I know of) Way 1: (PSEUDO) foreach item in room do if item is equal to next-item then counter = 0 while item = next-item then increment counter item = next-item end while print to user screen Item and counter else print to user screen Item end if end foreach This 'compress' sequences within the list. Example A bread A sword A sword A bread A sword would be: A bread A sword (2) A bread A sword Way 2: (Also Pseudo) initialize obj-list foreach item in room do if item is present in obj-list then increment obj-list-counter else add item to obj-list end if end foreach foreach obj in obj-list do print to user screen obj-name and obj-counter end foreach This would make the output: A bread (2) A Sword (3) OR A sword (3) A bread (2) This is a slower method, and you break the 'order' for the player. 2.sword might no longer be 2.sword on the screen. The first way produces a correct ordered list. The only prerequisit is that the user (mudder) has the basic knowledge of mathematics. :) // ZIgg +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST