Jump to content

samon

Member
  • Content Count

    508
  • Joined

  • Last visited

  • Days Won

    18

Reputation Activity

  1. Upvote
    samon got a reaction from DARK DEMON in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  2. Upvote
    samon reacted to Chewett in MD's "Believe it or not"   
    A super secret project is defined as one dst doesn't know about
  3. Upvote
    samon got a reaction from Blackshade Rider in grade 4 clicky edit   
    I made a very basic tutorial a while ago. It is far from complete (I have been planning on making a follow up) but should be able to help you get started. If there is anything in there that is unclear please do tell me so I can improve it :)
     
    http://magicduel.invisionzone.com/topic/16837-a-step-by-step-introduction-to-mdscript-for-absolute-beginners/#entry168233
     
    Edit: Also, this probably belongs in the general MDScript discussion section.
  4. Upvote
    samon reacted to Rophs in MD Awards 2015 - Categories   
    Most Improved Player
    The player that the community things has grown the most in the past year. This can be a rookie who set feet on the ground quickly and got walkin' or an oldie who had been inactive but picked up a lot of momentum and did some cool things.
  5. Upvote
    samon got a reaction from MaGoHi in Audio for your Personal Page   
    Please remove the "autoplay" from the first line. Nothing as horrific as randomly being attacked by music.
     
    Also, there is no bold text in here, instead you should replace the part after "src="
  6. Upvote
    samon got a reaction from MaGoHi in Audio for your Personal Page   
    Not at all :) feeling a bit snarky myself as well, so I can fully understand where that was coming from.
     
     
    The bold is a reference to "<!-- the bold text is where your audio link goes to, this is currently a german internet radio -->". So unless you want to force your love for German radio (the irony) onto the rest of the world, you'll have to change the value of src into something else like:
    <audio id="player" autoplay loop src="http://remix.media.nin.com/data/uploads/1207088558g939.mp3"></audio> EDIT:
    By the time I found the song, it was already too late. Also realized that the most likely bold disappeared with the addition of the code tags.
  7. Upvote
    samon reacted to MaGoHi in Audio for your Personal Page   
    This is a tutorial (or should be one) on how you add Audio to your Personal Page.

     
    Audio Player with Volume slider:
    <audio id="player" autoplay loop src="http://87.118.116.61:8010/;"></audio> <!-- the part after src= within the quotation marks is where your audio link goes to, this is currently a german internet radio --> <!-- if you dont want the music to start on its own remove the word "autoplay" in the line above --> <div align="center"> <!-- this div is for the position of the control buttons --> <button style="background-color:transparent; height: 45px; width: 45px; border-radius: 45px;" onclick="document.getElementById('player').play()"><b> > </b></button> <!-- this is the Play button --> <button style="background-color:transparent; height: 45px; width: 45px; border-radius: 45px;" onclick="document.getElementById('player').pause()"><b>| |</b></button> <!-- this is the Pause button --> <!-- you can change the shape and color of the buttons as you wish --> <b>Vol.</b> <!-- this is just plain text to let people know that the slider is to control the volume, you can delete this line if you want to --> <input type="range" style="background-color:transparent; width: 100px;" min="0" max="1.0" value="0.5" step="0.01" oninput="setVolume(value)"/> <!-- this is the slider element used to control the volume i recommend using 0.5 as start value that means 50% of the musics volume, because 1.0 respectively 100% is just too loud and will make people instant close your personal page in case you dont want to have the slider you can remove that too, if you do you have to set the volume differently in the "script" part below --> </div> <!-- this div closes the position of the control buttons --> <div align="center"><sub>i do not own the song</sub>&nbsp; <br /></div> <!-- this is just a disclaimer --> <script> <!-- in this script you can find the function that is needed to make the volume slider work --> function setVolume(volume) { document.getElementById('player').volume = volume; } <!-- if you deleted the volume slider use "document.getElementById('player').volume = 0.1;" instead of "function setVolume(volume){...}" above --> <!-- you can vary between 0 and 1.0 to adjust the volume --> </script> The following code is the Player with Images as Play and Pause button, the volume on this one is only adjustable in the code in the "script".
    <audio id="player" autoplay loop src="http://87.118.116.61:8010/;" ></audio> <!-- the part after src= within the quotation marks is where your audio link goes to, this is currently a german internet radio --> <!-- if you dont want the music to start on its own remove the word "autoplay" in the line above --> <div align="center"> <!-- this div is for the position of the control images--> <!-- you can change the src to the link of the pictue that you want to have as your buttons, they are just random buttons of the internet atm --> <!-- you can change the size of the images by changing the width and height --> <img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRxBh85zIsS7jwS7ZsEiRm34iHYiXBBjjknB0QtfrrurJRKlTQDsCpF1Gg" width="50" height="50" onclick="document.getElementById('player').play()" > <!-- this is the Image used as Play button --> <img src="https://image.freepik.com/free-icon/pause-button-outline_318-40569.png" width="50" height="50" onclick="document.getElementById('player').pause()" > <!-- this is the Image used as Pause button --> </div> <!-- this div closes the position of the control buttons --> <script > <!-- in this script you can set the volume --> document.getElementById('player').volume = 0.1; <!-- you can vary between 0 and 1.0 to adjust the volume --> </script> if you have any questions feel free to ask me or use google :D
     
    greetings Mag
     
    EDIT:
    added second version of the player with images as buttons, without slider and steady Volume restatement
  8. Upvote
    samon reacted to MaGoHi in Audio for your Personal Page   
    1.)wrote another comment on how to remove autoplay, if you use the code reasonably you will set the volume to 0.5 or 0.1 as i commented above and thus wont attack you
    2.) i rewrote that part for the link the bold format got removed on its own
     
    thank you for your suggestions
  9. Upvote
    samon got a reaction from dst in Audio for your Personal Page   
    Please remove the "autoplay" from the first line. Nothing as horrific as randomly being attacked by music.
     
    Also, there is no bold text in here, instead you should replace the part after "src="
  10. Upvote
    samon got a reaction from Rophs in Audio for your Personal Page   
    Please remove the "autoplay" from the first line. Nothing as horrific as randomly being attacked by music.
     
    Also, there is no bold text in here, instead you should replace the part after "src="
  11. Upvote
    samon got a reaction from Assira the Black in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  12. Upvote
    samon got a reaction from Nimrodel in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  13. Upvote
    samon got a reaction from MaGoHi in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  14. Upvote
    samon got a reaction from Ungod in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  15. Upvote
    samon got a reaction from Lintara in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  16. Upvote
    samon got a reaction from No one in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  17. Upvote
    samon got a reaction from Myth in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  18. Upvote
    samon got a reaction from Azull in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  19. Upvote
    samon got a reaction from Jubaris in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  20. Upvote
    samon got a reaction from Chewett in A step by step introduction to MDScript for absolute beginners   
    For many people who want to make a quest coding is a big hurdle. This tutorial is made to teach all needed to make simple quests in an easily understandable way.
     
    The tutorial covers displaying text, reading out user input and saving progress using keys. The result of the tutorial can be seen at the signs at the MBP and at Willow's shop using the keyword secret pass word.

    In order to make a clicky quest you need to have unlocked the ability to edit clickies. This can be purchased using your third WP, but is also occasionally given out to those deemed worthy.


    Step 1: Displaying text
    You can edit a clicky by opening it and clicking on the "edit own" button. Now you will get a screen with 4 text fields: The Title field at the top, the content field at the left, the Script field on the right and the password field at the bottom. In the first step we are just going to display some text.

    This step is really easy. Simply paste the following text into the content field and press "save&compile".
    Hello cube! This is the first step. Now you should see your text appear on the screen. While you're at it feel free to add an awesome title and a secret pass word to prevent people from spying on you.

     
    Step 2: First code
    Now let's start coding. For security reasons you need to define from what locations you're allowed to run the script. Right above the code field is a sentence that says something like "Add location setting: (locations 1_0x2_1)" copy the final part including the brackets and paste it on the first line of the code field. Your code won't work without this, so you better don't forget to add it.

    If there is anything in the code field, the content is no longer automatically displayed. In order to output our text we use the print command, which outputs the following text to the user. In this case we want to output the text from the content box. This text is conveniently saved in the variable @content[0]. Finally the command should be ended with a semicolon which will give us the following code: (locations 1_0x2_1) echo @content[0]; Now save and compile to see your new page.
     
    Done? Then you might have noticed something strange; all the enters are gone! This is because your content is now seen as HTML and HTML ignores enters. Instead to add them you should surround each paragraph with <p> and </p>, which will give you the following content: <p>Hello cube!</p> <p>This is the first step.</p> For more on formatting your page take a look at W3Schools. MDScript uses only the part between <body> and </body>
     
    Step 3: Interaction
    Our quest is still a bit boring, so let's add some user interaction. We are going to ask if they are ready to start the quest; if they are we show them some text that will help the player move on to the next part. First I will give you the code and then I will explain what everything does.
     
    Add the following at the bottom of the content field: <p>So you want to become a code wizard?<p> <form method="post"> <input type="submit" name="wizard" value="Yes"/> </form> <!-- content separator --> <p>Then go to the sign at Willow's shop to start your training.</p> And add the following code to the bottom of your code field: if(@input["wizard"] == "Yes") {     echo @content[1]; } Almost all user input is done through forms, made by surrounding part of your content with <form method='post'> and </form>. In this case the page has one input field of type "submit", which is the code for a simple button. The value of the button contains the text on the button and is send back to the server along with the button's name.
     
    The <!-- content separator --> splits up our content in multiple parts so we can display them individually. @content[0] revers to the first part, @content[1] to the second etc.
     
    In our server code we can read out the user input using the @input variable. @input[<name>] contains the contains the value of the input field. In this case we look if @input["wizard"] is equal to "Yes". Only if that's the case, the code between the curly brackets is executed and we display the second content block.
     
    There are many other types of input on this page.
     
    Step 4: Progress
    You might have noticed that you have the Yes button again every time you open the page. While for the hint this isn't that bad, for our next riddle we don't want to trouble our questees with having to enter their answer again every time, so we're going to save their progress using keys.

    Below the content for the sign at Willow's shop: <p>The road to becoming a code wizard is hard, so let me test you.</p> <form method="post"> <p>What is 1 + 1? <input type="text" name="answer"/><input type="submit" value="Answer"/></p> </form> <!-- content separator --> <p>Exactly! 1 + 1 = 10, binary! Congratulations on completing your first steps to code wizardry.</p> <!-- content separator --> <p>I'm afraid that's not quite the answer I'm looking for.</p> <form method="post"> <input type="submit" value="Try again"/> </form> And the matching code: (locations 1_1x3_1) if(mds_has_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting")) { print @content[1]; } else {     if(isset(@input["answer"]))     {         if(@input["answer"] == "10")         {             print @content[1];             mds_give_rpcq_keys("SuperDuperSecretCodeKeyAboutBinaryCounting");         }         else         {             print @content[2];         }     }     else     {         print @content[0];     } } This might seem like a lot of code, but most of the code we have already seen. The only new thing in the content section is the text input field, which (as the name suggests) allows the user to input text.
     
    The code once again starts with the locations tag, followed by a check to see if the user already completed the riddle using mds_has_rpcq_keys(). If they did, we show them the 'completed' text, if not, we do some more checks.
     
    With isset() we check if there is a value in @input["answer"]. If not, that means the page was just opened and the user hasn't answered the riddle yet, so we show him the riddle. If it is set, we take a look at his answer; if it's correct, we use mds_give_rpcq_keys() to give the player a key.
     
    Some more about keys
    The exact value of the key doesn't matter, it could be "SuperDuperSecretCodeKeyAboutBinaryCounting" or it could be "cat". What does matter is that your key is unique, as everyone's code would be able to check or set your keys if they were able to figure them out. As such "cat" is probably not the best idea. Instead it is recommended that you add a prefix to your key that only you would be able to come up with. For more on keys (for example how to remove them) I suggest you take a look at the MDScript manual's Keys page.
     
    As an exercise I'll leave it to you to try and make it in such a way that the riddle won't be visible unless the player has pressed the Yes button in the park and to create a clicky that removes the key to allow you to start all over.
     
    And we're done!
    And with that you have your first quest. Sure it contains only one riddle, but with some creativity this is enough to make a full quest. Any comments, questions and suggestions are highly appreciated. If there is enough interest I might make another tutorial, either a continuation or something more advanced.
  21. Upvote
    samon got a reaction from dst in Scene Theme Challenge!   
    What secrets lay hidden in the book.
    [IMG]http://i1215.photobucket.com/albums/cc506/Samonus/MD%20helloween/helloweenscene.jpg[/IMG]

    Everything is either made in gimp or from MD.
  22. Upvote
    samon reacted to Ary Endleg in Ann 3649 - Torch Contest Master   
    The way I see it, those are rules Rophs would be putting in place if he is chosen to be Torch Master, basically his post is application for position the way I see it. Meaning that you guys can make your own rules and compete for spot.
  23. Upvote
    samon reacted to Eon in Demands of a Slave   
    Careful, comments like that just might bring me back.
  24. Upvote
    samon reacted to Aethon in MD DOWN FOR SERVER UPGRADE   
    [log=The Day MD Died]Day 1 since MD went down.
     
    It's only been a day but I can feel the tension in the air. People have been joking about it, but I know deep down they're all serious. I can see them shaking and giggling manically. Some manage to hold on to their sanity...others? I feel it may be too late for some...
     
    What will become of us? Of me?
     
    I fear that they may not last...I fear I may not last...
     
    Magicduel is Love....Magicduel is life.[/log]
  25. Upvote
    samon got a reaction from Kyphis the Bard in Automatic item creation.   
    Common items could be merged through the same means; the cauldron doesn't differentiate between resources and other items, and neither do other item combiners. Perhaps the archives could get a section with recipes used to combine common items.
     
    P.s. Magohi, add a link from water and branches to the teapot. :)
×
×
  • Create New...