GameMaker Studio 2.3+ library for word lookup in word games
This library contains two utility classes for word lookups commonly found in word games:
CheckWordDictionary
: Dictionary class for checking the validity of given words.PickWordDictionary
: Dictionary class for pulling random words out of a list.
These classes can then load word lists in batch from line-by-line text files, or one-by-one at runtime. To get you started, the library comes with two English language dictionaries.
- GameMaker Studio 2.3.3 or above
- Go to the Releases Page to download the latest YYMPS package.
- In GameMaker Studio, select Tools > Import Local Package, and select the downloaded YYMPS package.
- Add everything under
Libraries/GMDictionary
. - Depending on the way your project uses words, you may optionally add one of the dictionary lists under Included Files:
- Unfiltered set of English words from
dwyl/english-words
:dictionaries/full/full.txt
: The complete list of words.dictionaries/full_by_length/*.txt
: The list of words of a specific length.dictionaries/full_by_letter/*.txt
: The list of words starting with a specific letter.
- Filtered set of English words of lengths 3-12 from the legacy game Scramble SG by Gunther Serrano, plus 108 two-letter English words.
dictionaries/simple/full.txt
: The complete list of words.dictionaries/simple_by_length/*.txt
: The list of words of a specific length.dictionaries/simple_by_letter/*.txt
: The list of words starting with a specific letter.
- Unfiltered set of English words from
- Confirm the import by clicking Import. Note: If you intend to import into the current project, make sure that Import all resources to a new project is unchecked.
global.dictionary = new CheckWordDictionary(working_directory + "dictionaries/simple/full.txt");
var word = get_string("Enter a word:", "");
if (global.dictionary.check(word)) {
show_message("\"" + word + "\" is a valid English word.");
} else {
show_message("\"" + word + "\" is not a valid English word.");
}
global.dictionary = new PickWordDictionary([
working_directory + "dictionaries/simple_by_length/3.txt",
working_directory + "dictionaries/simple_by_length/4.txt",
working_directory + "dictionaries/simple_by_length/5.txt",
]);
var wordOfTheDay = global.dictionary.pick();
show_message("Your word of the day is \"" + wordOfTheDay + "\"");
var words = global.dictionary.pickN(10);
show_message("Your words are: " + string(words));