Sample Code Section
Any Code you have produced for MDScript
19 topics in this forum
-
Guidelines for posting Sample code 1. Make sure it works, its no point adding code that doesnt work. 2. Always use Php Blocks, It makes it easier, See example below [code][php] post your MDScript code between these tags [/php][/code] This will appear as [php] post your MDScript code between these tags [/php] 3. Comments - Even if the code is really simple, add comments, this will help people understand it better
-
- 0 replies
- 1.7k views
-
-
This is the basis of a dynamic driven clickable, buttons! sample code: html: <form method='post'> <input type="submit" name='button' value="Go!"/> </form> MDScript: (locations [Whatever location the clicky is in]) echo @content[0]; if (@input['button'] == 'Go!') { echo "you pressed the button"; }else{ echo "You havent yet pressed the button!"; } Here you have a button and a form, when you press this the "data" is sent to the page again. This data is a associative value, meaning that you have a name that is associated with a value. In this case, all the "name"'s of the objects are associated with their val…
-
- 1 reply
- 1.8k views
-
-
This thread duplicates one in private club, Quest Creators. I have written the attached code so that anybody with minimal or no coding experience (and access to clickie coding) can create quests that take advantage of clickies with keys. Let everybody else know how it works for you in this thread. Questions anybody? Happy to help customize, or add more generic features for future quest creators. Fyrd’s Generic Quest Code v2.docx
-
- 0 replies
- 1.8k views
-
-
First off, I do intend to clean up this post a bit later and make the tool a bit more usable, but that will have to wait until I'm not asleep. First up, the sane code. Looks like pretty normal PHP to me. <? (locations 1_-1x3_1) // This is the key we give the user. $MDS_Key = "iab-quiz-key"; // This is the key used for the storage. $Storage_Key = "iabTestKey"; // All answers should be stored lowercase. $Questions = array( 1 => array( "What is this?", "clicky" ), 2 => array( "Who made this?", "orvid" ) ); // List of users who have completed the quiz. $usersFinished = mds_storage($Storage_Key, "toau", array()); if (uv("name") == "Orvid") { if …
-
- 0 replies
- 2.2k views
-
-
This little piece of simple code stores the date in @va and then prints it. There is no input and there is output. [php] (locations 1_0x0_1) //store today's date in @va @va[1]['date']['day'] = date('d'); //store day @va[1]['date']['month'] = date('m'); //store month @va[1]['date']['year'] = date('y'); //store year //print date from @va echo @va[1]['date']['month'] . "/" . @va[1]['date']['day'] . "/" . @va[1]['date']['year'] . "<br />"; echo "m/d/y"; [/php] For example, what the output would look like today is
-
- 0 replies
- 1.5k views
-
-
Add allowed ID's into the array, once the quest is finished it gives the "end key" to prevent a user from starting it again. Could be done using a storage but that would require a complex interface, in my opinion this is a simple and clean solution. [code] @vz = "rendrilrevant-";//define your key prefix @va = array(123451,1214,6326,23423,6342,23089);//array that holds ID's of those you will allow //check if user's ID is in the array and that they don't hold the end key if(in_array(uv('id'), @va) && (!mds_has_rpcq_keys(@vz . "end-key"))){ echo @content[1]; } else{ echo "You do not have access to this quest."; } [/code]
- 12 replies
- 3k views
-
[b]Content [/b][html] You're in the right location, here's a cookie!<br/> <!-- content separator --> You are not allowed to view this from here!!<br /> [/html] [b]<< MD-PHP Script >>[/b] [code] (locations 1_0x0_1) if (uv('location') == '1_0x0_1') { //checks the location the player is at and matches it against where they should be echo @content['0']; //if they're in the correct place, it displays the first content te xt } else { echo @content['1']; //if they're in a different place, it displays the second content te xt } [/code] You can modify this with keys and such to ban people from the quest if they try and use …
-
- 7 replies
- 2.6k views
-
-
Forms comprise of two parts. The actual form, and the processing Code Here is my form <form method="post" action=""> Please type something in here: <input type=text name="box" size="25" maxlength="50"> <br /> Do you use GGG? <input type="radio" name="radio" value="use"> yes <input type="radio" name="radio" value="dont use"> no <br /> Pick some of these, you choose! <input type="checkbox" name="checkbox_1" value="1"> one <input type="checkbox" name="checkbox_2" value="2"> two <input type="checkbox" name="checkbox_3" value="3"> three <br /> Are you a... <select name="listbox"> <option value="…
- 7 replies
- 3.7k views
-
For heat votes, you can use a simple one line piece of code to sort heat voters into heat given in desending order [CODE] @vb = mdsi_item_heat(); arsort(@vb['players']); [/CODE] This assumes that your heat variable has been assigned to @vb as in the example. When printing the information out with this format, it will produce it in an ordered format [code] foreach(@vb['players'] as @vk => @vh){ echo @vk . ': ' . @vh . '<br />'; } [/code] its nicer to show those who have given the most heat at the top than rather the first people who visited the clicky Comments and questions can go on this post
- 8 replies
- 2k views
-
This is not sample code, it is just a note on a possible quest concept i was thinking. by using uv(location) on an item, to determine someones current location, you could create a list of locations and based on that you could return a message like "you are getting close" or a direction indication like "go left until you find a tree". In this way you could create items like a compass that will point you to a predefined location the editor picks, or quests like treasure hunting. If you combine this with the storage and the date functions you could for example ask someone to find the propper place for some seeds to grow, considering soil, light or anything else you want.…
- 3 replies
- 3.1k views
-
This script will log a user's progress through various parts of a quest. In this example we store the user's name, their age at the time of completing the stage, the MD day that it was completed and the current progress. Note that anything can be kept in a storage, and here it is done with array. It would be better to store the timestamp rather than only a day but I keep it simple for the sake of demonstration. When picking a storage name, make it descriptive and try to reuse where possible. Storage type depends on your needs for the quest, in most cases it will be aoau or toau. [code]@vi = 123456790;//your ID, see the limiting access to a quest by id thread for mo…
- 10 replies
- 2.5k views
-
This is a topic for the more useless sample scripts, be sure to give credit to the original creator, as well as post a link to where the *useless* script was originally so the admins can delete that post, and admins, after deleting the post containing the *useless* script, please edit the post on this topic and remove the link.
- 5 replies
- 2.4k views
-
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 lef…
-
- 3 replies
- 1.8k views
-
-
this topic can now be deleted because it has been moved to the *useless* script topic.
-
- 0 replies
- 1.5k views
-
-
[code]// first object @vd = time(); // gets time in seconds and sets it to a variable store(@vd); // stores the variable into whever ------------- // object two retrieve(@vd); // Gets the time we stored in object one if((@vd + 10 * 60) < time() ){ // first it gets the first time, and adds 10 * 60 onto it (which is 10 minutes) then // compares it with current time. If current time is bigger than the sum you calculated // then it will be over the 10 minutes and it displays the apropiate text echo "sorry you are too slow"; }else{ echo "you win the game!"; }[/code] time() will retrive the current time (for more techincal people its actually a uni…
- 6 replies
- 2.2k views
-
As i had to find out, you can only do a limited number of things with if-functions, so here is some very basic switch that allows to make basically infinte different events happen in the same item, and with the same activator: [php]@vc=date('z'); @vd=@vc%7+3; //mod-calculation //echo @vd; <-- used for test purposes, to see if mod and the cases work right //echo"<br>"; switch (@vd) { //switch-operator searches for the right case and does the things you told it to do, in this case just echo case 7: echo "monday";break; // always use 'break;' at the end of the case, else you will get all cases after the right one showing up!! case 8: echo "tuesday"; b…
-
- 1 reply
- 1.5k views
-
-
Simply gets a random number and outputs the quest info. [php] @vb = rand(1, 4); echo @content[@vb]; [/php] Gives/removes a key depending on certain event [php] @vz = "rendrilrevant-";//define key prefix //make sure user cannot retrigger the events if(!mds_has_rpcq_keys(@vz . "random-event-triggered")){ @vb = rand(1, 4);//generate random number from 1 to 4 inclusive if(@vb == 2)//event in case of 2 { mds_give_rpcq_keys(@vz . "second-event-key"); } else if(@vb == 3)//event in case of 3 { mds_remove_rpcq_keys(@vz . "third-event-key") } mds_give_rpcq_keys(@vz . "random-event-triggered"); echo @content[@vb];//display event's content } else { ech…
-
- 0 replies
- 1.6k views
-
-
A game of roll the dice against a gambler Content: [code] <br/>Roll the dice, winning is nice <!-- content separator --> [[name]] rolled<br />[[di1]] and [[di2]]<br />Total: [[sum]] [/code] [code] @vp = array(rand(1, 6), rand(1, 6));//create player's dice rolls @vg = array(rand(3, 6), rand(2, 6));//create gambler's dice rolls and give him a slight advantage @vs[0] = @vp[0] + @vp[1];//sum of player's rolls @vs[1] = @vg[0] + @vg[1];//sum of gamberl's rolls @vk = 0;//intialize player counter, could support more players in the game @tpl = array();//amke sure @tpl is clear //assign values to @tpl @tpl[@vk]['di1'] = @vp[0]; @tpl[@vk][…
-
- 0 replies
- 1.7k views
-
-
This code will allow the user the recieve the "Noon Key" only at midday. [code] @vz = "rendrilrevant-";//the key prefix to use if(mds_has_rpcq_keys(@vz. "noon-key")){//check if the player is carrying the key already echo "The Sun smiles upon you, you are carrying the Noon Key"; } else { //check that the current time is between 11:30 and 12:30 if(time() > mktime(11, 30, 0, date("m") , date("j"), date("Y")) && time() < mktime(12, 30, 0, date("m") , date("j"), date("Y"))) { mds_give_rpcq_keys(@vz . "noon-key"); echo "Rays of light shimmer across the water, materialising into the Noon Key.<br/&…
-
- 0 replies
- 1.5k views
-
Member Statistics
- 4581 Total Members
- 936 Most Online
-
services Newest Member ·
Forum Statistics
- Total Topics 17.5k
- Total Posts 182.2k