Char name

This program will generate a random Sir or Madame character name, it runs over Nox_RSG.

Sample output:
Sir Aidlay!

Since the word generation is random , it is not particularly fast. Woks best for words of 3 to 4 characters.
To call upon Nox_Speak, simply call the function with the following parameters: Nox_Speak(A, B); Both A and B being integers, A is the number of words to generate and B is how many characters each word will have.

Code Snippet (main.c)


#include "nox.h"
#include stdio.h>
#include ctype.h>

int main()
{
  int name_size[] = {2, 3, 4}, i = get_i_value() % 2, j = 0, n = 0;
  char *titles[2] = {"Sir", "Madame"};
  char *name;
  char charname[8];
  
  printf("%s ", titles[i]);

  if (get_i_value() % 2)
    i++;
  name = Nox_Speak(1, i);
  while (name[j])
    {
      charname[j] = name[j];
      j++;
    }

  if (get_i_value() % 2 && i < 2)
    i++;
  name = Nox_Speak(1, i);
  while (name[n])
    {
      charname[j] = name[n];
      j++;
      n++;
    }
  charname[0] = toupper(charname[0]);

  printf("%s", charname);

  printf("!\n");
  return(0);
}

        

Download

If you want to try it out yourself, you can download the full project below:

Download Char_Name

To compile it, just unzip the whole folder and do a "gcc *.c" on it, no dependencies.

It works best on linux, if you need to run it in windows use WSL or another emulator. It can work in windows but it will screw the RNG.



Back to projects