Jump to content

Rendril

Member
  • Content Count

    612
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Rendril

  1. [quote name='Shadowseeker' date='11 June 2010 - 07:36 AM' timestamp='1276234587' post='61621']
    Well, he should be able to do it..but the admin panel is broken.

    At least for me, and one other translator I asked, rendril.

    Any comments?
    [/quote]
    It's back up again, yours should be working too.

  2. The same applies to many of my scripts, and clickables like the book of ancients, oak stories, hanging of mur etc.
    Having the option of making a clickable permanent would defeat the purpose of the auto-hide, who can justify their script being permanant without it having to be judged by Mur?
    I would rather have it auto-hide if the script's last use was 14 days ago, which in effect means nobody accessed in that time, of course "last use" needs to be more than merely viewing the clickable.

    I think allowing a cron to be implemented for each script would cause too much of a load on the server and be easily abuseable but perhaps scripts can get a global cron (hourly, maybe daily run?) that we can schedule to.

  3. I'm in favour of all over Cutler's suggestions.

    [quote name='cutler121']
    2) Keep track of quest progress by having MDscript send a PM when a quest leg is completed.
    [/quote]

    A mail() function would be great, perhaps limit it so that it can only mail the scripter, rather than giving the ability to mail anyone.

    [quote name='cutler121']
    3) Give and take items from within MDscript (mainly I am thinking about silver coins) to help implement a more robust MD economy. (But WP and other items would be nice as well)
    [/quote]

    I brought this up a while ago for both item and creature transfers. I would love a function that can do it.
    The question is how to prevent abuse, whether it is an intended abuse or not.

  4. WP's can already be farmed by alts because of the broken pattern gazebo reward, but since they can't be transfered it is limited effect.
    1 per year is sufficient, it would take extreme tenacity just to bring an alt to a year of age only to try get a WP on it.
    It is great it alts can be prevented from it, but there are some alts with roles and purpose that are going on 2 years already, and they deserve the WP as much as the main account.

  5. [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 :D


    [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.

  6. @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.

  7. 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.

  8. Here is some sample code.
    Remember to remove the comments (some have script restricted words)

    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]

    A game of roll the dice agaisnt a gambler

    Content:
    [code]
    <br/>Roll the dice, winning is nice
    <!-- content separator -->
    [[name]] rolled<br />[[di1]] and [[di2]]<br />Total: [[sum]]
    [/code]

    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 is an example of a bank and market. Once the aoau type works and the creature/item transaction is added, it can become fully automated.

    [code]
    function transfer(@vi, @vv)
    {
    (prepare function)
    retrieve(@va);
    @va['bank'][@vi]['balance'] = @va['bank'][@vi]['balance'] + @vv;
    @va['bank'][@vi]['last_transaction'] = time();
    store(@va);
    return @va['bank'][@vi]['balance'];
    }

    function add_creature(){
    (prepare function)
    @vc = array();
    @vc['id'] = (int) @input['id'];
    @vc['name'] = @input['name'];
    @vc['ctc'] = @input['ctc'];
    @vc['price'] = (int) @input['price'];
    retrieve(@va);
    @va['market'][@vc['id']] = @vc;
    store(@va);
    }

    function buy(@vi)
    {
    (prepare function)
    retrieve(@va);
    @vc = @va['market'][@vi];
    @vb = transfer(uv('id'), -1 * @vc['price']);
    @va['market'] = take_creature(@va['market'], @vc['id']);
    store(@va);
    echo "Purchased the <b>" . @vc['name'] . "</b><br/>Account balance: <b>" . @vb . "</b><br/>CTC: <b><font color='red'>" . @vc['ctc'] . "</font></b><br/>Please store it immediatly";
    return @va;
    }

    function take_creature(@va, @vi)
    {
    (prepare function)
    @vn = array();
    foreach(@va as @vc){
    if(@vc['id'] != @vi)
    @vn[@vc['id']] = @vc;
    }
    return @vn;
    }

    echo @content[1];
    retrieve(@va);
    if(@va == null)
    {
    @va = array('market' => array(), 'bank' => array());
    echo "storage was null";
    }
    if(in_array(uv('id'), array(44582, 1028))){
    echo @content[2];
    if(@input)
    if(@input['action'] == "add_creature"){
    add_creature();
    @temp = count(@va['market']);
    retrieve(@va);
    if(@temp < count(@va['market']))
    echo "Creature was added to the market<br/>";
    else
    echo "Creature was not added<br/>";
    }
    else if(@input['action'] == "add_funds"){
    @vb = transfer(@input['id'], @input['amount']);
    echo "Current balance for <b>". @input['id'] ."</b> is <b>" .@vb. "</b>";
    }
    }
    if(isset(@input['buy_creature']) && (@input['cid']))
    {
    @va = buy(@input['cid']);
    }

    retrieve(@va);
    echo @content[4];
    @vu = @va['bank'];
    if(@vu[uv('id')]['balance'] == null){
    @vu[uv('id')]['balance'] = 0;
    @vu[uv('id')]['last_transaction'] = 0;
    @va['bank'] = @vu;
    store(@va);
    echo "Account created for " . uv('name') . "(" . uv('id') . ")<br/>";
    }
    echo "Hello " . uv('name') . " (ID: " . uv('id'). ")<br/>Account balance: " . @vu[uv('id')]['balance'] . "<br/>Last transaction: " . @vu[uv('id')]['last_transaction'] . "<br/>";


    echo @content[3];
    if(@va['market']){
    @tpl = array();
    @vk = 0;
    foreach(@va['market'] as @vc){
    @tpl[@vk]['name'] = @vc['name'];
    @tpl[@vk]['id'] = @vc['id'];
    @tpl[@vk++]['price'] = @vc['price'];
    }
    mds_template(@content[5],@tpl,false,4,'style="width:180;border:1px solid"');
    }
    else{
    echo "The market does not have creatures";
    }
    [/code]

    I have set up a live example of the bank and market at the signpost in front of the labyrinth. Please note that changes you make are only visible to you and if you enter garbage, it will have garbage. The bank itself is simple, extra features could be interest rate, limited credit borrowing, transaction fees etc.

    I will add some more scripts here when I finish them (sending over phone right now)

  9. [quote name='dst' date='26 October 2009 - 04:39 PM' timestamp='1256567982' post='45779']
    Damn! Now I have to remember (or learn) how to code again (not only basic like if do..) :P(
    [/quote]

    The more you know how to code, the quicker you will pick up on how to use the MD script :(
    I think the documentation will be easy for beginners to follow and the sample code will be available for reference.

×
×
  • Create New...