Issue with your function, Dhraen: you're creating a timer object with the same name as your function object, so it's going to be overwritten. Suggest just renaming the function something like "doKeepAlive()", etc.
Aye, valid concern, mate, but when using the function in this manner, owing to a Mudlet bug, the function will actually get assigned to a UID, so while you concern is very valid (I will indeed change my method), at this time, it is not an issue.
Well, the good news is, the code you linked above is not the problem! You'll note how it's throwing an error from pairs(), not ipairs(), which is what you've used in your logic.
The bad news is you're gonna need to hunt down the actual error. Note the number before the error explanation, that's the line number (#91 in this case).
A trick to help you hunt it down! Obviously in this case the error is in an alias, and this bit of advice only works for scripts. Although you could put the code in a script rather than an alias, I guess.
Anyway, the error lines in the bug window always reference the first line of code in your script, in an attempt to name it, give you some way to identify it.
If you're like me, the first (real) line in my scripts is something unhelpful and generic, like this: lab = lab or {}
So, use a comment to name your script:
--lab.dslafflict() lab = lab or {} function lab.dslafflict(blah blkah blah
The error line will always reference that comment first, which should help your debugging hugely.
For my envenomer/empowerer I would like it so very much if when the script fired that if the venom on my blade about to go out wouldn't be re-envenomed e.g.
Left hand sword
A gleaming scimitar has the following venoms or magical effects on it:
1) xentio
2) aconite
3) curare
typing "EVENOM LEFT WITH XENTIO" would do nothing, because xentio is already the top venom, but typing "EVENOM LEFT WITH ACONITE" would go through because it's not the venom that will be used with DSK.
I'm sure there's a table function that I'm just ignorant of, halp plox.
For my envenomer/empowerer I would like it so very much if when the script fired that if the venom on my blade about to go out wouldn't be re-envenomed e.g.
Left hand sword
A gleaming scimitar has the following venoms or magical effects on it:
1) xentio
2) aconite
3) curare
typing "EVENOM LEFT WITH XENTIO" would do nothing, because xentio is already the top venom, but typing "EVENOM LEFT WITH ACONITE" would go through because it's not the venom that will be used with DSK.
I'm sure there's a table function that I'm just ignorant of, halp plox.
function table:getIndex(table, value)
for i,v in ipairs(table) do
if v == value then
return i
end
end
return 0
end
Using ^this function(make sure to paste it into a new script first), could either run the check through whatever alias you're using, or a function using the sysDataSendRequest event. I'll post an example for both
local venom, venom_pos venom = matches[3]:lower() venom_pos = table:getIndex(venom_table, venom) if venom_pos == 1 then denyCurrentSend() end
-- add event sysDataSendRequest function checkVenom(_, cmd)
local venom, venom_pos venom = string.match(cmd:lower(), "envenom %a with (a%)") venom_pos = table:getIndex(venom_table, venom) if venom_pos == 1 then denyCurrentSend() end
end
Make sure to name the script for the second version checkVenom, it should work out, but it's untested.
Great example of sysDataSendRequest - I've wondered how to use that. A question about your actual script though; why use table:getIndex()? I can see it could be a useful function and I might even add it to my own toolbox, but in this particular example, why not just do:
venom = string.match(cmd:lower(), "envenom %a with (a%)") if venom_table[1] == venom:lower() then denyCurrentSend() end
That works too yeah, I just chose to do it the way I did, but table:getIndex() is still a great function to have(credits to demonnic of the Mudlet dev team for giving it to me).
hey does anyone have a system for BB Rituals where they wont fail because of steps firing too fast? For some reason I am having writers block on this and cannot think of a way to start the code.
Any suggestions would be great as well to point me in a good direction, I am not afraid to code and test myself!
“Unless someone like you cares a whole awful lot, Nothing is going to get better. It's not.” ― Dr. Seuss, The Lorax
Veritas says, "Sorry for breaking your system Macavity."
Veritas says, "My boss fights crash Macavity's computer now."
Set a variable while doing a step and unset it once the step is complete? Loop through a table and use timers, with values for each key(ritual name/action) being the time it takes to do each step?
How effective is that in a combat situation? Or is there a better way of doing it so it pumps out each step if for example you regain balance and do not have paralysis.
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
Stupidity messes that up. What I did was basically set a variable to hold a command such as chant blah blah blah and made an alias execute whatever was in that variable. I then had triggers for each successful step completion to clear that variable and set it to the next step. Then I just mash my alias.
You could also do it fully automated with limiters and stuff.
All of your stuff in your UI setup should be in functions, have a script call those functions. Then you have that script either trigger on the sysLoadEvent, which will fire when the profile is loaded. You could also put the init scripts at the bottom, as Mudlet goes through the scripts in order on load up.
well, I have them all in 1 script at present and the "sysLoadEvent" has the event handler.. and its the first in the scripts.. and, still doesn't work ..
Its something like
function load_sys()
topbar() statusbar() myaff() enemyaff() end
I also trigger the 'load_sys()' on my login which at moment I have my variables set and still doesnt work heh
Have you checked the error view? Wild guess, but I think you're trying to run the functions before they're actually created. Move the init script to the bottom. Also, I've never had an issue with (the little bit of gui stuff I do have) my gui windows not initializing, even if I don't run them through a function.
I got no errors, Just one with my chat window but that auto loads but my new stuff I created doesn't load til I run the load_sys() script with lua -name- ....
Yep doesn't tell you how to make drop down menus..
I think I have it with help from the mudlet forums, but having issues with the last part and making the drop down disappear again as :hide() and hideWindow() dont want to work..
Yep doesn't tell you how to make drop down menus..
I think I have it with help from the mudlet forums, but having issues with the last part and making the drop down disappear again as :hide() and hideWindow() dont want to work..
Never mind, the lightbulb finally turned on and I realised I just need to set the alpha channel for the colour itself, rather than trying to use the opacity property.
SOO I have a really really stupid issue happening only on 'ONE PERSON' I use the same system for multiple people and only 1 of them is having this issue...
Im usiing
if table.isMember(system.cachedisplay.inks, k) then table.insert(inkcache, k .. " "..string.rep(" ", name_len) .."[<orange>" .. v .. "<white>]") end
I use the same method on two other things, and 3 other people are using the same system and none of them are having this issue BUT ME! ... also the cache is grabbed from GMCP and it only showing 1 item
..... I just did - echo(table.concat( inkcache, " , "))
Comments
if enemy_aura == 0 and enemy_shield == 0 then
for k,v in ipairs(dslafflist) do
if cdaff == 0 then
rendAff(v)
end
end
end
with the error message
[ERROR:] object:<rend> function:<Alias39>
<./mudlet-lua/lua/TableUtils.lua:91: bad argument #1 to 'pairs' (table expected, got
string)>
Edit: Just in case it's important, dslafflist looks like this
lua display(dslafflist)
{
"clumsiness",
"asthma",
"paralysis",
"crippled",
"mental_disruption",
"physical_disruption",
"crippled_body",
"slickness",
"broken_left_arm",
"broken_right_arm"
}
Halp?
Anyway, the error lines in the bug window always reference the first line of code in your script, in an attempt to name it, give you some way to identify it.
If you're like me, the first (real) line in my scripts is something unhelpful and generic, like this:
lab = lab or {}
So, use a comment to name your script:
--lab.dslafflict()
lab = lab or {}
function lab.dslafflict(blah blkah blah
The error line will always reference that comment first, which should help your debugging hugely.
for i,v in ipairs(table) do
if v == value then
return i
end
end
return 0
end
Using ^this function(make sure to paste it into a new script first), could either run the check through whatever alias you're using, or a function using the sysDataSendRequest event. I'll post an example for both
local venom, venom_pos
venom = matches[3]:lower()
venom_pos = table:getIndex(venom_table, venom)
if venom_pos == 1 then
denyCurrentSend()
end
-- add event sysDataSendRequest
function checkVenom(_, cmd)
local venom, venom_pos
venom = string.match(cmd:lower(), "envenom %a with (a%)")
venom_pos = table:getIndex(venom_table, venom)
if venom_pos == 1 then
denyCurrentSend()
end
end
Make sure to name the script for the second version checkVenom, it should work out, but it's untested.
A question about your actual script though; why use table:getIndex()?
I can see it could be a useful function and I might even add it to my own toolbox, but in this particular example, why not just do:
venom = string.match(cmd:lower(), "envenom %a with (a%)")
if venom_table[1] == venom:lower() then denyCurrentSend() end
Nothing is going to get better. It's not.”
― Dr. Seuss, The Lorax
How effective is that in a combat situation? Or is there a better way of doing it so it pumps out each step if for example you regain balance and do not have paralysis.
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
I remember using earthshaker/soulreaper etcc etc and when I logged into mudlet everything was already loaded..
My question is.. HOW Do I have my system load when I loadup mudlet?
Its something like
function load_sys()
topbar()
statusbar()
myaff()
enemyaff()
end
I also trigger the 'load_sys()' on my login which at moment I have my variables set and still doesnt work heh
I have to run, Lua loadsys() every time
Does anyone know a site which helps you/tutorial on how to make a Geyser drop down menu?? As the one Mudlet does through buttons looks ugly!
Any help/Advise on this?
@azton
Have you tried here?
http://wiki.mudlet.org/w/Manual:Geyser
I think I have it with help from the mudlet forums, but having issues with the last part and making the drop down disappear again as :hide() and hideWindow() dont want to work..
@Azton: This may be able to help? http://forums.mudlet.org/viewtopic.php?f=6&t=3585
labui.trepLA:setStyleSheet([[
background-color: SteelBlue;
filter: alpha(opacity=50);
]])
labui.trepLA:setStyleSheet([[
background-color: SteelBlue;
opacity: 0.5;
]])
I've tried various versions of this, but I can't get a translucent label using setStyleSheet.
Anyone got any tips?
Im usiing
if table.isMember(system.cachedisplay.inks, k) then
table.insert(inkcache, k .. " "..string.rep(" ", name_len) .."[<orange>" .. v .. "<white>]")
end
the ink code is this...
system.cachedisplay.inks = {
"redink",
"blueink",
"yellowink",
"greenink",
"purpleink",
"goldink",
}
Which all works etc but some reason its outputting this
Inks
blueink [2]yellowink [41]goldink [29]
goldink [29]redink [1]greenink [45]
greenink [45]purpleink [27]
it' doubleing up on -goldink- and -greenink-
I use the same method on two other things, and 3 other people are using the same system and none of them are having this issue BUT ME! ... also the cache is grabbed from GMCP and it only showing 1 item
..... I just did -
echo(table.concat( inkcache, " , "))
and that is showing it correct
blueink [<orange>2<white>] ,
yellowink [<orange>41<white>] , goldink [<orange>29<white>] , redink [<orange>1<white>] ,
greenink [<orange>45<white>] , purpleink [<orange>27<white>]