Multi Title

Posted by Johny on Wed 02 Mar 2005 01:01 AM — 10 posts, 36,575 views.

USA #0
Now, since I fixed my last title problem, I feel I still must upgrade this by working out more greetings. Only problem is I don't know how to work out a way to make a random title. I run a Windows XP.
USA #1
What do you mean random title? Random titles for players? When? How random? Or the mud opening/greeting?
USA #2
The opening
USA #3
The most straightforward way to do this is to generate a random number, append it to a string buffer e.g. GREETING_, and create help files for GREETING_1, ..._2, ..._3 and so forth.
USA #4
So, all I must do is Type GREETING_2 for my next greeting?
USA #5
No, that's not "all" you have to do... you have to do the rest of the things I said too. :-)
USA #6
Here is the code to put multiple ANSI Greeting screens into your startup.. Hope this is what you needed


In mud.h
--------
Where the #define is for #define ANSITITLE_FILE  SYSTEM_DIR "mudtitle.ans"
replace that with .....
#define ANSITITLE_FILE  SYSTEM_DIR "mudtitle1.ans"
#define ANSITITLE1_FILE  SYSTEM_DIR "mudtitle2.ans"
#define ANSITITLE2_FILE  SYSTEM_DIR "mudtitle3.ans"
#define ANSITITLE3_FILE  SYSTEM_DIR "mudtitle4.ans"
#define ANSITITLE4_FILE  SYSTEM_DIR "mudtitle5.ans"
#define ANSITITLE5_FILE  SYSTEM_DIR "mudtitle6.ans"

In act_comm.c
-------------
Right below the line that reads ....
    char BUFF[MAX_STRING_LENGTH*2];
add ...
    int random;
    char pbuf[MAX_INPUT_LENGTH];

    random = number_range(0, 5);
    switch(random)
    {
    case 0:
      strcpy(pbuf,ANSITITLE_FILE);
      break;
    case 1:
      strcpy(pbuf,ANSITITLE1_FILE);
      break;
    case 2:
      strcpy(pbuf,ANSITITLE2_FILE);
      break;
    case 3:
      strcpy(pbuf,ANSITITLE3_FILE);
      break;
    case 4:
      strcpy(pbuf,ANSITITLE4_FILE);
      break;
     case 5:
     default:
      strcpy(pbuf,ANSITITLE5_FILE);
      break;
    }
 and replace the line that reads ....
    if ((rpfile = fopen(ANSITITLE_FILE,"r")) !=NULL) {
with ....
    if ((rpfile = fopen(pbuf,"r")) !=NULL) {

The last thing to do is create your ansi files in the /dist/system
directory, they should be ....
mudtitle1.ans mudtitle2.ans mudtitle3.ans
mudtitle4.ans mudtitle5.ans mudtitle6.ans
USA #7
It would probably be common courtesy to mention the author's name and website if you're going to C&P their whole snippet in your own post.


For the curious, the above is LrdElder's "Multiansi" snippet, taken from:
http://www.geocities.com/SiliconValley/Mouse/6754/Multians.txt


Amended on Thu 17 Mar 2005 04:36 PM by Gatewaysysop2
USA #8
Actually the snippet file that i have is exactly that text
only.. nothing else .. and it was gotten off a site with tons
of snippets that had no license listed.. I am sorry for being
unaware that the snippet was any sort of licensing.
USA #9
What was the site? Perhaps it had snippets I have yet to see.