A little doodad for when you use DIRECTORY. It lets you click on shop names to walk to them, if there's one (and only one) matching room in the mapper. The darker blue rooms are ones the mapper can't find a room to walk you to, and the underlined ones are the clickable ones.
This hasn't been mentioned on its own yet - there's another way of assembling text using string.format. It can help where things with .. get messy:
echo("target is: "..target..", current health: "..currenthealth..", maxhealth: "..maxhealth)<br><br>-- or:<br><br>echo(string.format("target is: %s, current health: %s, maxhealth: %s", target, currenthealth, maxhealth))
If you really want to mess with people, pick a function call syntax at random every time you call a function.
If you want people to never ask for your scripts, just do a dice roll every time you make a function and have it call one of the above at random. Like have one alias call myFunction"value", another one do myFunction2("value") and a third do myfunction 'value' and so on.
Randomly alternate between tab, double space, triple space for indenting.
For concatenation sometimes have spacing, other times don't. So like (var1 .. "+".. var2.. " - " .. var3 ), etc.
Make the first half of your code have legible formatting, and following proper code practices. So like myFunction( value1, value2) -- if value2 > value 1 then .... Then halfway through your code start doing Myfunction( Value1, value2) etc etc.
...I could go on...
I've been tempted to do it a number of times, to see how long it'd take people to notice... But I don't hate myself enough to go through with doing it
@Austere just because you CAN do something doesn't mean you should though!
This. One of the most important things when coding is to make the intention as clear as possible to the reader. By using the brackets for all of your function calls, you're making it clear to anybody else reading the code (including yourself months later) that the variable is meant to refer to a function and that you meant to call that function.
As an example of what I mean, consider this code:
local a, b = myvariable "some string"
Did I mean to call the function that's referred to by "myvariable", passing in the string "some string" to it? Or do I have a minor syntax mistake, and I actually meant local a,b = myvariable, "some string" (i.e. assign the value of myvariable to a and the string "some string" to b)?
The syntax is valid in both cases, but the meaning is completely different. If myvariable doesn't refer to a function (because I meant the latter - though I could have meant the latter even if myvariable did refer to a function), I get a runtime error when the code executes. If I come and look at this code six months later, there's an additional step in reasoning that myvariable should be a function with a single parameter and which returns multiple values, though I may want to go and confirm for myself again that I didn't mean to have the comma there.
Not to mention that 1. you need to use brackets when you have a number of parameters that's not one, and 2. the bracketless syntax doesn't work in plenty of other languages. It just really doesn't seem like a good habit to get into.
Right-click a poorly formatted script, and select 'Format all'.
I was dubious when I saw this feature in one of the mudlet updates, but it actually worked really nicely for me just now, when I was trying out a script from someone on this forum, that had no indentation.
I got bored and decided to make a Caesar Cipher for a different game; one of the quests was bugging me and I found out that's the kind of encryption it uses. I won't show the method I use, specifically, to decode things but I can give the functions with an explanation of how they work.
</code>function toEncrypt(tocode, num)<br> return tocode:gsub("%a", function(x)<br> local start = (x:lower() == x and string.byte('a') or string.byte('A'))<br> local c = x:byte() - start
c = c + num<br> c = c%26
c = c + start<br> return string.char(c)
end)<br>end
<br>function toDecrypt(tocode, num)
return toEncrypt(tocode, num)<br>end<br></pre>From wikipedia: It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. With a right shift of 3, D would be replaced by G, E would become H, and so on.<br><br>The functions above: Encrypt is a right shift, whereas Decrypt functions as a left shift.<br>So for instance, if we were to do:<br><pre class="CodeBlock"><code>local msg = "Pyori is the greatest"<br>toEncrypt(msg, 7)<br>toDecrypt(msg, 7)<br>
The former would return: Wfvyp pz aol nylhalza The latter would return: Irhkb bl max zkxtmxlm
Whereas if we did:
Wfvyp pz aol nylhalza" toEncrypt(decrypt, 7)<br>toDecrypt(encrypt, 7) local decrypt = "Irhkb bl max zkxtmxlm"<br>local encrypt = "
They'd both return: Pyori is the greatest ---
Enjoy! I'm not sure how useful it'll actually be for others, but it got usage for me. Initially I coded similar for a java project I had for an assessment, and converted it to work with Lua.
That {34} means to match exactly 34 characters, no more and no less. I also added other characters to the range ( [a-z A-Z',()0-9&~"\.-] ) that can appear in item names because I like to be as specific as possible, but .{34} will work just as well.
"All we have to decide is what to do with the time that is given to us."
That {34} means to match exactly 34 characters, no more and no less. I also added other characters to the range ( [a-z A-Z',()0-9&~"\.-] ) that can appear in item names because I like to be as specific as possible, but .{34} will work just as well.
I haven't got it working exactly how I want it yet, but I've been adding links to the directory output to walk to the shop, and display info about the price. Highlight the cheapest, show the per one cost if it's a group etc. I'd like to get it to 'wares theitem' on arrival as well but I haven't got that far.
I'll post it when I'm eventually done with it - and tha ks to Sena that will be sooner than later.
That {34} means to match exactly 34 characters, no more and no less. I also added other characters to the range ( [a-z A-Z',()0-9&~"\.-] ) that can appear in item names because I like to be as specific as possible, but .{34} will work just as well.
I haven't got it working exactly how I want it yet, but I've been adding links to the directory output to walk to the shop, and display info about the price. Highlight the cheapest, show the per one cost if it's a group etc. I'd like to get it to 'wares theitem' on arrival as well but I haven't got that far.
I'll post it when I'm eventually done with it - and tha ks to Sena that will be sooner than later.
Walking to the store via directory is already included in the mudlet-mapper script
I thought so too but it hasn't been coming up for me; I just assumed I had it confused with an addon script someone else had done. I'll try re-downloading the mapper script.
I made this, so I wouldn't have to keep digging up the formula, when messing around with racial spec and stuff... You could technically use this to calculate mana as well. Would just have to add 10% to the base value (prior to bracelets) if your city has a pillar thingo that gives 10% mana.
^hp (\d+) (\d+) (\d+)$ Code: --Initialise variables; split lvl between <100 and >100, con, bracelet level. local lone, ltwo, c, b, hp = 0, 0, tonumber(matches[3]), tonumber(matches[4]), 0
--If level is over 100, then split the variables above.
if tonumber(matches[2]) > 100 then
lone = 100
ltwo = tonumber(matches[2]) - 100
else
lone = tonumber(matches[2])
ltwo = 0
end
--Make bracelet a proper percentage to multiply by.
b = ((100+b)/100)
--Math the formula out.
hp = (300 + (lone*((3*c)+4)) + (ltwo*((3*c)-16))) --Multiply by bracelet value. 1.05 for lvl1, 1.10 for 2, 1.15 for 3. hp = (hp*b)
--Print the value!
cecho("\n<green>Level of: <white>"..matches[2]..".")
cecho("\n<green>With con: <white>"..c..".")
cecho("\n<green>Bracelet: <white>"..matches[4].."%")
cecho("\n<red>Equals : <green>"..hp.."hp.")
cecho("\n<purple>+ Dcape : <SeaGreen>"..(hp*1.5).."hp.") Pattern:
Using is simple. Simply do 'hp <level> <con> <bracelets>' Example: hp 110 16 10 for lvl 110 with 16 con and lv 2 bracelets (5/10/15 are the bracelet values for 1/2/3 respectively) This would print out-
Love these. They help me learn to code a little more. Keep em coming!
Give us -real- shop logs! Not another misinterpretation of features we ask for, turned into something that either doesn't help at all, or doesn't remotely resemble what we wanted to begin with.
Thanks!
Current position of some of the playerbase, instead of expressing a desire to fix problems:
Vhaynna: "Honest question - if you don't like Achaea or the current admin, why do you even bother playing?"
Comments
Someone asked for the trigger pattern that I was asked to use, here it is:
A little doodad for when you use DIRECTORY. It lets you click on shop names to walk to them, if there's one (and only one) matching room in the mapper.
The darker blue rooms are ones the mapper can't find a room to walk you to, and the underlined ones are the clickable ones.
Svof
Mudlet Discord join up
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
Svof
Mudlet Discord join up
Svof
Mudlet Discord join up
Svof
Mudlet Discord join up
Svof
Mudlet Discord join up
How did I not know you could do this on the buffer... Given how much I use it everywhere else you'd think I'd have tried...
Or stick with what you do. You've got choices!
Svof
Mudlet Discord join up
Randomly alternate between tab, double space, triple space for indenting.
For concatenation sometimes have spacing, other times don't. So like (var1 .. "+".. var2.. " - " .. var3 ), etc.
Make the first half of your code have legible formatting, and following proper code practices. So like myFunction( value1, value2) -- if value2 > value 1 then .... Then halfway through your code start doing Myfunction( Value1, value2) etc etc.
...I could go on...
I've been tempted to do it a number of times, to see how long it'd take people to notice... But I don't hate myself enough to go through with doing it
zGUI 4.0 - A Free GUI for Mudlet 4.10+
As an example of what I mean, consider this code:
Did I mean to call the function that's referred to by "myvariable", passing in the string "some string" to it? Or do I have a minor syntax mistake, and I actually meant local a,b = myvariable, "some string" (i.e. assign the value of myvariable to a and the string "some string" to b)?
The syntax is valid in both cases, but the meaning is completely different. If myvariable doesn't refer to a function (because I meant the latter - though I could have meant the latter even if myvariable did refer to a function), I get a runtime error when the code executes. If I come and look at this code six months later, there's an additional step in reasoning that myvariable should be a function with a single parameter and which returns multiple values, though I may want to go and confirm for myself again that I didn't mean to have the comma there.
Not to mention that 1. you need to use brackets when you have a number of parameters that's not one, and 2. the bracketless syntax doesn't work in plenty of other languages. It just really doesn't seem like a good habit to get into.
Results of disembowel testing | Knight limb counter | GMCP AB files
I was dubious when I saw this feature in one of the mudlet updates, but it actually worked really nicely for me just now, when I was trying out a script from someone on this forum, that had no indentation.
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
The former would return: Wfvyp pz aol nylhalza
The latter would return: Irhkb bl max zkxtmxlm
Whereas if we did:
They'd both return: Pyori is the greatest
---
Enjoy! I'm not sure how useful it'll actually be for others, but it got usage for me. Initially I coded similar for a java project I had for an assessment, and converted it to work with Lua.
I'll post it when I'm eventually done with it - and tha ks to Sena that will be sooner than later.
this is what it looks like for me for reference
Using is simple. Simply do 'hp <level> <con> <bracelets>'
Example: hp 110 16 10 for lvl 110 with 16 con and lv 2 bracelets (5/10/15 are the bracelet values for 1/2/3 respectively)
This would print out-
With con: 16.
Bracelet: 10%
Equals : 6402hp.
+ Dcape : 9603hp.