arCABAL | 2017-11-20 13:55
arCABAL GRUB type generator
points ]
 (3 votes)
Script to generate text geometry in a sauerbraten map by simply typing that text into a command.

arCABAL GRUB type generator
for Cube 2 Sauerbraten

Gif of the script in action

Script to generate text geometry in a sauerbraten map by simply typing that text into a command.
Based on cube2_typegen by Nyne.
The font used in this script is part of GNU GRUB, licensed under the GPLv3.

- both uppercase and lowercase characters
- punctuation marks
- letters with diacritics
- uppercase and lowercase cyrillic font
- compatible with Linux, Windows, and Mac OS

- Extract the content of into your sauerbraten directory and press accept if asked to confirm merging the packages folder
On Linux this is ~/.sauerbraten
On Windows 7 and 10 this is C:\Users\%username%\Documents\My Games\Sauerbraten
On an Apple Mac it is most likely macHD/users/%username%/library/Application Support/sauerbraten/
- add the following line to your autoexec.cfg inside your sauerbraten directory
exec agtg.cfg

In edit mode, select the right face of a cube pointing towards one specific direction. See the included agtg.png to see which, and move back so all generated text will appear in your field of vision.
If you don't do this the generated text will be truncated to the part which can be generated in your view as you can only edit in sauerbraten on things which are inside your field of view.
You probably want to use the smallest grid size but bigger text is also possible. with the right face of the cube selected, enter this command:

/agtg Hello World!

as you can see, you don't need to put double quotes "" around your input. However, if you want to generate text with characters which are interpreted by cubescript,
you do have to put double quotes around your input and escape some characters. Characters which mess up up the input are: ^;()[]"
You can escape these characters with a ^ in front. So for example, if you want to generate this string:
this is a string with a ] and a ; but which can still be generated.
you would use:
/agtg "this is a string with a ^] and a ^; but which can still be generated"

These are all the characters which you can generate. I believe they are also all the characters you can type into the game but let me know if I missed any and I will add them.
?1234567890!@#$%^&*()`-=~_+[]\{}|;':^",./<> ßabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZáàäâãåčďéèëêěíìïîñňóòöôõøřšťúùüûůýÿžœæ
tip: you can paste text into the game using clients which use SDL2

font selection:
I've included two fonts in the package. The first font, grubfont, is floating cubes forming the characters of the font. The second font, grubfontbbg (grub font black background),
is the same font but with black cubes around them forming a background. It is generally better to use grubfont to minimalize the wtr of your map.

you can select a font using /agtgfont nameofthefont
so that is one of those two for now:
/agtgfont grubfont
/agtgfont grubfontbbg

you can autocomplete the font selection with tab.

if you want to add your own font, you have to add another folder to your packages folder and use the savebrush command to save each character as a .obr file.
For every character, select it and for example for the letter a, use:
/savebrush yourfontname/a.obr
Use the same filenames as used in grubfont and add your fontname on line 13 of agtg.cfg so agtgfont selection can tab autocomplete it

edit: I seem unable to add the zip file here. Grab the files from github instead:

// arCABAL GRUB Type Generator for Cube 2 Sauerbraten 2017
// Based on cube2_typegen by Nyne.
// The font used in this script is part of GNU GRUB, licensed under the GPLv3.
// See the included readme file for more info and how to use.
agtgfont =  [if $numargs [selectedfont = $arg1; echo "^f9selected agtg font =^f3"$selectedfont ] [echo "^f9selected agtg font =^f3"$selectedfont]]		

listcomplete agtgfont [


]; selectedfont = "grubfont"  // by default.

characterlist = [

"?" "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "!" "@" "#"			// symbols
"$" "%" "&" "*" "(" ")" "`" "-" "=" "~" "_" "+" "[" "]"
"\" "{" "}" "|" ";" "'" ":" "," "." "/" "" "ß" " "

"a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m"			// lowercase
"n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" 

"A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M"			// uppercase
"N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"

"á" "à" "ä" "â" "ã" "å" "č" "ď" "é" "è" "ë" "ê" "ě"			// diacritics lowercase
"í" "ì" "ï" "î" "ñ" "ň" "ó" "ò" "ö" "ô" "õ" "ø" "ř"
"š" "ť" "ú" "ù" "ü" "û" "ů" "ý" "ÿ" "ž" "œ" "æ" 

"Á" "À" "Ä" "Â" "Ã" "Å" "Č" "Ď" "É" "È" "Ë" "Ê" "Ě"			// diacritics uppercase
"Í" "Ì" "Ï" "Î" "Ñ" "Ň" "Ó" "Ò" "Ö" "Ô" "Õ" "Ø" "Ř"
"Š" "Ť" "Ú" "Ù" "Ü" "Û" "Ů" "Ý" "Ÿ" "Ž" "Œ" "Æ"

"a" "б" "в" "г" "д" "е" "ё" "ж" "з" "и" "й" "к" "л"			// ru lowercasse
"м" "н" "о" "п" "р" "с" "т" "у" "ф" "х" "ц" "ч" "ш"
"щ" "ъ" "ы" "ь" "э" "ю" "я" "ґ" "ї" "є"

"A" "Б" "В" "Г" "Д" "Е" "Ё" "Ж" "З" "И" "Й" "К" "Л"			// ru uppercase
"М" "Н" "О" "П" "Р" "С" "Т" "У" "Ф" "Х" "Ц" "Ч" "Ш"
"Щ" "Ъ" "Ы" "Ь" "Э" "Ю" "Я" "Ґ" "Ї" "Є"



characterreplacementlist = [

"questionmark" "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "!" "@" "numbersign" "$" "percent" "ampersand" "asterisk" "(" ")" "`" "-"
"=" "tilde" "underscore" "+" "[" "]" "backslash" "openbrace" "closebrace" "verticalbar" ";" "'" "colon" "," "period" "slash"
"lessthan" "morethan" "eszett" "space"








uppercasealphabet = [

"A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"

"Á" "À" "Ä" "Â" "Ã" "Å" "Č" "Ď" "Đ" "É" "È" "Ë" "Ê" "Ẽ" "Ě" "Ē" "Í" "Ì" "Ï" "Î" "Ĩ" "Ñ" "Ň"
"Ó" "Ò" "Ô" "Õ" "Ö" "Ø" "Ř" "Š" "Ť" "Ü" "Ú" "Ù" "Ũ" "Û" "Ů" "Ý" "Ÿ" "Ž" "Œ" "Æ"

"A" "Б" "В" "Г" "Д" "Е" "Ё" "Ж" "З" "И" "Й" "К" "Л" "М" "Н" "О" "П" "Р" "С" "Т" "У" "Ф" "Х" "Ц" "Ч" "Ш" "Щ" "Ъ" "Ы" "Ь" "Э" "Ю" "Я" "Ґ" "Ї" "Є"


doublequotes = (concatword "^"")
caret = (concatword "^^")

agtg = [									// function declaration
local coninput character characterindex charactername
coninput = (loopconcat i $numargs [concatword $[arg@(+ $i 1)] ""])		// concatenate input arguments into one big string which is then parsed by script to allow input without doublequotes
echo (concatword "^f6agtg " "^f3" $selectedfont ": ^f2" $coninput)		// echo string that will be generated
loop i (strlen $coninput) [     						// iterate over every character in the concatenated input. For every character..
    character = (substr $coninput $i 1)   					// put that character in a variable
    editface -1 1; delcube  							// extrude a cube outwards and move the selection with it, delete cube under selection
    characterindex = (indexof $characterlist $character)  			// get index of that character in character list above
    charactername = (at $characterreplacementlist $characterindex)		// replace the character with the name of the character (because windows filenames cannot include some special characters)

    if (=s $character (concatword "^"")) [					// fix for doublequotes character exception. If the character is a doublequotes..
        charactername = "doublequotes"

    if (=s $character (concatword "^^")) [					// fix for carot character exception, if the character is a caret..
        charactername = "caret"

//      if (= $character (strupper $character)) [				// if the character is not an uppercase character (doesn't work in vanilla sauer client)
    if (= (indexof $uppercasealphabet $character) -1) [				// if the character is not an uppercase character
        pastebrush (concatword $selectedfont "/" $charactername) ] [		// paste the *.obr file	
            pastebrush (concatword $selectedfont "/UPPERCASE/" $charactername)	// else paste the UPPERCASE/*.obr file


// differentiate between upper and lower case for windows
// if (= $letter (strupper $letter)) [echo "letter is uppercase"] [echo "letter is lowercase"] --strupper doesn't work in vanilla sauer client, using uppercasealphabet list lookup instead.
// add diacritic characters áàäâãåčďéèëêěíìïîñňóòôõöřšťüúùûůýÿžßœæ ÁÀÄÂÃÅČĎÉÈËÊĚÍÌÏÎÑŇÓÒÔÕÖŘŠŤÜÚÙÛŮÝŸŽŒÆ
// translation list for every character since a lot of characters can't be the name of a file

// charset =  1234567890`-=~_+[]\{}|;':",./<>?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZáàäâãåčďđéèëêẽěíìïîĩñňóòôõöřšťüúùũûůýÿžœæÁÀÄÂÃÅČĎĐÉÈËÊĚÍÌÏÎĨÑŇÓÒÔÕÖŘŠŤÜÚÙŨÛŮÝŸŽŒÆß
// aбвгдеёжзийклмнопрстуфхцчшщъыьэюя

 (3 votes)
User login
Users on Quadropolis
1 guest & no users online
Created 2024-06-02 22:13
3 weeks 3 days ago
Created 2024-06-02 14:26
3 weeks 4 days ago
Created 2024-04-11 22:25
10 weeks 6 days ago
points ]
 (4 votes)
Created 2010-05-30 10:00
14 years 4 weeks ago
points ]
 (4 votes)
Created 2020-10-22 00:50
3 years 35 weeks ago
points ]
 (1 vote)
Created 2024-02-11 21:20
19 weeks 3 days ago
points ]
 (1 vote)
Created 2023-07-23 20:02
48 weeks 4 days ago
points ]
 (4 votes)
Created 2020-12-10 12:49
3 years 28 weeks ago
Created 2023-12-12 23:34
28 weeks 1 day ago
Created 2023-11-27 23:00
30 weeks 2 days ago
points ]
 (2 votes)
Created 2023-10-01 15:21
38 weeks 4 days ago
points ]
 (2 votes)
Created 2021-05-24 00:01
3 years 5 weeks ago
points ]
 (1 vote)
Created 2023-06-13 17:54
1 year 2 weeks ago
points ]
 (3 votes)
Created 2023-05-05 20:58
1 year 7 weeks ago
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 16 weeks ago
Created 2023-01-29 23:27
1 year 21 weeks ago
Created 2023-01-19 19:36
1 year 22 weeks ago
Created 2023-01-10 17:10
1 year 24 weeks ago
Created 2023-01-01 14:30
1 year 25 weeks ago
points ]
 (1 vote)
Created 2023-01-01 10:58
1 year 25 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86