HTML 5 anti Theif

I've asked around and cant seem to find anyone that can tell me what a good alias is for anti thief, I have seen one that mudlet uses that open pack and closes pack if I don't open it my self it will automatically close as a reflex can anyone suggest or give me a hand on a good Anti Thief Alias 

Comments

  • Try this by @Orzaansyn on setting up a toggle for selfishness/generosity using the serverside curing to set it up as defence upkeep: http://forums.achaea.com/discussion/comment/243073/#Comment_243073

    You might get better advice/feedback if you can tell us what you would like to achieve and what you might have tried so far. :)

    I am not overly confident on the Nexus/HTML5 coding, but I am trying my best to learn - I will have a look to see what I can fiddle with and get to work and get back to you here if nobody else has given any input.
  • if you are looking for selfishness upkeep I just have serverside aliases as follow:
    selfon      CURING PRIORITY DEFENCE SELFISHNESS 20
    selfoff CURING PRIORITY DEFENCE SELFISHNESS RESET/QUEUE ADD EQBAL GENEROSITY



  • edited June 2015
    What you want is a way to keep gold in your pack unless you yourself get it out. You can't really just download someone else's script because the container they keep gold in might have different messages than yours (a lot of people use kitbags for instance, or pouches, or even letters).

    Make a new package for Antitheft.

    Make a new "function" called onLoad. This is a special function that runs when you load the client.

    In that function, you want:
    var pack_number = YOURPACKNUMBERGOESHERE;
    var getting_gold = false;
    Make sure to change YOURPACKNUMBERGOESHERE to whatever your pack number is (and remember to change it if your pack decays and you replace it).

    This script just makes two variables and sets their values.

    Then you need an alias to get gold out of your pack. Mine is "gg" for Get Gold (from pack). If you do it like this, you can also specify an amount (e.g., "gg 500") to get only that out:

    Pattern for the alias:
    ^gg(?: +(\d+))?$
    Make sure to set the pattern type to regular expression.

    To make sense of this pattern if you don't know regular expressions, the "^" means beginning of line, the "gg" is just the letters "gg", then the stuff wrapped in "(?:STUFF)" is a non-capturing group (so the stuff it matches doesn't get saved to the "args table"), after that whole non-capturing group you see a "?" which means that group is optional (i.e., it will also just match "gg", without any other stuff after it), then you have a space followed by "+" which means one or more spaces, then the stuff wrapped in "(STUFF)" which is a capture group that will save the results to the args table (specifically, in args[1]), inside which you have "\d" which means any number, followed by "+" which again means one or more of the thing (i.e., one or more number), and finally at the very end you have "$" which just means end of line.

    The script in your alias will look like this:
    getting_gold = true;
    if (args[1]) {
        client.send_direct("take " + args[1] + " sovereigns from " + pack_number);
    } else {
        client.send_direct("take sovereigns from " + pack_number);
    }
    This script sets getting_gold to true, then if there's an args[1] (because you wrote e.g., "gg 500" instead of just "gg"), sends a command to get that amount of gold from your pack, otherwise (i.e., you wrote just "gg") it just gets all your gold from your pack.

    Finally, you're going to have a trigger that keeps your gold in your pack if you weren't the one taking it out:

    The pattern will depend on your pack. When I take gold out, I see: "You get 1000 gold sovereigns from a sleek velvet pouch.", so my pattern looks like this:
    ^You get \d+ gold sovereigns? from a sleek velvet pouch\.$
    You'll need to edit that to match whatever it looks like with your own pack. As before, you want to set the pattern type to regular expression.

    To make sense of that pattern, the "^" is beginning of line again, the "\d+" is one or more numbers again, the "?" at the end of "sovereigns" just says that the "s" is optional (in case you're only getting 1 sovereign out of your pack), the "\." just says to match a normal period (you're telling it to ignore the fact that "." normally means something special in regex), and the "$" is the end of the line.

    The script it runs will look like this:
    if (getting_gold) {
        getting_gold = false;
    } else {
        client.send_direct("put sovereigns in " + pack_number);
        client.send_direct("put sovereigns in " + pack_number);
    }
    So if getting_gold is true (because you used the alias, which sets it to true before getting the gold out), it sets it back to false (since you're done getting the gold out). If getting_gold is false and you took the gold out because someone is robbing you (or because you forgot to use the alias), it will put the gold back in your pack.

    Now save everything and restart the client.

    You also probably want to have a simple trigger for the line you get when you remove your pack to rewear it (by number!) twice.

    If you want to keep stuff other than gold in your pack or rewear things, you can follow the same principle: an onLoad variable that gets initialised to false, an alias that turns it to true and does the thing you want (take the thing from your pack or rewear it), and a trigger that sets the variable back to false if it was true or puts the item back in your pack/rewears the item if the variable was false.
  • That last line should say: "(take the thing from your pack or unwear it)" rather than "(take the thing from your pack or rewear it)"
  • Rekhyr said:
    if you are looking for selfishness upkeep I just have serverside aliases as follow:
    selfon      CURING PRIORITY DEFENCE SELFISHNESS 20
    selfoff CURING PRIORITY DEFENCE SELFISHNESS RESET/QUEUE ADD EQBAL GENEROSITY



    good thank you for the help this can carry over to mudlet as well or I need to make different Alias there?
  • TharvisTharvis The Land of Beer and Chocolate!
    @Caige just use serverside aliases for that, don't need to use a mudlet alias for it
    Aurora says, "Tharvis, why are you always breaking things?!"
    Artemis says, "You are so high maintenance, Tharvis, gosh."
    Tecton says, "It's still your fault, Tharvis."

  • was trying to set up my mudlet as well on offtimes Seems a bit much compared to html5 cant even get Valdensroominventory to update room list with QL but thats a totally different topic thanks for help guys.
  • TharvisTharvis The Land of Beer and Chocolate!
    need GMCP enabled for the roominventory
    Aurora says, "Tharvis, why are you always breaking things?!"
    Artemis says, "You are so high maintenance, Tharvis, gosh."
    Tecton says, "It's still your fault, Tharvis."

  • Tael said:
    What you want is a way to keep gold in your pack unless you yourself get it out. You can't really just download someone else's script because the container they keep gold in might have different messages than yours (a lot of people use kitbags for instance, or pouches, or even letters).

    Make a new package for Antitheft.

    Make a new "function" called onLoad. This is a special function that runs when you load the client.

    In that function, you want:
    var pack_number = YOURPACKNUMBERGOESHERE;
    var getting_gold = false;
    Make sure to change YOURPACKNUMBERGOESHERE to whatever your pack number is (and remember to change it if your pack decays and you replace it).

    This script just makes two variables and sets their values.

    Then you need an alias to get gold out of your pack. Mine is "gg" for Get Gold (from pack). If you do it like this, you can also specify an amount (e.g., "gg 500") to get only that out:

    Pattern for the alias:
    ^gg(?: +(\d+))?$
    Make sure to set the pattern type to regular expression.

    To make sense of this pattern if you don't know regular expressions, the "^" means beginning of line, the "gg" is just the letters "gg", then the stuff wrapped in "(?:STUFF)" is a non-capturing group (so the stuff it matches doesn't get saved to the "args table"), after that whole non-capturing group you see a "?" which means that group is optional (i.e., it will also just match "gg", without any other stuff after it), then you have a space followed by "+" which means one or more spaces, then the stuff wrapped in "(STUFF)" which is a capture group that will save the results to the args table (specifically, in args[1]), inside which you have "\d" which means any number, followed by "+" which again means one or more of the thing (i.e., one or more number), and finally at the very end you have "$" which just means end of line.

    The script in your alias will look like this:
    getting_gold = true;
    if (args[1]) {
        client.send_direct("take " + args[1] + " sovereigns from " + pack_number);
    } else {
        client.send_direct("take sovereigns from " + pack_number);
    }
    This script sets getting_gold to true, then if there's an args[1] (because you wrote e.g., "gg 500" instead of just "gg"), sends a command to get that amount of gold from your pack, otherwise (i.e., you wrote just "gg") it just gets all your gold from your pack.

    Finally, you're going to have a trigger that keeps your gold in your pack if you weren't the one taking it out:

    The pattern will depend on your pack. When I take gold out, I see: "You get 1000 gold sovereigns from a sleek velvet pouch.", so my pattern looks like this:
    ^You get \d+ gold sovereigns? from a sleek velvet pouch\.$
    You'll need to edit that to match whatever it looks like with your own pack. As before, you want to set the pattern type to regular expression.

    To make sense of that pattern, the "^" is beginning of line again, the "\d+" is one or more numbers again, the "?" at the end of "sovereigns" just says that the "s" is optional (in case you're only getting 1 sovereign out of your pack), the "\." just says to match a normal period (you're telling it to ignore the fact that "." normally means something special in regex), and the "$" is the end of the line.

    The script it runs will look like this:
    if (getting_gold) {
        getting_gold = false;
    } else {
        client.send_direct("put sovereigns in " + pack_number);
        client.send_direct("put sovereigns in " + pack_number);
    }
    So if getting_gold is true (because you used the alias, which sets it to true before getting the gold out), it sets it back to false (since you're done getting the gold out). If getting_gold is false and you took the gold out because someone is robbing you (or because you forgot to use the alias), it will put the gold back in your pack.

    Now save everything and restart the client.

    You also probably want to have a simple trigger for the line you get when you remove your pack to rewear it (by number!) twice.

    If you want to keep stuff other than gold in your pack or rewear things, you can follow the same principle: an onLoad variable that gets initialised to false, an alias that turns it to true and does the thing you want (take the thing from your pack or rewear it), and a trigger that sets the variable back to false if it was true or puts the item back in your pack/rewears the item if the variable was false.

    @Tael Any chance you could switch around some of this to work on Mudlet? Please and thank you!
  • Daerin said:
    Tael said:
    What you want is a way to keep gold in your pack unless you yourself get it out. You can't really just download someone else's script because the container they keep gold in might have different messages than yours (a lot of people use kitbags for instance, or pouches, or even letters).

    Make a new script for antitheft. Scripts run immediately when you load the client (and also whenever you modify and save them).

    In that script, you want:
    pack_number = YOURPACKNUMBERGOESHERE
    getting_gold = false
    Make sure to change YOURPACKNUMBERGOESHERE to whatever your pack number is (and remember to change it if your pack decays and you replace it).

    This script just makes two variables and sets their values.

    Then you need an alias to get gold out of your pack. Mine is "gg" for Get Gold (from pack). If you do it like this, you can also specify an amount (e.g., "gg 500") to get only that out:

    Pattern for the alias:
    ^gg(?: +(\d+))?$
    Make sure to set the pattern type to regular expression.

    To make sense of this pattern if you don't know regular expressions, the "^" means beginning of line, the "gg" is just the letters "gg", then the stuff wrapped in "(?:STUFF)" is a non-capturing group (so the stuff it matches doesn't get saved to the "matches table"), after that whole non-capturing group you see a "?" which means that group is optional (i.e., it will also just match "gg", without any other stuff after it), then you have a space followed by "+" which means one or more spaces, then the stuff wrapped in "(STUFF)" which is a capture group that will save the results to the matches table (specifically, in matches[2], because matches[1] is always the whole matched line), inside which you have "\d" which means any number, followed by "+" which again means one or more of the thing (i.e., one or more number), and finally at the very end you have "$" which just means end of line.

    The script in your alias will look like this:
    getting_gold = true
    if matches[2] then
        send("take " .. matches[2] .. " sovereigns from " .. pack_number)
    else
        send("take sovereigns from " .. pack_number)
    end
    This script sets getting_gold to true, then if there's a matches[2] (because you wrote e.g., "gg 500" instead of just "gg"), sends a command to get that amount of gold from your pack, otherwise (i.e., you wrote just "gg") it just gets all your gold from your pack.

    Finally, you're going to have a trigger that keeps your gold in your pack if you weren't the one taking it out:

    The pattern will depend on your pack. When I take gold out, I see: "You get 1000 gold sovereigns from a sleek velvet pouch.", so my pattern looks like this:
    ^You get \d+ gold sovereigns? from a sleek velvet pouch\.$
    You'll need to edit that to match whatever it looks like with your own pack. As before, you want to set the pattern type to regular expression.

    To make sense of that pattern, the "^" is beginning of line again, the "\d+" is one or more numbers again, the "?" at the end of "sovereigns" just says that the "s" is optional (in case you're only getting 1 sovereign out of your pack), the "\." just says to match a normal period (you're telling it to ignore the fact that "." normally means something special in regex), and the "$" is the end of the line.

    The script it runs will look like this:
    if getting_gold then
        getting_gold = false
    else
        send("put sovereigns in " .. pack_number)
        send("put sovereigns in " .. pack_number) end
    So if getting_gold is true (because you used the alias, which sets it to true before getting the gold out), it sets it back to false (since you're done getting the gold out). If getting_gold is false and you took the gold out because someone is robbing you (or because you forgot to use the alias), it will put the gold back in your pack.

    Now save everything (when you save the script, Mudlet should automatically run it so you don't need to restart).

    You also probably want to have a simple trigger for the line you get when you remove your pack to rewear it (by number!) twice.

    If you want to keep stuff other than gold in your pack or rewear things, you can follow the same principle: a variable in a script that gets initialised to false, an alias that turns it to true and does the thing you want (take the thing from your pack or rewear it), and a trigger that sets the variable back to false if it was true or puts the item back in your pack/rewears the item if the variable was false.

    @Tael Any chance you could switch around some of this to work on Mudlet? Please and thank you!
    That should work.
  • Thanks!
Sign In or Register to comment.