Okay so I've been trying to set up a script to suggest a hypnosis and then move onto the next hypnosis in my priority list. The problem I have is that it just keeps suggesting the first hypnosis in my list. This is my code:
function AssassinHypnosis()
local nextHypnosis = combat.priority.hypnosis.lock or combat.priority.hypnosis.remove("lock", 1)
Okay so I've been trying to set up a script to suggest a hypnosis and then move onto the next hypnosis in my priority list. The problem I have is that it just keeps suggesting the first hypnosis in my list. This is my code:
function AssassinHypnosis()
local nextHypnosis = combat.priority.hypnosis.lock or combat.priority.hypnosis.remove("lock", 1)
First, awesome on you for encapsulating your variable names in namespaces, using local variables, and abstracting out into a function instead of just dropping the code right in a script.
It looks like the problem is the assignment to nextHypnosis -- I suspect the second half of the logical extension is never firing, or if it is, its not removing anything, because you've already asserted that the thing you're trying to remove does not exist.
Mind demonstrating what the data structure stored in combat.priority.hypnosis looks like? Also possibly the definition for getAffHypnosis(), if its not just a one liner mapping priority.hypnosis to aff names I'll be able to offer slightly more targeted help if I know those things.
Converting to Mudlet. I'm utterly inept right now. I'm trying to set up a trigger to tell my system that I'm off balance. I'm trying to use the: Balance Taken: 4.7s line as the trigger.
Punctuations like : and . usually need to be preceeded by a \ so that they won't be considered as variables (rather, they'll be considered as part of the actual regex trigger).
Edit:
You can also do ^Balance Taken\: (.*)s$
(.*) captures any character (so it would capture 4.7 as "4.7", rather than the previous trigger which would capture 4.7 as "4" and "7").
currently tentatively active (may vanish for periods of time)
(\w+) : Capture one or more word characters. Generally speaking, this is a-z, A-Z, 0-9, and the underscore character
(\d)(\w+) : Capture one or more digits in one variable(eg: $1) and then capture one or more word characters in a separate variable(eg: $2)
The one thing all those patterns have in common is that they fail to account for the '.' in the number. You have to remember, regex doesn't consider "1.2" to be a floating point number; it sees characters without context. '1' is a number, '.' is a period and not part of a number, '2' is a number. And so "(\d+)s" does not match "1.2".
The pattern I would probably use is:
(\d+\.\d+) : Capture one or more digits, a period, and one or more digits. The period has to be represented as '\.' because '.' means "any character". The backslash escapes the special meaning of the period, making it just a character.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
You might find this site useful regexpal.com for testing your patterns.
If you paste the test line in first, and then type in the regex, you can see it being highlighted yellow (indicating that the pattern is being matched) as you go, and it becomes pretty obvious the moment you make a mistake.
Incidentally, unless you're specifically trying to capture the balance loss number for something (cooldown timers maybe?) then there is no need to make that trigger a regular expression.
Choose "Begin of line substring" as the trigger type, and "Balance Taken:" as the pattern.
This shadowplant script is seriously going to drive me INSANE. Why is it telling me he eats a shadowplant when he eats a hyssop when I shadowplanted kelp?!?!?!?!?!
Your aura of weapons rebounding disappears. (Defense): Lost Antiweaponfield You rub some hemotoxin on a needle-pointed dirk. Weapon: [VENOM : HEMOTOXIN] Weapon: [VENOM : HEMOTOXIN] You prick Mereis quickly with your dirk. CombatSystem: [ENEMY AFFLICTED WITH HEMOTOXIN] Mereis pales suddenly and slumps perceptibly. You rub some oxalis on a needle-pointed dirk. Weapon: [VENOM : OXALIS] Weapon: [VENOM : OXALIS] Maintaining your balance, you deftly prick Mereis again. CombatSystem: [ENEMY AFFLICTED WITH BLIND] Balance Taken: 2.80s Health:105 Mana:352 (e-) You force a small opening in your wormhole and a shadowy replica of a piece of kelp pops out of it and lands in Mereis's hands. SHADOWPLANT: KELP Equilibrium Taken: 2.80s < equilibrium > Health:105 Mana:342 (--) Mereis takes a drink from a simple isan vial. Health:105 Mana:342 (--) Mereis quickly eats a piece of kelp. Person ate a kelp CombatSystem: ENEMY CURED HEMOTOXIN (herb/slice) Mereis's colour returns to her face. Health:105 Mana:342 (--) < linseed pipe > ( 5 left ) Health:105 Mana:342 (--) You may drink another healing elixir. ( sipped ) Health:105 Mana:342 (--) You find an elixir of mana too irresistible and drink it instead. You take a drink of an elixir of mana from a wooden vial. < sipped > Your mind feels rejuvenated. Health:105 Mana:371 (--) A small black cobra's hood flares as it darts forward to bite Mereis. Health:105 Mana:371 (--) ds;kk lua AssassinVenom() order loyals attack Mereis dstab Mereis hemotoxin mercury worm shadowplant Mereis kelp You feel a sudden disturbance and pain floods you as you watch the residual light from the flash. Damage Taken: 42 magickal, mental (raw damage: 47) [Affliction]: You have Epilepsy Health:63 Mana:371 (--) You may eat another herb or plant. ( herb ) Health:63 Mana:371 (--) You quickly eat a wormwood root. < herb > Your terrible addiction to lovely elixirs seems to wane. [Affliction] Cured: Addiction Health:63 Mana:371 (--) Mereis quickly eats some hyssop stem. Person ate a hyssop SHADOWPLANT EATEN
This is my setup:
Trigger: ^You force a small opening in your wormhole and a shadowy replica of a piece of kelp pops out of it and lands in .+ hands.$
More importantly, your TrackSlice should compare what is eaten (I'm guessing that's the 'name' argument) with the shadow plant type, for accuracy's sake. Something like, if ... And ... And ... And "shadow"..name == shadow then
^(\w+) quickly eats (some|an|a) (.+)\.$ is triggering on the hyssop and calling TrackSlice. You didn't have a check in TrackSlice to see if the herb matched the shadow plant.
You're right. My shadowplant trigger was setting shadow to "shadownone" instead of "shadowkelp" or whichever herb it was. I'll test it in a few to see if that fixed it.
Oh I made a big booboo in that one but my face is too tired to try and fix it and you're right Cassius I need to do something like.. And shadowplanted == name then
Comments
function AssassinHypnosis()
local nextHypnosis = combat.priority.hypnosis.lock or combat.priority.hypnosis.remove("lock", 1)
send("suggest "..dabomb.target.." "..getAffHypnosis(nextHypnosis[1]))
end
if (hypnoadded > #Hypnosislockqueue) then
hypnoadded = 1
else
hypnoadded = hypnoadded + 1
end
It looks like the problem is the assignment to nextHypnosis -- I suspect the second half of the logical extension is never firing, or if it is, its not removing anything, because you've already asserted that the thing you're trying to remove does not exist.
Mind demonstrating what the data structure stored in combat.priority.hypnosis looks like? Also possibly the definition for getAffHypnosis(), if its not just a one liner mapping priority.hypnosis to aff names I'll be able to offer slightly more targeted help if I know those things.
I'm trying to set up a trigger to tell my system that I'm off balance. I'm trying to use the: Balance Taken: 4.7s line as the trigger.
^Balance Taken\: (\d+)\.(\d+)s$
Punctuations like : and . usually need to be preceeded by a \ so that they won't be considered as variables (rather, they'll be considered as part of the actual regex trigger).
Edit:
You can also do
^Balance Taken\: (.*)s$
(.*) captures any character (so it would capture 4.7 as "4.7", rather than the previous trigger which would capture 4.7 as "4" and "7").
(may vanish for periods of time)
Explanation:
The one thing all those patterns have in common is that they fail to account for the '.' in the number. You have to remember, regex doesn't consider "1.2" to be a floating point number; it sees characters without context. '1' is a number, '.' is a period and not part of a number, '2' is a number. And so "(\d+)s" does not match "1.2".
The pattern I would probably use is:
(\d+\.\d+) : Capture one or more digits, a period, and one or more digits. The period has to be represented as '\.' because '.' means "any character". The backslash escapes the special meaning of the period, making it just a character.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
regexpal.com
for testing your patterns.
If you paste the test line in first, and then type in the regex, you can see it being highlighted yellow (indicating that the pattern is being matched) as you go, and it becomes pretty obvious the moment you make a mistake.
Incidentally, unless you're specifically trying to capture the balance loss number for something (cooldown timers maybe?) then there is no need to make that trigger a regular expression.
Choose "Begin of line substring" as the trigger type, and "Balance Taken:" as the pattern.
I'll pester folks in clans and such as much as I can, but I'm pretty sure I'll be burning up this forum thread a good bit too.
Your aura of weapons rebounding disappears.
(Defense): Lost Antiweaponfield
You rub some hemotoxin on a needle-pointed dirk.
Weapon: [VENOM : HEMOTOXIN]
Weapon: [VENOM : HEMOTOXIN]
You prick Mereis quickly with your dirk.
CombatSystem: [ENEMY AFFLICTED WITH HEMOTOXIN]
Mereis pales suddenly and slumps perceptibly.
You rub some oxalis on a needle-pointed dirk.
Weapon: [VENOM : OXALIS]
Weapon: [VENOM : OXALIS]
Maintaining your balance, you deftly prick Mereis again.
CombatSystem: [ENEMY AFFLICTED WITH BLIND]
Balance Taken: 2.80s
Health:105 Mana:352 (e-)
You force a small opening in your wormhole and a shadowy replica of a piece of kelp pops out of it
and lands in Mereis's hands.
SHADOWPLANT: KELP
Equilibrium Taken: 2.80s < equilibrium >
Health:105 Mana:342 (--)
Mereis takes a drink from a simple isan vial.
Health:105 Mana:342 (--)
Mereis quickly eats a piece of kelp. Person ate a kelp
CombatSystem: ENEMY CURED HEMOTOXIN (herb/slice)
Mereis's colour returns to her face.
Health:105 Mana:342 (--)
< linseed pipe > ( 5 left )
Health:105 Mana:342 (--)
You may drink another healing elixir. ( sipped )
Health:105 Mana:342 (--)
You find an elixir of mana too irresistible and drink it instead.
You take a drink of an elixir of mana from a wooden vial. < sipped >
Your mind feels rejuvenated.
Health:105 Mana:371 (--)
A small black cobra's hood flares as it darts forward to bite Mereis.
Health:105 Mana:371 (--) ds;kk
lua AssassinVenom()
order loyals attack Mereis
dstab Mereis hemotoxin mercury
worm shadowplant Mereis kelp
You feel a sudden disturbance and pain floods you as you watch the residual light from the flash.
Damage Taken: 42 magickal, mental (raw damage: 47)
[Affliction]: You have Epilepsy
Health:63 Mana:371 (--)
You may eat another herb or plant. ( herb )
Health:63 Mana:371 (--)
You quickly eat a wormwood root. < herb >
Your terrible addiction to lovely elixirs seems to wane.
[Affliction] Cured: Addiction
Health:63 Mana:371 (--)
Mereis quickly eats some hyssop stem. Person ate a hyssop
SHADOWPLANT EATEN
This is my setup:
Trigger: ^You force a small opening in your wormhole and a shadowy replica of a piece of kelp pops out of it and lands in .+ hands.$
shadowplanted = false
shadow = "shadownone"
if plantedtimer then killTimer(plantedtimer) end
plantedtimer = tempTimer(1, [[shadowplanted = true]])
if shadowtimer then killTimer(shadowtimer) end
shadowtimer = tempTimer(1, [[shadow = "shadowkelp"]])
if plantedtimer1 then killTimer(plantedtimer1) end
plantedtimer1 = tempTimer(4, [[shadowplanted = false]])
cecho("<orange_red>\nSHADOWPLANT: KELP")
Trigger: ^.+ quickly eats a piece of kelp.$
if shadowplanted == true and shadow == "shadowkelp" then
shadowplanted = false and killTimer(plantedtimer1)
end
Cure Tracking Script:
function TrackSlice(name)
if combat.afflictions.paralysis and shadowplanted == true
and shadow == "shadowmaidenhair" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.sensitivity and shadowplanted == true
and shadow == "shadowmaidenhair" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.numbness and shadowplanted == true
and shadow == "shadowmaidenhair" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.slickness and shadowplanted == true
and shadow == "shadowmaidenhair" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.frostbite and shadowplanted == true
and shadow == "shadowmaidenhair" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.limbparalysis and shadowplanted == true
and shadow == "shadowmaidenhair" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.asthma and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.hemotoxin and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.butisol and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.clumsiness and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.weakness and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.attunedtowater and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.healthleech and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.rigidity and shadowplanted == true
and shadow == "shadowkelp" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.sunallergy and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.nausea and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.lethargy and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.attunedtoearth and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.haemophilia and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.burningnerves and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.dryblood and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.recurringfreezing and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.sulfonal and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
elseif combat.afflictions.tainattunement and shadowplanted == true
and shadow == "shadownightshade" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
else
for _,v in ipairs(tarcuringorder[name]) do
if combat.afflictions[v] then
combat.afflictions[v] = false
combat.afflictions.anorexia = false
echo("\nCombatSystem: ENEMY CURED " .. string.upper(v) .. " (herb/slice)")
enemyAffshow()
return
end
end
end
end
What am I doing wrong?
So I should do something like this?
Trigger: ^.+ quickly eats a piece of kelp.$
herb = "kelp1"
if shadowplanted == true and shadow == "shadowkelp" then
shadowplanted = false and killTimer(plantedtimer1)
end
Then for Trackslice:
elseif combat.afflictions.asthma and shadowplanted == true
and shadow == "shadowkelp" and herb == "kelp1" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
^(\w+) quickly eats (some|an|a) (.+)\.$
local sub_eherb = {
["galingale flower"] = "galingale",
["hyssop stem"] = "hyssop",
["juniper berry"] = "juniper",
["piece of kelp"] = "kelp",
["maidenhair leaf"] = "maidenhair",
["mandrake root"] = "mandrake",
["nightshade root"] = "nightshade",
["orphine seed"] = "orphine",
["wormwood root"] = "wormwood",
}
if table.contains(sub_eherb, matches[4]) then
local eherb = sub_eherb[matches[4]]
cecho(" <yellow>Person ate a " .. sub_eherb[matches[4]])
TrackSlice(eherb)
end
end
If that has anything to do with it?
elseif combat.afflictions.asthma and shadowplanted == true
and shadow == "shadowkelp" and herb == "kelp1" then
cecho("<orange_red>\nSHADOWPLANT EATEN")
and it just stopped working completely.
Try echoing the values locally so you can check them. Or use the lua alias to check them.
You force a small opening in your wormhole and a shadowy replica of a maidenhair leaf pops out of it and lands in .+ hands.
and then
if combat.afflictions.paralysis and shadowplanted == true
but its still triggering off other herbs than the one shadowplanted.