The main point is that coding is the last step, not the first step. In other words, if you approach writing a story by deciding to code, then you don't have a story at all, you just have some code. But if you do the opposite: decide on the story and then try and figure out how to make that happen via code, then you know what you want from the code and people can help you figure out how to do that.
Just saying you want to use code to use code means that we can help you like this:
Use IF THEN statements.
And that's it. Code, on this site at least, is used when you need a solution to something you're trying to write. If you want to write a dungeon explorer, start by making a map. Decide how the world will work. Decide on if there is combat and how it will work. Figure out if there are items and what they will do. Decide if there will be stats and what affect they will have on the game. Write up lots of descriptions of things.
THEN, when you can say, "Ok, I have a room and I want to make a secret door visible only when the person waves a wand, how can I do that?" Then people can really help you here!