Does table.index_of() actually work in Mudlet? It's on the wiki, but it keeps throwing me an error when I try to use it.
Seems to work for me; I'm using it in my next-aff picking script and not getting any errors.
You sure you're using a simple indexed table?
Please inspect the results of display(that_table)
And maybe post the line (or a few lines) of the code where you are using it?
I use my own function for that sort of thing:
--itable script
itable = itable or {}
function itable:remove(t,n)
local temp = {}
local n = tonumber(n)
local newcount = 0
for num,val in ipairs(t) do
if num ~= n then
newcount = newcount + 1
temp[newcount] = val
end
end
return temp
end
function itable:removeall(t,v)
local temp = {}
local newcount = 0
for _,val in ipairs(t) do
if val ~= v then
newcount = newcount + 1
temp[newcount] = val
end
end
return temp
end
--[[
temptable = {"item1", "item2", "item3", "item2",}
display(temptable)
--temptable = itable:remove(temptable,2)
temptable = itable:removeall(temptable,"item3")
display(temptable)
]]--
Edit: It's just randomly dropping the value of one key from the dbvar sometimes. This is soooo weird. The variable itself still has all the values, it's just when I run it through the function it'll drop one of the values.
Edit2: It has to do with the actual amount in the value. 1-9 it hates. It's cool with 10. 10 is a nice number. But no way to 11, 21, 22, 23 or 24.
It looks like a type error, where it comes across a string instead of a number, and rather than returning an error, it concatenates instead of adding, which makes the whole thing a string.
That said, try doing the adding within %eval: $sum = %eval($sum + %1.%i)
Failing that, this may be a good one for the cmud forum, as it may be a genuine bug.
Yeah I think that might be what's going on. For now, I was able to workaround by just dropping the %eval and it adds fine, but then it does the same issue for OTHER strings. I think it may have to do with how the variable is created, so I'll play with trying to set the type more explicitly.
From memory, which isn't great as it's been about 6 years now, %eval ought to achieve that coercing. It is the equivalent of the #math call, so nothing that happens inside it can be anything but a number.
Hi guys I have been trying to track down a few lines for my system, but have meet an impasse with this set. Therefore is anyone willing to pm or post the trigger (affliction) lines, so I can begin adding them myself later.
Pyrolum A simple resin that releases toxic fumes when burnt. Combust Instantly ignite resins in your presence. Corsin A heavy resin that barely burns, but hardens rapidly. Trientia A thin resin that ignites at a moment's notice. Harimel A slow-burning resin that sticks to the skin. Glauxe An adhesive resin that emits a thick smoke when burned. Badulem An unpredictable resin that mimics venoms. Lysirine A resin with a pleasant and sleep-inducing aroma.
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
So I've been pondering over this for a while now, and it's probably a really easy solution I just can't see the answer.
So I want to take and compare one table with another table. Now the first table will have 2 columns IE, affliction + true/false. The second table has nothing but one curing tree afflictions. Like all tree or all focus.
How would I go about comparing the affliction from the first table with all of the afflictions in the second single table so I can set another variable.
'Those that do not attempt are those with the least stories to tell.'
So I've been pondering over this for a while now, and it's probably a really easy solution I just can't see the answer.
So I want to take and compare one table with another table. Now the first table will have 2 columns IE, affliction + true/false. The second table has nothing but one curing tree afflictions. Like all tree or all focus.
How would I go about comparing the affliction from the first table with all of the afflictions in the second single table so I can set another variable.
if table1.stupidity == true and table.contains(table2, "stupidity") then send("whatever") do whatever end
So I've been pondering over this for a while now, and it's probably a really easy solution I just can't see the answer.
So I want to take and compare one table with another table. Now the first table will have 2 columns IE, affliction + true/false. The second table has nothing but one curing tree afflictions. Like all tree or all focus.
How would I go about comparing the affliction from the first table with all of the afflictions in the second single table so I can set another variable.
if table1.stupidity == true and table.contains(table2, "stupidity") then send("whatever") do whatever end
Like that?
for aff, v in pairs(tabletwo) do -- being a list of affs like "stupidity", "paresis" etc
if tableone[aff] then -- tableone being true.false table send("thisthatway")
I tried yours Nalor. But I had to alter it. Cause I need to compare the true/false table with the other table. Not the other way around.
So it would be something like this
for aff,i in pairs(player.affs) do
if i then
if d.afftypes.focus[aff] then
d.reclamation = d.reclamation + 1
end
end
end
Now what I was hoping that would do is check the enemy affs, find out if the aff is true, then compare it with the focus list. If the player has the aff, and it is also a focus aff then it would add 1 point to reclamation variable.
Though thinking on it I'd have to also add in a check so it's not comparing the same affliction every time so I don't get a false reading of something like 3 from one focus affliction being on there.
But back to this problem. I tried this and it doesn't do anything at all.
I don't know if it makes a difference but here's what the focus table looks like, and the player aff table.
d.afftypes.focus = {
"stupidity",
"anorexia",
"epilepsy",
"mirroring",
"paranoia",
"hallucinations",
"shyness",
"stuttering",
"dizziness",
"indifference",
"berserking",
"pacifism",
"loverseffect",
"hatred",
"generosity",
"claustrophobia",
"vertigo",
"loneliness",
"agoraphobia",
"superstition",
"masochism",
"recklessness",
"weariness",
"impatience",
"confusion",
"dementia",
"premonition",
}
player.affs(Has to be done via IG since there is no actual table, just adds and removes.)
{
insulation = true,
rebounding = false,
sileris = true
}
'Those that do not attempt are those with the least stories to tell.'
In Mudlet, is there any way to accept input from a miniconsole/label other than clicking? Ideally, a little box blips up and has text boxes you can type stuff into.
Arbre-Today at 7:27 PM
You're a vindictive lil unicorn ---------------------------
Lartus-Today at 7:16 PM
oh wait, toz is famous
Karhast-Today at 7:01 PM
You're a singularity of fucking awfulness Toz
--------------------------- Didi's voice resonates across the land, "Yay tox."
---------------------------
Ictinus — 11/01/2021
Block Toz
---------------------------
lim — Today at 10:38 PM
you disgust me
---------------------------
(Web): Bryn says, "Toz is why we can't have nice things."
In Mudlet, is there any way to accept input from a miniconsole/label other than clicking? Ideally, a little box blips up and has text boxes you can type stuff into.
Hello, I'm trying to set up a key binding for my sdk ucp ucp combo, this is what I am using send("combo " .. target " sdk ucp ucp ") But it will not fire. Would someone be able to tell me what I am doing wrong? (I do have a targeting alias set up, it looks like this: ^t (\w+)$
Logically speaking. If I use table.concat to sort a table with \n to separate the values into their own lines. Shouldn't using echo in a geyser label then spit back out the new string, with the table values sorted properly? Instead I'm just getting the string sent back as if I never used table.concat- Except there are spaces between each value.
'Those that do not attempt are those with the least stories to tell.'
Comments
I use my own function for that sort of thing: --itable script itable = itable or {} function itable:remove(t,n) local temp = {} local n = tonumber(n) local newcount = 0 for num,val in ipairs(t) do if num ~= n then newcount = newcount + 1 temp[newcount] = val end end return temp end function itable:removeall(t,v) local temp = {} local newcount = 0 for _,val in ipairs(t) do if val ~= v then newcount = newcount + 1 temp[newcount] = val end end return temp end --[[ temptable = {"item1", "item2", "item3", "item2",} display(temptable) --temptable = itable:remove(temptable,2) temptable = itable:removeall(temptable,"item3") display(temptable) ]]--
This:
local cham_number = math.random(#tw.chamlist)
send(tw.settings.defs.chameleon .. " " .. tw.chamlist[cham_number], false)
send("touch chameleon", false)
My question is: How do I populate tw.chamlist and have it cycle through it? I've tried
local tw.chamlist = {
"name1",
"name2",
}
but that doesn't seem to work.
Edit: Nevermind, I got it. Turns out lists have to be defined in scripts, not aliases.
tw.chamlist = {"king", "bob", "batman"} .... and so on :P
add: 47499
47499
add: 750
48249
add: 750
48999
add: 750
49749
add: 750
50499
add: 750
51249
add: 750
51999
add: 820
52819
add: 750
53569
add: 750
54319
add: 750
55069
add: 508
55577
add: 284
55861
add: 36
55897
add: 474
56371
add: 5 <-------- This is where stuff weirdly goes wrong.
56371
add: 447
56371447
add: 248
56371447248
add: 19
5637144724819
add: 24
5637144724819
add: 3751
56371447248193751
add: 198
56371447248193751198
add: 147
56371447248193751198147
Total:5.63714472481937529E22
$sum=0
#loo 1,%numitems(%1) {$sum=$sum+%eval(%1.%i);#say add: %1.%i;#say $sum}
#return %ansi(grey)%format("&10.0n", $sum)
Edit: It's just randomly dropping the value of one key from the dbvar sometimes. This is soooo weird. The variable itself still has all the values, it's just when I run it through the function it'll drop one of the values.
Edit2: It has to do with the actual amount in the value. 1-9 it hates. It's cool with 10. 10 is a nice number. But no way to 11, 21, 22, 23 or 24.
It looks like a type error, where it comes across a string instead of a number, and rather than returning an error, it concatenates instead of adding, which makes the whole thing a string.
That said, try doing the adding within %eval:
$sum = %eval($sum + %1.%i)
Failing that, this may be a good one for the cmud forum, as it may be a genuine bug.
Pyrolum A simple resin that releases toxic fumes when burnt.
Combust Instantly ignite resins in your presence.
Corsin A heavy resin that barely burns, but hardens rapidly.
Trientia A thin resin that ignites at a moment's notice.
Harimel A slow-burning resin that sticks to the skin.
Glauxe An adhesive resin that emits a thick smoke when burned.
Badulem An unpredictable resin that mimics venoms.
Lysirine A resin with a pleasant and sleep-inducing aroma.
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
So I want to take and compare one table with another table. Now the first table will have 2 columns IE, affliction + true/false. The second table has nothing but one curing tree afflictions. Like all tree or all focus.
How would I go about comparing the affliction from the first table with all of the afflictions in the second single table so I can set another variable.
http://forums.aetolia.com/discussion/312/mudlet-help-desk
send("whatever")
do whatever
end
Like that?
Entropy Curing System for Mudlet - FREE!
for aff, v in pairs(tabletwo) do -- being a list of affs like "stupidity", "paresis" etc
if tableone[aff] then -- tableone being true.false table
send("thisthatway")
end
end
^^ is for mudlet
So it would be something like this
for aff,i in pairs(player.affs) do if i then if d.afftypes.focus[aff] then d.reclamation = d.reclamation + 1 end end end
Now what I was hoping that would do is check the enemy affs, find out if the aff is true, then compare it with the focus list. If the player has the aff, and it is also a focus aff then it would add 1 point to reclamation variable.
Though thinking on it I'd have to also add in a check so it's not comparing the same affliction every time so I don't get a false reading of something like 3 from one focus affliction being on there.
But back to this problem. I tried this and it doesn't do anything at all.
I don't know if it makes a difference but here's what the focus table looks like, and the player aff table.
d.afftypes.focus = { "stupidity", "anorexia", "epilepsy", "mirroring", "paranoia", "hallucinations", "shyness", "stuttering", "dizziness", "indifference", "berserking", "pacifism", "loverseffect", "hatred", "generosity", "claustrophobia", "vertigo", "loneliness", "agoraphobia", "superstition", "masochism", "recklessness", "weariness", "impatience", "confusion", "dementia", "premonition", } player.affs(Has to be done via IG since there is no actual table, just adds and removes.) { insulation = true, rebounding = false, sileris = true }
send("combo " .. target " sdk ucp ucp ")
But it will not fire. Would someone be able to tell me what I am doing wrong?
(I do have a targeting alias set up, it looks like this:
^t (\w+)$
target = matches[2]:lower():title()
cecho("\n\ntarget = " .. target)
Just in case the problem might be in my targeting alias.
send("combo " .. target " sdk ucp ucp ")
should be
send("combo " .. target .. " sdk ucp ucp ")