I'm trying to build a check in for my affliction tracking that will identify if an affliction in one table (enemyafflictionlist) is present in another table (focusCures).
In the future, this will be used to count the number of mental affs, to help me track reclamation. But, for now, I can't even get it to compare the two tables.
Any help much appreciated:
function CountMentalAffs()
focusCures = {
"stupidity",
"anorexia",
"recklessness",
"indifference",
"vertigo",
"confusion",
"dizziness",
"epilepsy",
"berserk",
"masochism",
"dissonance",
"agoraphobia",
"claustrophobia",
"weariness",
"paranoia",
"dementia",
"hallucinations",
"hatred",
"pacifism",
"lonely",
"premonition"
}
for k,v in pairs(enemyafflictionlist) do
for a,c in pairs(focusCures) do
if k == a then
print("Mental")
break
else
print("NotMental")
break
end
end
end
end
When I run this, and stick a mental aff, it always returns "NotMental"
Any thoughts?
Cheers
This is actually for MUSHclient. I haven't had the time to switch my offense over to mudlet.
Unfortunately that doesn't work @kaeus - I'm assuming it's because I'm using MUSH.
@setne my abilities with lua are pretty abysmal. Most of what I've created is cobbled together from examples I've found, so there are some pretty significant gaps in my basic knowledge. e.g what the significance of pairs on an indexted table is. I'll go Google that now.
A neat efficiency trick for Lua, to avoid lots of loops like that:
Rather than a table of unlabeled values {"a", "b", "c"} where the important information is the VALUE, make it the KEY {a = true, b = true, c = true}. With this structure, testing for a word's presence in a table is as simple as table[key], leaving the Lua engine to do all the dirty work.
Trying to get my head wrapped around tracking Syssin venom afflictions on dstab.
Since adding to a string list pops it to the -bottom- of the list, and %pop pulls from the top..I'm thinking a database would be better?
Not as familiar with doing that, since for my Templar tracking I have left venom, and right venom for the two weapons. (I don't use dual, but this would be helpful for bastard sword too!)
If anyone can poke me IG or on here with some assistance, that'd be super appreciated. Just on how to add to the list, and how to pull from it, the actual affliction giving/etc, I already have.
I added this line to my system to add a alias that will fire the next time I gain balance. It seems to send the command... but instead of expanding the alias to fire it sends the whole line expandAlias("firething") when all I want is it to send this firething. Please help and this is the line I wrote to do it all.
Your addToQueue() function is probably taking an argument and using send() to send it to the game, so yes, naturally, even with the braces it'll interpret expandAlias() as a literal text command.
You're going to need to add an argument to addToQueue, and probably your queue handling script as well. Instead of adding the expandAlias() function directly, you'll want to supply either a command or an alias name, and also pass true to false.
Using the mockup code in http://pastebin.com/JZmT9YZP, you would instead want to use addToQueue("firething", true) for an alias, or just addToQueue("firething") if not.
I added this line to my system to add a alias that will fire the next time I gain balance. It seems to send the command... but instead of expanding the alias to fire it sends the whole line expandAlias("firething") when all I want is it to send this firething. Please help and this is the line I wrote to do it all.
addToQueue([[expandAlias("firething")]])
Since you're using expandAlias I'm gonna assume mudlet. Unfortunately, having no clue how the addToQueue function works, I can't really offer a fix, but usually it's better to use a function instead of using expandAlias. Have you tried just putting firething in there by itself?
FYI Mastema, the queue should automatically execute anything in it using expandAlias, you'd literally just have to do addToQueue("firething") (provided this is some variation of Earthshaker we are talking about)
Oh wow, you're right, I'm really silly. expandAlias() sends the text directly to the server if it doesn't match any aliases, so you really can use it as a catch-all. Simplifies things a lot!
Making a offensive script and hit a dead end. If anyone can understand what I am trying to do can you assist please.
send("hound initiative " .. tw.target) send("eat vial") send("soul discern " .. tw.target) if not tw.vitals.class == "carnifex" then return false end if tw.bals.both() and can:act() then if pvp.affs.shield then send("soul erode " .. tw.target) elseif pvp.affs.rebounding then send("raze " .. tw.target) if not tw.defenses.bruteforce then ---this is not firing. It should fire first before (thammer). Also it should only fire if I have a hammer wielded! As it is right now it does nothing expandAlias("force") else expandAlias("thammer") --this fires perfectly? end end end
I really wish you guys would post the information from your error window when you try to run these things. 9 times out of 10 you can figure it out from that alone.
It looks like you're missing an else between raze Target and "if not tw.defenses". Otherwise it'll try firing the code only when they have rebounding and after it sends the raze command.
¤ Si vis pacem, para bellum. ¤
Someone powerful says, "We're going to have to delete you."
the correct check for defenses in Tripwire is tw.defs.active.whatever, so your if needs to be "if tw.defs.active.bruteforce then". Should have sent me a message Mastema! =p
What is the simplest and most eloquent way to change this: <red>Affliction<white>: <white>LEFTLEGBROKEN into this: LEFTLEGBROKEN
Given the following unknowns:
The affliction may be any affliction
The colour codes may not always be red and white, so a simple :gsub("<red>Affliction<white>: <white>", "") is not the answer.
(I'm busy replacing Kaeus's spammy all-on-a-line-of-their-own system echoes with right-aligned echoes on the same line as prompts, but he's got colour tags that go on for days. It's my biggest only criticism of both Tripwire and Citadel - they're both spammy as hell.)
Ignore the above question, I solved it. I was trying to use string.findPattern() with string.gsub(), to match and remove the <colour> tags one by one. This was the long way round and was far too clunky.
Looking for help building a dwhisper script that will send 2 whispers each time I regain balance. I have no clue how to script in mudlet as to be blunt I am utterly illiterate when it comes to this aspect of mudlet, so everything just goes over my head no matter how hard people try.
I am looking to add it to a system I am currently using called Tripwire. If anyone has a clue how to do this please let me know. All it needs to do is select from a table and send the first two whispers, if the target has them already it will go to the next on the list. I understand this is a bit sad to ask for but I want to start playing again and at this point I am not going to even be of use in a simple spar. Luckly however I have a auto envenomer script which works perfectly. In terms of what I am looking for help with I do not expect to get much respect from people for doing this, but I am again -utterly illiterate- when it comes to this stuff and just do not have the ability to graps it anymore.
I can track what they have already or cured, so it is more the deliver of the whispers I need help with please.
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
So I'm working on this script for Leylines. I won't go too far into it but I need help with one part.
I'm using parts from another system and trying to tweak it. This is what I have so far.
<code>function onLeyRoom( event )
if not ksys.ley.checking or ksys.ley.checked then return false end
local thisRoom = gmcp.Room.Info.area
local checkRoom = ksys.ley.checking
for i,v in ksys.ley.RoomCor do
if i == checkRoom then
ksys.ley.connecting = {}
send("area conn")
addToQueue("ley")
ksys.ley.checked = true
end
end
end</code>
Now basically what that does is compare checkRoom and thisRoom. Originally it was:
<code>function onLeyRoom( event )
if not ksys.ley.checking or ksys.ley.checked then return false end
local thisRoom = gmcp.Room.Info.area
local checkRoom = ksys.ley.checking
if checkRoom == thisRoom then
ksys.ley.connecting = {}
send("area conn")
addToQueue("ley")
ksys.ley.checked = true
end
end</code>
But obvisouly that didn't work cause the 'checkRoom' part would look something like:
checkRoom = alaqssi_inlet
And the thisRoom would look like:
thisRoom = Alaqssi Inlet
Since there is a space in the actual GMCP room variable, and none in the checkRoom(Own personal list of areas) there's the _ to make up for a space.
What I did was make a new variable that looks like thus:
<code>ksys.ley.RoomCor = {
alaqsii_inlet = {"Alaqsii Inlet"},
the_northern_ithmia = {"the Northern Ithmia"}
}</code>
As a starter variable.
Now I'd like it so it checks both the checkRoom and the thisRoom variable against the RoomCor variable so that it matches both. Basically what the second bit of script says... But it doesn't do cause of the _ and the lower case letters.
Am I missing something obvious? Is there a way to make a table with the two various variables I need to use, then have them compared against the two variables that are set locally and then finally fire?
As a last note. I checked all variables manually, even set the locals ones to onetime variables so I could check them. They all get set correctly, it's just not matching them right with the coding I did to fire off the rest.... Any suggestions?
'Those that do not attempt are those with the least stories to tell.'
Comments
Also, have you not checked the error console? (This is for mudlet, right?)
function table.isMember(table, member)
for i, m in ipairs(table) do
if m == member then
return true
end
end
return false
end
Since adding to a string list pops it to the -bottom- of the list, and %pop pulls from the top..I'm thinking a database would be better?
Not as familiar with doing that, since for my Templar tracking I have left venom, and right venom for the two weapons. (I don't use dual, but this would be helpful for bastard sword too!)
If anyone can poke me IG or on here with some assistance, that'd be super appreciated. Just on how to add to the list, and how to pull from it, the actual affliction giving/etc, I already have.
I r crazy.
I added this line to my system to add a alias that will fire the next time I gain balance. It seems to send the command... but instead of expanding the alias to fire it sends the whole line expandAlias("firething") when all I want is it to send this firething. Please help and this is the line I wrote to do it all.
addToQueue([[expandAlias("firething")]])
Woot I will edit it. I think my brain is just dead today from looking over this old system for hours on end.
@Lin cheers that is going to give me a few ideas.
Making a offensive script and hit a dead end. If anyone can understand what I am trying to do can you assist please.
send("hound initiative " .. tw.target)
send("eat vial")
send("soul discern " .. tw.target)
if not tw.vitals.class == "carnifex" then return false end
if tw.bals.both()
and can:act() then
if pvp.affs.shield then
send("soul erode " .. tw.target)
elseif pvp.affs.rebounding then
send("raze " .. tw.target)
if not tw.defenses.bruteforce then ---this is not firing. It should fire first before (thammer). Also it should only fire if I have a hammer wielded! As it is right now it does nothing
expandAlias("force")
else
expandAlias("thammer") --this fires perfectly?
end
end
end
What is the simplest and most eloquent way to change this:
<red>Affliction<white>: <white>LEFTLEGBROKEN
into this:
LEFTLEGBROKEN
Given the following unknowns:
(I'm busy replacing Kaeus's spammy all-on-a-line-of-their-own system echoes with right-aligned echoes on the same line as prompts, but he's got colour tags that go on for days. It's my biggest only criticism of both Tripwire and Citadel - they're both spammy as hell.)
this was the solution, for anyone interested:
local s = string.findPattern(s, "[A-Z][A-Z]+")
Matching single words of only capital letters.
Looking for help building a dwhisper script that will send 2 whispers each time I regain balance. I have no clue how to script in mudlet as to be blunt I am utterly illiterate when it comes to this aspect of mudlet, so everything just goes over my head no matter how hard people try.
I am looking to add it to a system I am currently using called Tripwire. If anyone has a clue how to do this please let me know. All it needs to do is select from a table and send the first two whispers, if the target has them already it will go to the next on the list. I understand this is a bit sad to ask for but I want to start playing again and at this point I am not going to even be of use in a simple spar. Luckly however I have a auto envenomer script which works perfectly. In terms of what I am looking for help with I do not expect to get much respect from people for doing this, but I am again -utterly illiterate- when it comes to this stuff and just do not have the ability to graps it anymore.
I can track what they have already or cured, so it is more the deliver of the whispers I need help with please.
Abhorash says, "Ve'kahi has proved that even bastards can earn their place."
So I'm working on this script for Leylines. I won't go too far into it but I need help with one part.
I'm using parts from another system and trying to tweak it. This is what I have so far.
<code>function onLeyRoom( event )
if not ksys.ley.checking or ksys.ley.checked then return false end
local thisRoom = gmcp.Room.Info.area
local checkRoom = ksys.ley.checking
for i,v in ksys.ley.RoomCor do
if i == checkRoom then
ksys.ley.connecting = {}
send("area conn")
addToQueue("ley")
ksys.ley.checked = true
end
end
end</code>
Now basically what that does is compare checkRoom and thisRoom. Originally it was:
<code>function onLeyRoom( event )
if not ksys.ley.checking or ksys.ley.checked then return false end
local thisRoom = gmcp.Room.Info.area
local checkRoom = ksys.ley.checking
if checkRoom == thisRoom then
ksys.ley.connecting = {}
send("area conn")
addToQueue("ley")
ksys.ley.checked = true
end
end</code>
But obvisouly that didn't work cause the 'checkRoom' part would look something like:
checkRoom = alaqssi_inlet
And the thisRoom would look like:
thisRoom = Alaqssi Inlet
Since there is a space in the actual GMCP room variable, and none in the checkRoom(Own personal list of areas) there's the _ to make up for a space.
What I did was make a new variable that looks like thus:
<code>ksys.ley.RoomCor = {
alaqsii_inlet = {"Alaqsii Inlet"},
the_northern_ithmia = {"the Northern Ithmia"}
}</code>
As a starter variable.
Now I'd like it so it checks both the checkRoom and the thisRoom variable against the RoomCor variable so that it matches both. Basically what the second bit of script says... But it doesn't do cause of the _ and the lower case letters.
Am I missing something obvious? Is there a way to make a table with the two various variables I need to use, then have them compared against the two variables that are set locally and then finally fire?
As a last note. I checked all variables manually, even set the locals ones to onetime variables so I could check them. They all get set correctly, it's just not matching them right with the coding I did to fire off the rest.... Any suggestions?
Nothing is going to get better. It's not.”
― Dr. Seuss, The Lorax
alaqsii_inlet = {"Alaqsii Inlet"},
the_northern_ithmia = {"the Northern Ithmia"}
to
alaqsii_inlet = "Alaqsii Inlet"
the_northern_ithmia = "the Northern Ithmia"
Of course putting the variables in a table if need be, and do if table[valuechecking] then blah end