October 29, 200916 yr comment_46017 Presents player with two choices, picking one blocks them from accessing the other. There are many ways to do this, I used a single form with 2 input buttons. Could be made with a template and loops for some nice multi-tiered quests. Content: [code] <!-- content separator --> Two paths lie before you, going down one means you cannot retrace your steps and go down the other. <br />Which path will you take? <form method="post" action=""><br /><br /> <input type="submit" name="left" value="Go Left"/> <input type="submit" name="right" value="Go Right"/> </form> <!-- content separator --> You walk down the left path. A boulder crashes into the road from a cliff and lands behind you, blocking the way home. <!-- content separator --> Walking over the bridge on the right, you feel it crumbling under you and dash to the other side. The bridge is broken and you move on. <!-- content separator --> The way back is blocked. [/code] Code: [code] @vz = "rendrilrevant";//the prefix to use for keys //check whether users holds either of the keys if(mds_has_rpcq_keys(@vz . "left-key") || mds_has_rpcq_keys(@vz . "right-key")){ echo @content[4]; } else{ //if a buttron is set, give relevant key and display details if(isset(@input['left'])){ mds_give_rpcq_keys(@vz . "left-key"); echo @content[2]; } else if(isset(@input['right'])){ mds_give_rpcq_keys(@vz . "right-key"); echo @content[3]; } else{ echo @content[1]; } } [/code] Report
October 29, 200916 yr comment_46089 [quote name='Rendril' date='28 October 2009 - 07:15 PM' timestamp='1256775331' post='46017'] Presents player with two choices, picking one blocks them from accessing the other. There are many ways to do this, I used a single form with 2 input buttons. Could be made with a template and loops for some nice multi-tiered quests. Content: [code] <!-- content separator --> Two paths lie before you, going down one means you cannot retrace your steps and go down the other. <br />Which path will you take? <form method="post" action=""><br /><br /> <input type="submit" name="left" value="Go Left"/> <input type="submit" name="right" value="Go Right"/> </form> <!-- content separator --> You walk down the left path. A boulder crashes into the road from a cliff and lands behind you, blocking the way home. <!-- content separator --> Walking over the bridge on the right, you feel it crumbling under you and dash to the other side. The bridge is broken and you move on. <!-- content separator --> The way back is blocked. [/code] Code: [code] @vz = "rendrilrevant";//the prefix to use for keys //check whether users holds either of the keys if(mds_has_rpcq_keys(@vz . "left-key") || mds_has_rpcq_keys(@vz . "right-key")){ echo @content[4]; } else{ //if a buttron is set, give relevant key and display details if(isset(@input['left'])){ mds_give_rpcq_keys(@vz . "left-key"); echo @content[2]; } else if(isset(@input['right'])){ mds_give_rpcq_keys(@vz . "right-key"); echo @content[3]; } else{ echo @content[1]; } } [/code] [/quote] this could be used to make an adventure of epic proportions time to get to work Report
November 2, 200916 yr comment_46365 [quote name='I am Bored' date='29 October 2009 - 07:36 PM' timestamp='1256844982' post='46089'] this could be used to make an adventure of epic proportions time to get to work [/quote] Using a form to set a button is great, but what I could really use is a form text box which can have the contents stored to an MD variable. The other question I have is when the example above is set, the MD script doesn't wait for the user to click a button, is submitting the form after clicking a button causing the MD script to refresh and run again with the button now set? Being able to have text input from a user would make just about anything possible. Cutler Report
November 2, 200916 yr Author comment_46375 Form text box can easily be done, you can use anything HTML has. I'll post an example using both <textarea> , <select> and maybe radio/checkbox. The thing to be careful of when accepting user-typed input is that it is safe for consumption, don't assume the user sent it correctly. Another note, allow a certain level of tolerance for the input, not all will make it the exact format you want and speaking from my own experience, I make typos on a constant basis. Once the button is pressed and the script loads again, it will have done so with the key in the user's possesion. For a simple text input try using just that [code] <input type="text" name="answer" /> [/code] Report
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.