gamemaker dictionary check

obj_dict

create event:

dictionary=ds_list_create();//create a ds list to hold words
dic_file=file_text_open_read("dictionary.txt"); //open text file with words
while(!file_text_eof(dic_file))//repeat until end of book


word=file_text_read_string(dic_file);//get next word
ds_list_add(dictionary,word);//add to ds list
file_text_readln(dic_file);//read to next line
}


step event:

word_to_find=get_string("word","");
position = ds_list_find_index(dictionary, word_to_find);
if position>0
{
show_message("Found");
}
else
{
show_message("Not Found");
}

No comments:

This will make you a better decision maker | Annie Duke (author of “Thinking in Bets” and “Quit”, former pro poker…

Annie is a former professional poker player, decision-making expert, author, and special partner at First Round Capital.  ͏     ­͏     ­͏   ...

Contact Form

Name

Email *

Message *