hmm these are NOT walkthroughs. But hey, you probably learn by getting them to work. they are not hard... at most i've left out ACMD's in interpreter.c or little things like that. :) a word of waring. I am busy coding things in time for a mud-opening in a month. these are not tested, user-friendly or foolproof. Its just stuff i did in the last few days that (sortof) work. If you cant understand them. plz dont use them. impl can log a string to the syslog... ACMD(do_log){ if (GET_LEVEL(ch)<LVL_IMPL) return; skip_spaces(&argument); if (!*argument){ send_to_char("Log what??",ch); return;} sprintf(buf,"%s logs: %s",GET_NAME(ch),argument); mudlog(buf,BRF,LVL_IMPL,TRUE); } prints the last 20 lines of syslog... ACMD(do_recent){ FILE *myfile; int x=0; int y=0; /* open the syslog */ if (!(myfile=fopen("../syslog","r"))){ mudlog("Error open syslog file for 'recent'",BRF,LVL_GOD,TRUE); return; } /* count lines in syslog */ get_line(myfile,buf); while (!feof(myfile)){ y++;get_line(myfile,buf);} fclose(myfile); /* close and re-open */ if (!(myfile=fopen("../syslog","r"))){ mudlog("Error open syslog file for 'recent'",BRF,LVL_GOD,TRUE); return; } /* and print the last few lines */ get_line(myfile,buf); while (!feof(myfile)){ x++; if (x>(y-20)){ sprintf(buf2," %s\r\n",buf); send_to_char(buf2,ch); } get_line(myfile,buf); } fclose(myfile); } a finger command. not by me. :) ACMD(do_finger) { struct char_file_u chdata; struct char_data *victim = 0; char shost[80]; int i,hpos=0; one_argument(argument, arg); if (!*arg) { send_to_char("Who do you want to finger?\r\n", ch); return; } if (load_char(arg, &chdata) < 0) { send_to_char("There is no such player.\r\n", ch); return; } send_to_char("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-$ sprintf(buf, "%s %s is a level %2d player.\r\n", chdata.name, (chdata.title ? chdata.title : " "), (int) chdata.level); send_to_char(buf, ch); /* If finger-er is a mortal then show login address as */ /* "*.top-level-domain", otherwise show the full host address */ if (GET_LEVEL(ch)>=LVL_GOD) strcpy(shost,chdata.host); else { for(i=0;i<strlen(chdata.host);i++) if(chdata.host[i]=='.') hpos=i+1; if (hpos) { strcpy(shost,"*."); strcat(shost,chdata.host+hpos); } else strcpy(shost,chdata.host); } if ((victim = get_player_vis(ch, arg, 0))) { sprintf(buf, "Is playing from %s.\r\n",shost); send_to_char(buf, ch); /* Also if finger-er is >= immortal show idle tics */ if (GET_LEVEL(ch)>=LVL_GOD) { sprintf(buf, "And has been idle %d tics\r\n", victim->char_specials.tim$ send_to_char(buf, ch); } } else { strcpy(buf1, ctime(&chdata.last_logon)); buf1[19] = '\0'; sprintf(buf, "Last login was on %s, from %s.\r\n", buf1, shost); send_to_char(buf, ch); } /* sprintf(buf, "[%5ld] [%2d %s] %-12s : %-18s : %-20s\r\n", chdata.char_specials_saved.idnum, (int) chdata.level, class_abbrevs[(int) chdata.class], chdata.name, chdata.host, ctime(&chdata.last_logon)); sprintf(buf,"Email:\r\nWeb:\r\n"); send_to_char(buf,ch); */ send_to_char("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-$ } speedwalk... in interpreter.c... /* check if coomand is all directions... */ if (*cmd_info[cmd].command == '\n') { for(i=0;i<strlen(arg);i++) switch (*(arg+i)) { case 'n':case's':case'd':case'u':case'e':case'w':break; default: i=(strlen(arg)+1);break; } /* speedwalk!*/ if (i==strlen(arg)){ send_to_char(":Speedwalking\r\n",ch); for(i=0;i<strlen(arg);i++) { sprintf(buf,":go %c\r\n",(*(arg+i))); send_to_char(buf,ch); switch(*(arg+i)){ case'n':perform_move(ch,0,0);break; case'e':perform_move(ch,1,0);break; case's':perform_move(ch,2,0);break; case'w':perform_move(ch,3,0);break; case'u':perform_move(ch,4,0);break; case'd':perform_move(ch,5,0);break; }} } else typo..thing. +-----------------------------------------------------------+ | 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/07/00 PST