Welcome to the Builder Academy

Question Patch Command

More
23 Dec 2014 02:00 #5170 by dracmas
Replied by dracmas on topic Patch Command
It's not my snippet but Liko's. I wanted to look at it, but since the link doesn't work anymore, I was hoping there was another way to it.

Please Log in or Create an account to join the conversation.

More
23 Dec 2014 22:56 #5172 by Rumble
Replied by Rumble on topic Patch Command
Found it. Anyone have a recommendation for hosting all of our downloads? Every time I pick a solution it goes under in a year or two and is no longer supported. I'm thinking maybe just Google drive. Thoughts?
Code:
V1.00 Hello! Welcome to my patch command. This combines the current news and changelog command and takes them to a better system. First off, the patch commad just allows you to type what you just type. patch Warriors damage Whirlwind damage has been reduced. Now where will that appear? That will now show up in the News file. The players (news) icon will now show up in their prompt showing a new update. Now lets get this patch underway: 1). Open act.wizard.c and go to the end of the file: ACMD(do_patch) { time_t rawtime; char tmstr[MAX_INPUT_LENGTH], line[READ_SIZE], last_buf[READ_SIZE], buf[READ_SIZE]; FILE *fl, *new; skip_spaces(&argument); if (!*argument) { send_to_char(ch, "Usage: patch <change>\r\n"); return; } sprintf(buf, "%s.bak", NEWS_FILE); if (rename(NEWS_FILE, buf)) { mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error making backup news file (%s)", buf); return; } if (!(fl = fopen(buf, "r"))) { mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening backup news file (%s)", buf); return; } if (!(new = fopen(NEWS_FILE, "w"))) { mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening new news file (%s)", NEWS_FILE); return; } while (get_line(fl, line)) { if (*line != '[') fprintf(new, "%s\n", line); else { strcpy(last_buf, line); break; } } rawtime = time(0); strftime(tmstr, sizeof(tmstr), "%b %d %Y", localtime(&rawtime)); sprintf(buf, "[%s] - %s", tmstr, GET_NAME(ch)); fprintf(new, "%s\n", buf); fprintf(new, "%s\n", argument); if (strcmp(buf, last_buf)) fprintf(new, "%s\n", line); while (get_line(fl, line)) fprintf(new, "%s\n", line); fclose(fl); fclose(new); reboot_news(); } 2. Close act.wizard.c 3. open act.h and under do_zunlock add: ACMD(do_patch) 4. close act.h and open interpreter.c 5. search pardon and under it add: { "patch" , "patch" , POS_DEAD , do_patch , LVL_IMPL, 0 }, 6. close interpreter.c and open db.c 7. search reboot_wizlists and under it add: void reboot_news(void) { file_to_string_alloc(NEWS_FILE, &news); } 8. close db.c and open db.h 9. search reboot_wizlists and under it add: void reboot_news(void); 10. close db.h and compile. :) I hope you like this. I think it brings use to the news file. :) - Liko 4/25/2014

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

Please Log in or Create an account to join the conversation.

More
23 Dec 2014 23:32 #5173 by dracmas
Replied by dracmas on topic Patch Command
Second github? It would keep everything neat and in one place as well as easy to resort when needed.

Please Log in or Create an account to join the conversation.

More
26 Jan 2015 16:03 #5213 by Liko
Replied by Liko on topic Patch Command

dracmas wrote: Second github? It would keep everything neat and in one place as well as easy to resort when needed.


Sorry, I have been gone. How is it working? I took the basic idea from the news/motd and todo. Do you like it? Anything else do you think could be done with it?

Randian(0.0.0)
Owner/Developer
The following user(s) said Thank You: dracmas

Please Log in or Create an account to join the conversation.

More
02 Feb 2015 03:10 #5220 by dracmas
Replied by dracmas on topic Patch Command
It's worked like a charm. Don't see anything that needs changed. Only I changed the command name to newsupdate as I want it easily known what the command does. Great job. Which reminds me. Going to go back and give you credit in the help file for the command.

Please Log in or Create an account to join the conversation.

Time to create page: 0.190 seconds