-
Images
-
Posts
612 -
Joined
-
Last visited
-
Days Won
11
Content Type
Profiles
Forums
Events
Gallery
Downloads
Everything posted by Rendril
-
To remove a key use mds_take_rpqc_keys("key name") He won't have access to your script.
-
Have a look at the manual for [url="http://magicduel.invisionzone.com/topic/5497-debugging-you-code/"]debugging your code[/url]
-
Burns, the asterisk will work in regular expressions but cannot find keys with anything behind them. It would be highly exploitable if it worked, you could scan the keys a player has, and given tem all to yourself, thereby giving yourself access to the quests the palyer is on. And in some cases, judging by the key name you could change it to give yourself multiple-path access. Not to mention it would show you access to MD itself. This is why there is no mds_get_all_keys() function
-
So Kafuuka, what you are proposing is to "label" the scripts which belong to a certain quest which allows you to delete them in one call? Storages would also need ot be given a label which corresponds to the script's label, so that the garbage collector knows to take it down too. The problem with keys is that they are not editor-specific, in other words 2 people could be using a key of the same name (that is why I suggest using key prefixes in all your code) how would the cleanup know which ones to take? IAB, if you are using echo to see what is inside the variable, rather use debug() It works incredibly well, especially on arrays.
-
That's exactly right Udgard. It all depends on how you want to set your quest, and you could even have multiple end keys RJ, I sent you a PM, I'm won't be on a for few hours though.
-
It should be fine to hold a key to determine their story path. Once they complete the quest/it has ended, be sure tou clean up all keys and you can give them a single "quest-ended" key so they can't start it up again, or remove that code too. You could also try using arrays in storages to manage progres,which would be more elegant, but much more complex. I'll write an example of the key cleanup when I get a chance.
-
I did not say it was an actual item. My point is that people will likely not part with it since it will cost them something (the possibility of getting the wp) If there had been no reward announcd, I think swapping would be more probable.
-
That's why browser's come with search functions. Try ctrl+f and "aotu" Maybe we can get to assign frame parameters before it is created, that way we specify height, borders, backgrounds etc instead of js workarounds.
-
The storages can have different types: ao = all objects. Refer to the script manual section for more info. Is this what you mean for between a certain ID range? [code] @vl = 1000;//lower bound @vu = 2000;//upper bound //check that user is is bewteen upper and lower bounds if((uv('id') > @vl)) && (uv('id') < @vu)) { echo "Your ID was within the correct range." } [/code] You might notice how the expressions are wraped in brackets when they usually wouldn't be, this is because the parser might get a restriction on "&@" and I find t jsut makes managing the order of precedence easier. I simply mashed my keyboard to generate different ID's for the arrays, take no notice of whether they are valid ID's. Maybe the script was written when ID 64 still existed
-
Strange, I just tested it and it works fine. Here it is without comments, see if that helps: [code] @vz = "rendrilrevant-"; retrieve(@vt); if(mds_has_rpcq_keys(@vz . "timer-started")) { @vd = floor((@vt - time())/60 / 60); echo "You only have " . @vd . " hours to sa"."ve the earth!"; } else { @vt = time() + (14 * 60 * 60); mds_give_rpcq_keys(@vz . "timer-started"); store(@vt); echo "You have 14 hours to sa"."ve the earth!<br />Run! Run like the wind!"; } [/code]
-
You could try with 4 seperate arrays: [code] @va = array(123451,1214,6326); @vb = array(4362,62,34737); @vc = array(1515,1231,2626); @vd = array(2752,1257,2579); [/code] Then build a specific if-block for each array, effectively copying the code fom the initial post 4 times. Storages do work across multiple items, that is the "ao" part of the types. As for showing capital letters, I suggest echo'ing out from the @content for now.
-
This sounds like a fun quest to me. I think there will be a problem however in the way to gain the items. For Udgard's item hunt quest I had people asking for ridiculous amounts of silver just to send a description/screen shot. It cost them nothing and they (not all, but many players) wanted payment, and in many case couldn't be bothered just to type it out or copy-paste it. This time they are expected to give up the item and possibility of gaining the WP. However, since we don't know [b]where[/b] the WP is (or do we?) people will hopefully be more willing to part with items. [color="#FFFFFF"]*Insert wishful thinking xD*[/color]
-
Nice code Chewett, but I think you mean @vh [b]+[/b] 10 * 60 Otherwise it would be checked in the next 6000 years or so Burns, regarding the scope of the storage. It will work for each user seperately, we are waiting for multiple types to be supported. Also you're right about the @vh needing to be @vd. This example performs the same logic checks as above and shows how to calculate the remaining time. It gives the user 14 hours to save the world. Object1: [code] @vz = "rendrilrevant-";//define key prefix retrieve(@vt);//get timer data //check if the player started the timer already if(mds_has_rpcq_keys(@vz . "timer-started")) { @vd = floor((@vt - time())/60 / 60);//get remaining time by subtracting current tiem from given time length echo "You only have " . @vd . " hours to sa"."ve the earth!"; } else { //calculate given tiem by adding 14 hours (50400 seconds) to current time @vt = time() + (14 * 60 * 60); //flag that timer has started mds_give_rpcq_keys(@vz . "timer-started"); //store time value store(@vt); echo "You have 14 hours to sa"."ve the earth!<br />Run! Run like the wind!"; } [/code] Object2 [code] @vz = "rendrilrevant-";//define key prefix //check if timer was started yet if(mds_has_rpcq_keys(@vz . "timer-started")) { retrieve(@vt);////get timer data //check if current time is less than or equal allowed time if(time() <= (@vt)) { //perform actions if successful mds_give_rpcq_keys(@vz . "world-sav"."ed"); echo "Well done you sav"."ed the earth!<br />Now go to something con"."structive."; } else { //perform actions if not successful mds_give_rpcq_keys(@vz . "world-not-sa"."ved"); echo "You were unable to sa"."ve the earth =("; } //clean up the timer key mds_take_rpcq_keys(@vz . "timer-started"); } [/code]
-
I think you will have to remove the text manually for now. Remember to do the appropriate garbage removal on keys and storages you don't need.
-
It should not be forcing you to echo any content if you don't want to. Have you tried something like this: [code] <!-- content separator --> content1 <!-- content separator --> content2 <!-- content separator --> content3 <!-- content separator --> content4 [/code]
-
[quote name='No one' date='29 October 2009 - 01:51 PM' timestamp='1256817117' post='46046'] Can you explain a bit the difference between the 2 and how to set them (if there is a difference).[/quote] The types are specified like this: [access level for objects][access level for users] So toau = this object all users and aoau = all objects all users. I could be mistaken but this is how I understand their uses. toau will allow the storage to only be accessed from the object it was created on but will have the data available to all users that access it. aoau allows all objects to to share the storage and all users to have access to the data as well. In a way, only the aoau is needed because you could limit the use through the script itself, it just makes our lives easier [quote name='No one' date='29 October 2009 - 01:51 PM' timestamp='1256817117' post='46046'] I'm waiting for a clean documentation no other interference from other players[/quote] Chewett organised it into sections last night in the script manual section. [quote name='No one' date='29 October 2009 - 01:51 PM' timestamp='1256817117' post='46046'] What happen with the items that you store ? is it removed from your inventory ? If so : POSSIBLE ABUSE: store creatures for yourself and get them back when they are aged. [/quote] Interesting point. Rather than storing the the creature in the clickable, I think it should use a direct transfer. Useage: transfer_creature(ctc, receiver) Returns true on successful transfer or a error code if it could not be done For example: 0 - Invalid CTC 1 - Receiving player creature slots full Yes, I could still be transfered to an alt but that is an issue with alt abuse, not the script. You could also include the giver as a parameter, that would minimize people using alts to store the creature and send a CTC off them. For transfering items, I think the items should has their own unique hashes to use for transfers, sending only be ID is too easy to forge. A handy fucntion would also be is_valid_ctc(ctc) [quote name='No one' date='29 October 2009 - 01:51 PM' timestamp='1256817117' post='46046'] If you really want to ... ok, but how will you check them ? By IP ? Do consider that you are not the only one that helped other players (used the other accounts for a limited time). Also, it was already discussed that the "alt police" is difficult and will raise a lot of problems.[/quote] I agree with you fully, there is simply no way of certainty or success without a level of human interaction. [quote name='No one' date='29 October 2009 - 01:51 PM' timestamp='1256817117' post='46046'] I think that it is possible for each "scripter" (person that writes a script) can create a log that can keep a trace of keys created / used on his scripts. BUT, it will be redundant to implement it by every "scripter". Somehow, there should be a way to track the script owner and key changes and then make the list available to the owner. As I don't know if it exists yet : if the function of "log of key / storage change" is already created, there can be a MDScript that can display all of them. I propose the MDScript for this as Mur will not want to change it for every new feature that he creates and a person like Rendril can modify it and improve it and could take care of all abuses. [/quote] I don't see the need for logs to be made by the script automatically (the server does make them to some level as with all use but forcing the script parser to generate and store into MySQL is not needed for every running script) Perhaps I am mistaken but I think it is easy enough to make a "log" template that one can use. I plan on making such an example once the access levels are fully functional. Rather than copying script over all the time however, I woudl like a way to "include()" template code. The base include() function itself is too dangerous, but maybe we can store reusable code in one place and simply send a call ofr it from elsewhere? I'm thinking along the lines of a string stored somewhere on MD server which has been run through the parser, you give it that code's identifier, it loads from server and prefixes it to the current code. I already know of a way in whch to do this but for constant use it is ineffective. [quote name='No one' date='29 October 2009 - 01:51 PM' timestamp='1256817117' post='46046'] PS2: Mur, prepare for next stage of MD features created by players [/quote] This is the intended direction, I can hardly wait [quote name='Grido' date='29 October 2009 - 03:33 PM' timestamp='1256823226' post='46052'] i admit i dont know php that much, but how does that give me a timer? as an e.g. say i wanted someone to figure out what the next step of the quest was within 30 mins after seeing the info. They would view clickable A and the info there, recieving the key as well, the info would lead them to clickable B, but if they hadnt got there in 30 minutes then they wouldnt be able to proceed, as the key wouldnt work after 30 minutes. Or i want the person to get there between 15 and 20 minutes after, or something [/quote] I'll add an example of a "timer" to the samples. It will pretty much work like the time-check example.
-
Your script output will always be in lowercase, this is in order to ensure security. The best way I can suggest to overcome this is put the text you want to display into the content section The uppercase/lowercase functions have not bee allowed, they would be a nice addiiton, although a pain to simply capitilise single letters repeatedly. It might be to preserve case integrity while still providing the protection. For now use the content section. @Udgard: I haven't seen the /safe place/ keywords, could you post the link?
-
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 { echo "You have already been here...move along." } [/php] Sometimes the user might want to retrace their steps to look for clues in the quest where they have been, in that case barring them from revisiting might not be the best choice. But this was a random event, better remember it next time
-
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]
-
@Mur: An alt check would be very useful but I think too invasive of a player's privacy. Not to mention it cannot guarentee accuracy. It would be too easy for the editor to make a script which stores a list of all participants and their alts. However, some might what to have a way of limiting alt use, how about a simple is_alt() fucntion (no parameters) it could still be used to compile a list but you won't know who the alt belongs to. If a mistake is made about a player being an alt, they can contact the editor and have an exception made for that particular ID? @Grido: You could use the storage to track both number of item uses and quest progress for a player. You can do either local item logging (toau) or a quest-wide log (aoau), I'm not sure if both types work yet. There is even a @log variable you can use as an array for it @RJ: Make a storage which holds an enable/disable. It can be changed on a quest event, using a timed trigger or even manually by the editor.
-
It depends on the HTML structure you output. Putting it into a new <table> for example, will not give the table's cells the storyline-text class. Can you post the conent and how you are echo'ing it? Its fine if you omit the actual story content, put anything in there as long as you how what kind of HTML you are displaying. My suggestion is use either MD's default CSS or write up your own. Remember that @content[0] will always be placed on the page, regardless of whether you echo it or not. It will also appear [i]after[/i] your code output. To avoid this, do not give any @content[0], start your content section from @content[1] instead
-
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]['di2'] = @vp[1]; @tpl[@vk]['name'] = uv('name'); @tpl[@vk]['sum'] = @vs[@vk]; ++@vk;//increment player counter @tpl[@vk]['di1'] = @vg[0]; @tpl[@vk]['di2'] = @vg[1]; @tpl[@vk]['name'] = "Gambler"; @tpl[@vk]['sum'] = @vs[@vk]; mds_template(@content[1],@tpl,false,2,'style="width:180;border:1px solid"');//call template function retrieve(@vd);//get the player's scorign array if(@vd == null)//check if the score were initialized yet, if not, initiliaze them @vd = array(0, 0, 0); //check for wins, losses or draws and increment appropriate counter if(@vs[0] > @vs[1]) { echo "You have won!"; @vd[0]++; } else if(@vs[0] < @vs[1]) { echo "You lost =("; @vd[1]++; } else { echo "It was a tie"; @vd[2]++; } store(@vd);//save the player's progress //output the score echo "<br/><br/>Your progress against the gambler<br/>"; echo "Wins: " . @vd[0] . "<br/>Losses: " . @vd[1] . "<br/>Draws: " . @vd[2]; [/code]
-
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/>You take the key and move on with your quest."; } else{ echo "You look into the pool of water and see only your own reflection.<br/>Words of the poem linger in your thoughts<br/><br/>\"<i>Only at the Sun's zenith will you see the light</i>\""; } } [/code]
-
Presents player with two choices, picking one blocks them from accessing the other. There are many ways to do this, I used a single form with 2 input buttons. Could be made with a template and loops for some nice multi-tiered quests. Content: [code] <!-- content separator --> Two paths lie before you, going down one means you cannot retrace your steps and go down the other. <br />Which path will you take? <form method="post" action=""><br /><br /> <input type="submit" name="left" value="Go Left"/> <input type="submit" name="right" value="Go Right"/> </form> <!-- content separator --> You walk down the left path. A boulder crashes into the road from a cliff and lands behind you, blocking the way home. <!-- content separator --> Walking over the bridge on the right, you feel it crumbling under you and dash to the other side. The bridge is broken and you move on. <!-- content separator --> The way back is blocked. [/code] Code: [code] @vz = "rendrilrevant";//the prefix to use for keys //check whether users holds either of the keys if(mds_has_rpcq_keys(@vz . "left-key") || mds_has_rpcq_keys(@vz . "right-key")){ echo @content[4]; } else{ //if a buttron is set, give relevant key and display details if(isset(@input['left'])){ mds_give_rpcq_keys(@vz . "left-key"); echo @content[2]; } else if(isset(@input['right'])){ mds_give_rpcq_keys(@vz . "right-key"); echo @content[3]; } else{ echo @content[1]; } } [/code]
-
Mur, I'm not sure what happened to the braces *cough*ide-messes-up-my-braces*cough* I agree with this completely, always put the braces in your code blocks. You will appreciate it in the long run I'll add them in a few minutes. Also I will fix the storage use when the functions are updated. Kafuuka, you raise a very important point. The cleanup is sorely lacking for both keys and storage. Yes, the empty storage removes itself but things like "tests" with data in them stay behind, I think a storage list which shows the names of your storages would be useful (even if you just get them in an array) For anyone interested in submitting code, please label it clearly and be descriptive about it. Commenting on your code is helpful but not a necessity. Send submissions in whatever way you can contact me (forum messages will be read but with much less frequency) Feel free to ask if you have any questions about the MDScript or would like help in writing something. I am not a php expert but I might be able ot shed some light. Are there any requests for a particular example? I will add sample code as I create it.