T3RRYT3RR0R

Batch Random Character Name Generator

Feb 27th, 2021 (edited)
500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.96 KB | None | 0 0
  1. ::: Author: T3RRY ; Created: 27/02/2021 ; Version: 1.0
  2. ::: Purpose: System for Generating random Charachter Name / Surname Combinations
  3. :::          For use In RPG / Rogue-like batch games
  4. :::          Predefined lists for names / surnames use the 100 most common english names/surnames.
  5. :::          Substitute these lists as you see fit. Script is based on each list having 100 names.
  6. :::          First Names list includes Gender Binary and Gender Neutral names.
  7.  
  8. @Echo off
  9. :# Define Lists of Names / Surnames for Selection by random Index.
  10.  Set Names=Sophia Liam    Olivia  Noah   Riley     Jackson  Emma      Aiden   Ava      Elijah   Isabella Grayson^
  11.  Aria      Lucas  Aaliyah Oliver  Amelia Caden     Mia      Mateo     Layla   Muhammad Zoe      Camilla  Carter ^
  12.  Charlotte Jayden Eliana  Ethan   Mila   Sebastian Everly   James     Luna    Michael  Avery    Benjamin Maya   ^
  13.  Evelyn    Logan  Harper  Leo     Lily   Luca      Ella     Alexander Gianna  Levi     Chloe    Adalyn   Josiah ^
  14.  Charlie   Henry  Isla    Jayce   Ellie  Julian    Leah     Jack      Nora    Ryan     Scarlett Jacob    Asher  ^
  15.  Abigail   Wyatt  Madison William Aubrey Owen      Emily    Gabriel   Kinsley Miles    Elena    Lincoln  Hannah ^
  16.  Paisley   Ezra   Madelyn Isaiah  Aurora Luke      Peyton   Cameron   Nova    Emilia   Isaac    Daniel   Mason  ^
  17.  Carson    Sarah  Samuel  Ariana  Colton Penelope  Maverick Lila      Matthew Caleb
  18.  
  19.  Set Surnames=Smith    Jones    Williams Taylor     Brown   Davies  Evans    Wilson    Thomas  Johnson Roberts   Mills    ^
  20.  Robinson     Thompson Wright   Walker   White      Edwards Hughes  Green    Hall      Lewis   Harris  Clarke    Harrison ^
  21.  Jackson      Wood     Turner   Martin   Cooper     Hill    Ward    Morris   Moore     Clark   Lee     King      Baker    ^
  22.  Morgan       Allen    James    Scott    Phillips   Watson  Davis   Parker   Price     Bennett Young   Griffiths Patel    ^
  23.  Mitchell     Kelly    Cook     Carter   Richardson Bailey  Collins Bell     Shaw      Murphy  Miller  Cox       Richards ^
  24.  Khan         Marshall Anderson Simpson  Ellis      Adams   Singh   Begum    Wilkinson Foster  Chapman Powell    Barnes   ^
  25.  Webb         Rogers   Gray     Mason    Ali        Hunt    Hussain Campbell Matthews  Owen    Palmer  Holmes    Harvey   ^
  26.  Knight       Lloyd    Butler   Russell  Barker     Fisher  Stevens Jenkins  Murray    Dixon  
  27.  
  28. :# Determine Random Generation Modulous range in accordance with index size of Name and Surname Lists
  29. :# - Allows names in the above lists to be added or removed without having to adjust the below code.
  30.                            Set /A {Ni}={Si}=0
  31.  For %%G in (%Names%)Do    Set /A {Ni}+=1
  32.  For %%G in (%Surnames%)Do Set /A {Si}+=1
  33.  
  34. :# Test delayed Expansion State prior to macro definition. Reject environment with DelayedExpansion Enabled
  35.  If "!"=="" (Echo Delayed Expansion Must be Disabled Prior to Macro Definition&Pause &Exit /B)
  36.  
  37. (Set \n=^^^
  38.  
  39. %= \n Macro newline variable. Do not Modify =%)
  40.  
  41. :# GetName Macro Definition. USAGE: %GetName%ReturnVar
  42.  
  43.  Set GetName=For %%n in (1 2)Do if %%n==2 ( %\n%
  44.   Set /A "{i1}={i2}=0"                      %\n%
  45.   Set /A "{n1}=!Random! %%{Ni} + 1"         %\n%
  46.   Set /A "{n2}=!Random! %%{Si} + 1"         %\n%
  47.   For %%G in (!Names!)Do (                  %\n%
  48.    Set /A "{i1}+=1"                         %\n%
  49.    If "!{i1}!"=="!{n1}!" (                  %\n%
  50.     Set "!ReturnName!=%%G"                  %\n%
  51.   ))                                        %\n%
  52.   For %%H in (!Surnames!)Do (               %\n%
  53.    Set /A "{i2}+=1"                         %\n%
  54.    If "!{i2}!"=="!{n2}!" (                  %\n%
  55.     For %%v in (!ReturnName!)Do (           %\n%
  56.      Set "!ReturnName!=!%%v! %%H"           %\n%
  57.  ))))Else Set ReturnName=
  58.  
  59. :# Enable DelayedExpansion for Macro Expansion
  60.  Setlocal EnableDelayedExpansion
  61.  
  62. :# Example usage - Define an array of 5 characters:
  63.  For /L %%i in (1 1 5)Do %GetName%Character[%%i]
  64.  Set Character[
  65.  Pause
  66.  Endlocal & Goto :Eof
  67.  
Add Comment
Please, Sign In to add comment