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
0
Comments
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.
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:
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:
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:
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'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:
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.
Artemis says, "You are so high maintenance, Tharvis, gosh."
Tecton says, "It's still your fault, Tharvis."
Artemis says, "You are so high maintenance, Tharvis, gosh."
Tecton says, "It's still your fault, Tharvis."
@Tael Any chance you could switch around some of this to work on Mudlet? Please and thank you!