Could someone explain the significance of the letters in:
"for i,v in pairs"
Or when k,v is mentioned?
Antonius explained it well, but let me also say that you can leave of the second of the two if you only need keys. Like...
for k in pairs (blah) do
And it's also common to use _ as a throwaway name for the first if you only want the values, as in for _,v in ipairs(tbl) do ...
Always been confused by the difference between pairs() and ipairs(), just replace whichever one doesn't work so that it does work. I'm sure it's something stupidly simple, but some clarification would be nice.
ipairs gives you the entry number and the key, pairs gives you the key name and value.
Basically ipairs should be used on a table acting as an array, eg { "Blah1", "Blah2" } whereas pairs should be used on a dictionary/hash format eg { ["Blah"] = "Blah", ["Blah2"] = "Blah2" }
ipairs gives you the entry number and the key, pairs gives you the key name and value.
Basically ipairs should be used on a table acting as an array, eg { "Blah1", "Blah2" } whereas pairs should be used on a dictionary/hash format eg { ["Blah"] = "Blah", ["Blah2"] = "Blah2" }
Took me a second to understand what you meant, but pairs vs indexed pairs makes sense! Thanks bae.
ipairs gives you the entry number and the key, pairs gives you the key name and value.
Basically ipairs should be used on a table acting as an array, eg { "Blah1", "Blah2" } whereas pairs should be used on a dictionary/hash format eg { ["Blah"] = "Blah", ["Blah2"] = "Blah2" }
Took me a second to understand what you meant, but pairs vs indexed pairs makes sense! Thanks bae.
To be clear, pairs works on normal and indexed just fine - but it does them in 'random' order. ipairs runs through numerically indexed keys in order from 1-whatever. my sortedpairs (link) iterator runs through keys in alphabetical order.
Is denyCurrentSend not included in any of the online Mudlet wiki documentation? All I've found is a reference to it on the details for the sysDataSendRequest event, but nothing about the actual function itself.
Which brings me to my actual question: Is there an event raised when a command is denied?
Note: if you'll be making use of denyCurrentSend(), you really should notify the user that you denied their command - unexperienced ones might conclude that your script or Mudlet is buggy if they don't see visual feedback. Do not mis-use this and use it as keylogger either
But you can overwrite denyCurrentSend to fire an event like this:
local origCurrentSend = denyCurrentSend denyCurrentSend = function(what) raiseEvent("sysDenyCurrentSendEvent", what) origCurrentSend() end
This new denyCurrentSend can then also be given the actual command that was denied (which in urn ands it as an argument to he event handlers)
Kind of depends on exactly what your prompt is set to; with custom prompts in-game there's a ton of potential options. Rage itself should just be a number, so you'd need (\d+) for that part of the prompt, but you'd also need the pattern to match the rest. That said, you can get Rage from GMCP, something like this:
function getRage()
for _, stat in ipairs(gmcp.Char.Vitals.charstats) do
if string.starts(stat, "Rage") then return tonumber(string.match(stat, "(%d+)"))
end
end
@Keneanung Forgot to reply at the time, but thanks. Unfortunately I'd need it for scripts I haven't written myself/don't want to start making changes to; if it was just a case of my own code I could raise the event at the same time as calling denyCurrentSend.
I'm not sure about implementation details, but if you subscribed to the sysDataSendRequest and checked somehow, if the event of above overwriting was fired in conjunction with the current event (ie directly after each other), you may be able to find out...
Is anyone else having a problem where Wundersys is putting up mass/rebounding/hold breath upon switching profiles (from basic to combat) and classes (from dragon to serpent)? I've noticed that it puts those three on basic defup/keep up, but does not show on the WSHOW DEFUP/KEEPUP tables.
Kind of depends on exactly what your prompt is set to; with custom prompts in-game there's a ton of potential options. Rage itself should just be a number, so you'd need (\d+) for that part of the prompt, but you'd also need the pattern to match the rest. That said, you can get Rage from GMCP, something like this:
function getRage()
for _, stat in ipairs(gmcp.Char.Vitals.charstats) do
if string.starts(stat, "Rage") then return tonumber(string.match(stat, "(%d+)"))
end
end
I use: string.sub(gmcp.Char.Vitals.charstats[2],7)
That works as long as the order of charstats doesn't change, or at least the position of the Rage entry doesn't. We've already seen with the addition of Rage there's no guarantee it won't change.
I just use: brage = tonumber(string.match(gmcp.Char.Vitals.charstats[2], "Rage: (%d+)"))
Index won't change, unless IRE physically changes it themselves, which is highly unlikely. (possible, but not very likely). Also kind of moot to say it's slower, given that it'll only be processed about 0.0001s (if that) slower than the above example.
Those three have their own thing with masson/rebon/br aliases.
Yep. Problem is, they come on even when I dont toggle them on. For example, I will smoke skullcap, type alias REB (toggles rebounding ON) and type REB again to remove rebounding from the keepup list
@Dairon Yeah, I have that same problem but you might find better answers/support posting in the wsys thread. I handle the same way you do for now, just toggling them back off whenever I switch.
I have some nub questions about saving tables in external files: Can you save more than one table per file (Seems like you can't) Is this an intense process? Would it be terribly harmful if I had one function that saved all of my tables (Probably 4ish)?
I have some nub questions about saving tables in external files: Can you save more than one table per file (Seems like you can't) Is this an intense process? Would it be terribly harmful if I had one function that saved all of my tables (Probably 4ish)?
I save many top-level tables to single files, just serialize them (turn them back into the lua script that would define them properly) then load them back up when needed. Can do multiple tables, nested tables, etc. No problem.
Me and Soludra, goofing off, even found a way in MUSHclient to serialize functions. (I'm FadedParadox, he's Twisol) http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=9512 - I haven't done that in Mudlet yet though, storing functions is more of a fun exercise than actually useful.
Is it possible to put an echolink into a party chat? For instance a room number
And how?
If you mean something that the other people in your party will see as a link they can click on, no. If it's something you're echoing to party, and you want to make part of it a link for yourself, probably the simplest way would be to just gag the line for your party echo, and re-echo it with the echoLink added in.
Comments
for k in pairs (blah) do
Site: https://github.com/trevize-achaea/scripts/releases
Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
for _,v in ipairs(tbl) do ...
Basically ipairs should be used on a table acting as an array, eg { "Blah1", "Blah2" } whereas pairs should be used on a dictionary/hash format eg { ["Blah"] = "Blah", ["Blah2"] = "Blah2" }
Site: https://github.com/trevize-achaea/scripts/releases
Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
Which brings me to my actual question: Is there an event raised when a command is denied?
Results of disembowel testing | Knight limb counter | GMCP AB files
But you can overwrite denyCurrentSend to fire an event like this:
This new denyCurrentSend can then also be given the actual command that was denied (which in urn ands it as an argument to he event handlers)
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
I want to create a Rage Gauge
Kind of depends on exactly what your prompt is set to; with custom prompts in-game there's a ton of potential options. Rage itself should just be a number, so you'd need (\d+) for that part of the prompt, but you'd also need the pattern to match the rest. That said, you can get Rage from GMCP, something like this:
Results of disembowel testing | Knight limb counter | GMCP AB files
Results of disembowel testing | Knight limb counter | GMCP AB files
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
Site: https://github.com/trevize-achaea/scripts/releases
Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
Results of disembowel testing | Knight limb counter | GMCP AB files
Site: https://github.com/trevize-achaea/scripts/releases
Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
brage = tonumber(string.match(gmcp.Char.Vitals.charstats[2], "Rage: (%d+)"))
Index won't change, unless IRE physically changes it themselves, which is highly unlikely. (possible, but not very likely). Also kind of moot to say it's slower, given that it'll only be processed about 0.0001s (if that) slower than the above example.
I have some nub questions about saving tables in external files:
Can you save more than one table per file (Seems like you can't)
Is this an intense process? Would it be terribly harmful if I had one function that saved all of my tables (Probably 4ish)?
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
Me and Soludra, goofing off, even found a way in MUSHclient to serialize functions. (I'm FadedParadox, he's Twisol) http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=9512 - I haven't done that in Mudlet yet though, storing functions is more of a fun exercise than actually useful.
Site: https://github.com/trevize-achaea/scripts/releases
Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
And how?
Is it possible to do this by moveCursor?
moveCursor(0, getLineNumber()-1)
-- somehow select the string and then do
llength = string.len(matches[1])
deselect()
moveCursorEnd()