Awesome. Thanks Chrio!
One more question, if you don't mind. I was going to make a trigger as a backup, for when I miss the spam or an not paying enough attention (I have needy daughters!)
My health is displayed as hp/HPMax HP. To read this and start using potions or screaming at myself would the trigger be:
(\d{1,3})/250" "HP <-- probably not right, but hopefully close. I'd be looking for my current hp out of 250 max.
Then in the script, I'd need an If/Then for
If matches[2]<100
Send("quaff potion")
Else
End
I think I could also put (\d{1,3}/(\d{3})" "HP for the trigger and it should work unless I had 1000 or more HP max....It should be something similar, I think.
Targetting help
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Targetting help
I'd try "^(\d+)/(\d+) HP" as the rexexp:
'^' = the start of the line - assuming the Server does not put anything else before what you are looking for - one MUD I have played puts in other things for whether there is light or dark (or rather you can see things which is not the same if you CAN see in the dark as one side can!) and also something if you are riding something.
\d+ means one or more number characters - and the '(' and ')'s means there are TWO capture groups.
As for the script it would probably be something like:
I won't guarantee this will be exactly what is needed but I think it covers the bases, corrections from others welcomed!
'^' = the start of the line - assuming the Server does not put anything else before what you are looking for - one MUD I have played puts in other things for whether there is light or dark (or rather you can see things which is not the same if you CAN see in the dark as one side can!) and also something if you are riding something.
\d+ means one or more number characters - and the '(' and ')'s means there are TWO capture groups.
As for the script it would probably be something like:
Code: Select all
local health = tonumber( matches[2] )
local maxHealth = tonumber( matches[3] )
if health > 0 and maxHealth > 0 and (health/maxHealth) <= 0.4 then
Send("quaff potion")
end
Re: Targetting help
I didn't have much time last night to trouble-shoot, but this wasn't working. I thought maybe it was because the health isn't part of the scrolling text, it just stays in the bottom line. Even if I would say 35/200 HP it wasn't triggering anything though. It's possible I typed something incorrectly, but could there be another issue? Does it matter if the text doesn't scroll with the battle spam? Is there something in the coding that needs changed?SlySven wrote:I won't guarantee this will be exactly what is needed but I think it covers the bases, corrections from others welcomed!Code: Select all
local health = tonumber( matches[2] ) local maxHealth = tonumber( matches[3] ) if health > 0 and maxHealth > 0 and (health/maxHealth) <= 0.4 then Send("quaff potion") end
Re: Targetting help
Sounds like you may have triggers that capture the hp elsewhere and presents it at the bottom of the screen? If that's the cas you can press the "emergency stop" toggle in the bottom right corner of mudlet (it's a black sphere) and you should see the input unchanged by any triggers.
Try that and see what happens.
Try that and see what happens.
Re: Targetting help
There is a prompt at the bottom of the screen. The default shows hp, mana, moves, target, and exp. You can alter it to have alignment, location, invis, etc.
It is the only thing that has your health, aside from the score command that shows your player status (stats, gold, deity, etc.)
What I was trying to do is read the prompt with a trigger to heal when I'm dying.
It is the only thing that has your health, aside from the score command that shows your player status (stats, gold, deity, etc.)
What I was trying to do is read the prompt with a trigger to heal when I'm dying.
Re: Targetting help
Ok. I got the trigger to work. It was having trouble reading my health because I had [Name] in front of the hp. I rewrote the prompt to stay with health and ended up using perl regex of (\*)/(\*) HP for the trigger.
The problem I'm having now is this. I put a temp timer on it and it seems to work outside of combat. In combat, tons move so fast it spams the trigger whether I have a finger of a few seconds or scan up to 20 seconds. Maybe I need to disable the trigger one it's triggered and then turn it back on somehow?
The problem I'm having now is this. I put a temp timer on it and it seems to work outside of combat. In combat, tons move so fast it spams the trigger whether I have a finger of a few seconds or scan up to 20 seconds. Maybe I need to disable the trigger one it's triggered and then turn it back on somehow?
Re: Targetting help
You could do that, or use a variable and check against that to avoid spam. This for instance, will do the action when hp dips below 100, but will not do it again until it's been above 150:Duugan wrote:The problem I'm having now is this. I put a temp timer on it and it seems to work outside of combat. In combat, tons move so fast it spams the trigger whether I have a finger of a few seconds or scan up to 20 seconds. Maybe I need to disable the trigger one it's triggered and then turn it back on somehow?
Re: Targetting help
Ok, well I used a combination of stuff to get it how I have it now.
Thanks again guys. I doubt I'd ever have been able to figure ANY of this out without your help!
Thanks again guys. I doubt I'd ever have been able to figure ANY of this out without your help!
Re: Targetting help
Any idea how to get a trigger for HP with <Name><###/### HP?
My wife is stubborn and I haven't been able to get it to register...
My wife is stubborn and I haven't been able to get it to register...
Re: Targetting help
I convinced her to change it to Name ###/### HP and that works just fine.