Hey. Im havin some trouble with a new cool command im tryin to write. It is a go command so when a player is in a room and say there is an alley mentioned in the room description, the player can type "go alley" and the command will take him to the alley. This is in place of the usual "an alley is to the north", and the player has to just go plain old north. Well, I think i went about coding it right. In db.c in the parse_room function where the compiler is interpreting the various 1 letter commands such as 'D' for dir, and 'E' for extra desc. i added 'G' for go, and for its case I said: case 'G': setup_go(fl, room_nr, atoi(line + 1)); break; the setup_go function is basically the same as the setup_dir, except instead of all the variables from the world file being stored in the room_direction_data structure, I made a new room_go_data structure with basically the same content (just changin the variable names) and stored them there. This part works, the compiler compiles it, and it will boot the world using the G's in the world file. So now I had to write the ACMD(do_go) function and this is where i ran into trouble. If someone could help me with pseudo coding this i would greatly appreciate it. This is the pseudo of what I have but it doesnt work. /* When i compile, i get errors in this function for each str_cmp saying passing arg 1 of str_cmp makes pointer from integer without a cast */ /* THe purpose of this function is to take their argument when they typed go and compare it to a maximum of 4 "go keywords" for that room, and return a go_num, like the dir in perform_move. */ int find_go_num_of_arg(arg) { if((str_cmp(arg, world[ch->in_room].go_option[0]->go_keyword) != 0) && (str_cmp(arg, world[ch->in_room].go_option[1]->go_keyword) != 0) && (str_cmp(arg, world[ch->in_room].go_option[2]->go_keyword) != 0) && (str_cmp(arg, world[ch->in_room].go_option[3]->go_keyword) != 0)) { return (NOWHERE); } else if ((str_cmp(arg, world[ch->in_room].go_option[0]->go_keyword) == 0) return(0); else if ((str_cmp(arg, world[ch->in_room].go_option[1]->go_keyword) == 0) return(1); else if ((str_cmp(arg, world[ch->in_room].go_option[2]->go_keyword) == 0) return(2); else if ((str_cmp(arg, world[ch->in_room].go_option[3]->go_keyword) == 0) return(3); } /* This is the function that performs the go. I dont get any errors in here, just a couple warnings that i didnt bother to fix. I stripped down the follower info, the to_room flags, and most of everything else, just so i could test it. */ int perform_go(struct char_data *ch, int go_num, int need_specials_check) { room_rnum was_in; struct follow_type *k, *next; if(!*arg) { send_to_char("Where do you want to go?", ch); return(FALSE); } if (find_go_num_of_arg(*arg) == NOWHERE) { send_to_char("You peer around for a moment, but do not see that here.", ch); } else if (ch == NULL || gnum < 0 || gnum >= NUM_OF_GO || FIGHTING(ch)) return (0); else { was_in = ch->in_room; char_from_room(ch); char_to_room(ch, world[was_in].dir_option[dir]->to_room); if (ch->desc != NULL) look_at_room(ch, 0); } return (TRUE); } /* This is the actual ACMD of it, i set it up just like the go*/ ACMD(do_go) { perform_go(ch, find_go_num_of_arg(*arg), 0); } i know that was a lot of stuff, but then again, trying to write this confused the heck out of me. thanks Drew TalonMUD creator, coder, writer +------------------------------------------------------------+ | 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