View the code of the script directly in your browser without downloading anything.

```
#CodeGenAPI
#By nfell2009
options:
P: &8[&aCGA&8]&a
on script load:
delete {cga.alphabet::*}
add "a" to {cga.alphabet::*}
add "b" to {cga.alphabet::*}
add "c" to {cga.alphabet::*}
add "d" to {cga.alphabet::*}
add "e" to {cga.alphabet::*}
add "f" to {cga.alphabet::*}
add "g" to {cga.alphabet::*}
add "h" to {cga.alphabet::*}
add "i" to {cga.alphabet::*}
add "j" to {cga.alphabet::*}
add "k" to {cga.alphabet::*}
add "l" to {cga.alphabet::*}
add "m" to {cga.alphabet::*}
add "n" to {cga.alphabet::*}
add "o" to {cga.alphabet::*}
add "p" to {cga.alphabet::*}
add "q" to {cga.alphabet::*}
add "r" to {cga.alphabet::*}
add "s" to {cga.alphabet::*}
add "t" to {cga.alphabet::*}
add "u" to {cga.alphabet::*}
add "v" to {cga.alphabet::*}
add "w" to {cga.alphabet::*}
add "x" to {cga.alphabet::*}
add "y" to {cga.alphabet::*}
add "z" to {cga.alphabet::*}
command /codegenapi [<text>] [<text>] [<text>] [<text>] [<text>]:
executable by: console
trigger:
if arg 1 is "generate" or "gen" or "g":
if arg 2 is "key" or "k":
if arg 3 is not set:
broadcast "{@P} A Skript just tried to create an API key for CodeGenAPI, however it failed to give its name"
else:
loop 100000000 times:
set {_type1} to a rounded random integer between 1 and 10
set {_type2} to a rounded random integer between 1 and 10
set {_type3} to a rounded random integer between 1 and 10
set {_type4} to a rounded random integer between 1 and 10
set {_type5} to a rounded random integer between 1 and 10
set {_type6} to a rounded random integer between 1 and 10
if {_type1} is equal to 1 or 3 or 5 or 7 or 9:
set {_char1} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char1} to {cga.alphabet::%{_rand}%}
if {_type2} is equal to 1 or 3 or 5 or 7 or 9:
set {_char2} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char2} to {cga.alphabet::%{_rand}%}
if {_type3} is equal to 1 or 3 or 5 or 7 or 9:
set {_char3} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char3} to {cga.alphabet::%{_rand}%}
if {_type4} is equal to 1 or 3 or 5 or 7 or 9:
set {_char4} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char4} to {cga.alphabet::%{_rand}%}
if {_type5} is equal to 1 or 3 or 5 or 7 or 9:
set {_char5} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char5} to {cga.alphabet::%{_rand}%}
if {_type6} is equal to 1 or 3 or 5 or 7 or 9:
set {_char6} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char6} to {cga.alphabet::%{_rand}%}
set {_code} to "%{_char1}%%{_char2}%%{_char3}%%{_char4}%%{_char5}%%{_char6}%"
if {cga.codelist::%{_code}%} is not set:
set {cga.codelist::%{_code}%} to {_code}
set {cga.%arg 3%.code} to {_code}
broadcast "%arg 3% %{_code}% %{cga.%arg 3%.code}%"
exit
else if arg 2 is "code" or "c":
set {_key} to arg 3
if arg 3 is not set:
broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but failed to supply its API Key"
else if {cga.codelist::%{_key}%} is not set:
broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but the API Key given doesn't exist"
else if {cga.codelist::%{_key}%} is set:
if arg 4 is set:
loop 100000000 times:
set {_type1} to a rounded random integer between 1 and 10
set {_type2} to a rounded random integer between 1 and 10
set {_type3} to a rounded random integer between 1 and 10
set {_type4} to a rounded random integer between 1 and 10
set {_type5} to a rounded random integer between 1 and 10
set {_type6} to a rounded random integer between 1 and 10
if {_type1} is equal to 1 or 3 or 5 or 7 or 9:
set {_char1} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char1} to {cga.alphabet::%{_rand}%}
if {_type2} is equal to 1 or 3 or 5 or 7 or 9:
set {_char2} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char2} to {cga.alphabet::%{_rand}%}
if {_type3} is equal to 1 or 3 or 5 or 7 or 9:
set {_char3} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char3} to {cga.alphabet::%{_rand}%}
if {_type4} is equal to 1 or 3 or 5 or 7 or 9:
set {_char4} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char4} to {cga.alphabet::%{_rand}%}
if {_type5} is equal to 1 or 3 or 5 or 7 or 9:
set {_char5} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char5} to {cga.alphabet::%{_rand}%}
if {_type6} is equal to 1 or 3 or 5 or 7 or 9:
set {_char6} to a rounded random integer between 1 and 9
else:
set {_rand} to a rounded random integer between 1 and 26
set {_char6} to {cga.alphabet::%{_rand}%}
set {_code} to "%{_char1}%%{_char2}%%{_char3}%%{_char4}%%{_char5}%%{_char6}%"
if {cga.%{_key}%.list::%{_code}%} is not set:
set {cga.%{_key}%.%arg 4%.code} to {_code}
set {cga.%{_key}%.list::%{_code}%} to {_code}
stop loop
else:
broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but failed to give a unique identifier"
```