You can see the discussion on it in the Holatuwol begins scripting thread
http://kolmafia.us/index.php/topic,752.15.html page two, about two-thirds of the way down the page. It goes farther than just unlocking, but I'm sure you can trim it down to meet your needs.
Wow, I'm stupid. Anyways, since I probably shouldn't make a separate thread for this, how would I read/write variables to, say, a separate .txt file? I'm making a script where I want it to change a few variables, and I want these variables to remain the same between uses.
Sounds like a good use for the ash functions set_property and get_property. It's a good idea to use some kind of prefix for your property names so you don't collide with any mafia defined properties.
Another way to do it would be to put your variables into a map and use the ash function that puts a map into a file. then use the the function that reads a file into a map to get the variables back.