Please verify what you entered. There seems to be either missing, or duplicate text in the function. just as an example, you have two "}" after the second 'if' statement.
- Valnir ----- Original Message ----- From: "Tristan M" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, August 13, 2004 2:01 PM Subject: a problem im having > i wrote this little function to list all the weapons in the game and their > average damage, with two options, you can search for options of a > particular level, particular name, particular name and level, or just list > all the objects. my problems are: > a) that when it tries to list by name(without level) it only shows weapons > that are level 0 > b) when it tries to list by name and level it doesnt spit anything out > > heres the code, can someone find whats wrong? ive been looking at it and > just cant figure it out. > > void do_checkweaps(CHAR_DATA *ch, char *argument) > { > char buf[MAX_INPUT_LENGTH]; > char name[MAX_INPUT_LENGTH]; > char level[MAX_INPUT_LENGTH]; > BUFFER *buffer; > OBJ_DATA *obj; > bool found; > int number = 0; > > found = FALSE; > number = 0; > > buffer = new_buf(); > > argument = one_argument(argument, name); > argument = one_argument(argument, level); > if (name[0] == '\0' || ( !str_cmp( name, "null" ) && level[0] == '\0')) > { > log_string("1"); > for ( obj = object_list; obj != NULL; obj = obj->next ) > { > if(obj->wear_loc == WEAR_WIELD) > { > number++; > sprintf(buf," %d ) [ AVG DAM: %3d ] [ LEVEL: %3d ] %s\n\r",number,((1 + > obj->value[2]) * obj->value[1] / 2),obj->level,obj->short_descr); > add_buf(buffer,buf); > } > } > page_to_char(buf_string(buffer),ch); > return; > } > if (str_cmp( name, "null" ) && level[0] == '\0') > { > log_string("2"); > for ( obj = object_list; obj != NULL; obj = obj->next ) > { > if(str_cmp(name,obj->name)) > continue; > if(obj->wear_loc == WEAR_WIELD) > { > number++; > sprintf(buf," %d ) [ AVG DAM: %3d ] [ LEVEL: %3d ] %s\n\r",number,((1 + > obj->value[2]) * obj->value[1] / 2),obj->level,obj->short_descr); > add_buf(buffer,buf); > } > } > page_to_char(buf_string(buffer),ch); > return; > } > if (!str_cmp( name, "null" )) > { > log_string("3"); > for ( obj = object_list; obj != NULL; obj = obj->next ) > { > if(obj->level != atoi(level)) > continue; > if(obj->wear_loc == WEAR_WIELD) > { > number++; > sprintf(buf," %d ) [ AVG DAM: %3d ] [ LEVEL: %3d ] %s\n\r",number,((1 + > obj->value[2]) * obj->value[1] / 2),obj->level,obj->short_descr); > add_buf(buffer,buf); > } > } > page_to_char(buf_string(buffer),ch); > return; > } > log_string("4"); > for ( obj = object_list; obj != NULL; obj = obj->next ) > { > if(str_cmp(name,obj->name)) > continue; > if(obj->level != atoi(level)) > continue; > if(obj->wear_loc == WEAR_WIELD) > { > number++; > sprintf(buf," %d ) [ AVG DAM: %3d ] [ LEVEL: %3d ] %s\n\r",number,((1 + > obj->value[2]) * obj->value[1] / 2),obj->level,obj->short_descr); > add_buf(buffer,buf); > } > } > page_to_char(buf_string(buffer),ch); > return; > } > > _________________________________________________________________ > Take charge with a pop-up guard built on patented Microsoft® SmartScreen > Technology > http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines > Start enjoying all the benefits of MSN® Premium right now and get the > first two months FREE*. > > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom >

