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:

The Win Machine

The Road to Hell is Paved with Intervention ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏    ...

Contact Form

Name

Email *

Message *