i have an alias that calls a subroutine that sets a variable, which works fine. The variable name is 'stabperson' and the contents are the playername of the person who is currently the designated 'stabber' when in a group. No worries so far.
I am then trying to set a trigger so that when that particular person (and ONLY that person) stabs something, I automatically rescue them. This is where I'm having the problem.
the syntax when they stab is
"playername places an ice chisel in the back of the..."
so I have tried setting a trigger like this..
trigger: * places
send: rescue @stabperson
i have 'expand variables' checked and have tried this trigger with ' send : rescue @@stabperson ' as well, with no luck. Ideally I want the trigger set up so that the trigger AND what it sends is particular only to whatever the variable is that I've set.. like
Ok first off.. Simply using one word to match along with the name is asking from trouble. I imagine that if 'Someone places a pot on the ground' they probably don't need rescuing. ;)
Your second problem is that using only one word like that requires regular expressions, which makes the possible errors even worse in your case since it would hit on 'any' match in which the word 'places' was found with at least one word in front of it.
So here's the simplest solution:
trigger : ^@stabperson places an ice chisel in the back of the .*
send : rescue @stabperson
Regular Expression: Checked
The .* is the key here since now the trigger says 'Match on the variable followed by "places an ice..." and then followed by anything else that may be there.', where your attempt said 'Match if there are -only- two words and the second one is "places"'.
This (assuming is even works lol) should be spoof proof, since the ^ will only allow it to match if it is at the start of the line and not in the middle of a tell, etc.
Hope this helps. It would probably be the first time I got a regular expression right the first try. ;) lol
Magnum - hehe yup I realised a little later that I had forgotton the * at the end to cover the rest of the line.. no wonder nothing would work.
Shadowfyr - unfortunately I cannot go any further than using '* places' as the weapons used vary greatly, however, the ^ is a great help, thanks.
By using the set variable at least i'll be limited to rescuing the designated stabber if they place a pot on the ground. Ya never know, it might be a very violent pot that doesn't like being placed on the ground :)
thanks again. If I have any probs, I'll post again. If not, you'll know you got it right first try :)
^@stabperson places an ice chisel in the back of the .*
won't work because of a bug in MUSHclient that is fixed in 3.23.
However for now, match on everything, and test it in a script, eg like this:
<triggers>
<trigger
enabled="y"
match="^(.*) places an ice chisel in the back of the .*"
name="stab"
regexp="y"
script="OnStab"
sequence="100"
>
</trigger>
</triggers>
Script ...
sub OnStab (sName, sLine, wildcards)
if wildcards (1) = world.getvariable ("stabperson") then
world.send "rescue " & wildcards (1)
end if
end sub
I have another one for ya.. this one hopefully more basic. All I'm trying to do is to omit output from a world.send command sent from a sub routine..
I actually got it to work, but then it seemed to also stop me viewing some things generated by the mud..
Ok, here's one of the subroutines.. all I want to see is what everyone else sees in the World.send "grouptell..", not me inputting it as well.. just for this routine only, not for all my commands. I've been trying to add in the
world.note world.EchoInput
world.EchoInput = vbTrue
world.EchoInput = vbFalse;
but it's effecting things outside the subroutine as well.. can you help? I may have just been putting the above in the wrong place, but anyway, here is the script I'm trying to amend.
sub whiner (strTriggerName, trig_line, arrWildCards)
dim maxhpVar
dim oldhpVar
dim hpVar
dim difference
hpVar = arrWildCards (1)
maxhpVar = World.GetVariable("maxhp")
oldhpVar = World.GetVariable("oldhp")
difference = oldhpVar - hpVar
if difference > 40 then
World.send "grouptell \a02\c17>>\c12 TANK REPORT \c17<<\a01\c12 " & hpVar & " / " & maxhpVar & " \a02\c17(-"
& difference & ") \a01\c12*OUCH*\a01"
World.SetVariable "oldhp", hpVar
end if
difference = hpVar - oldhpVar
if difference > 40 then
World.send "grouptell \a02\c17>>\c12 TANK REPORT \c17<<\a01\c12 " & hpVar & " / " & maxhpVar & " \a02\c15(+"
& difference & ") \a01\c12*mmm*\a01"
World.SetVariable "oldhp", hpVar
end if
end sub
Heh Heh. This is something I use extensively myself.
You should be able to put "world.EchoInput = vbFalse" just before a "World.Send" and then "world.EchoInput = vbTrue" on the line immediately after, and you will get the results you want.
In earlier versions, this was bugged, due to an inconsistency in the value stored in the VB constant vbTrue and vbFalse.
(Look for other threads on this subject "Echo Input")
Once it was pointed out, Nick fixed the bug, but I believe it may have creeped back in.
Recently, I experienced my echoinput remaining off, despite having it working properly for months in my script. Check the very recent posts, I think someone else just brought this up as well.
Hi Nick, Hi Magnum.. the one I tried was exactly as I posted, but with 'world.EchoInput = vbTrue' just before the 'World.Send' lines, and then 'world.EchoInput = vbFalse' just at the end of each 'World.Send' line. The result was exactly as Magnum said - echo input remained off.. had to switch it back on in file -> world properties -> input -> commands window.
This only happens with ones in script... selecting 'omit input' on triggers and aliases works fine.
just a fact of life?
and another stoopid question..
when I send 'rescue playername' and then fail the rescue, I get the message 'You fail the rescue!' as normal.
I want to set this as a trigger to rescue the same playername again, but since there is no char name in that message, I need to use the 'repeat last command' option to do it (manually CTRL + R).. but how to code this?
I've tried getting the trigger to fire a subroutine called repeat, and loaded in a subroutine containing
world.send world.getcommandlist (1) (0)
and keep getting errors.. *ack*
appreciate your help :)
Yeah I thought of something like that, but unfortunately it wont always be the same person, as I have yet another trigger that if someone -else- in the group needs help while we are fighting the same mob, they then 'sing', and I automatically rescue them, so basically the "You failed the rescue!' trigger will need re-rescue the person i last rescued in order to work effectively...
Can it be done?
ahh i'm kind of understanding it a bit more now..the other option is to create another routine that updates another variable every time i rescue someone, and then the 'You failed th..' trigger then will set off another *snicker* subroutine to rescue the last person rescued.. yeah. *head spins a little* ok.. i'll try that then :)
Hi Nick, Hi Magnum.. the one I tried was exactly as I posted, but with 'world.EchoInput = vbTrue' just before the 'World.Send' lines, and then 'world.EchoInput = vbFalse' just at the end of each 'World.Send' line.
That's backwards. You want False first (to turn it off), send your line, then True (to turn it back on).
I actually made the same mistake and had to edit my post to correct that, but I noticed right away.
I guess it wont hurt.. to be sure, to be sure. heh.
With the other rescue on fail one, I am suggesting to the mud scripters to amend it to 'You fail the rescue on playername' ..but I won't hold my breath. With the new variable being created every time I rescue as well as a separate variable for the stabber and more subroutines to then rescue again etc etc it's starting to create a smallish lag. If you could tell me the syntax for a trigger to repeat last command I could try it out anyway.
Thanks.. learning things is always good :)
Hiya. Using ver 3.17 client (o/s is windows 2000 pro)
I tried "world.send world.getcommandlist (1) (0)" but it didn't recognize it. I should update.
"No, no. As I said earlier up, you need to use 1, not -1."
I'm using vbs so thought it was meant to be -1 or 0.. I will change it over :)
Talked to a few ppl on mud who said one of two things in regard to failed rescues. One is to spam the original rescue, so that when the trigger to rescue someone is fired, it sends "rescue playername" 3 or 4 times.. the other option more commonly used is to repeat the last command.
hmm.. just installed ver3.20. If I have a trigger set like so:
trigger : * tells you *
send : tell %1 <auto response> I am currently AFK
In ver 3.17, without omit from output selected, I'd see them tell me something, and I would see
Airhead tells you 'ping'
tell Airhead <auto reply> I am currently afk.
You tell Airhead '<auto reply> I am currently afk.'
in the output window. With omit output selected, I'd see
Airhead tells you 'ping'
You tell Airhead '<auto reply> I am currently afk.'
which is what I wanted. On ver3.2, without selecting omit from output I get the same result as ver3.17 above.. however when I select omit from output, I do not see what Airhead tells me.. all I get is
You tell Airhead '<auto reply> I am currently afk.'
is this what should happen? does omit from output now omit whatever fired the trigeer as well?
It's really just an aesthetic thing for me.. *shrug*
Great :) been testing newer vers with the
world.send world.getcommandlist (1) (0)
on fail rescue and it works great, as does the stabber rescue.
awesome. thanks :)
The idea of "omit from output" is to omit the triggered line.
More recently, I added the extra feature that anything you send is also omitted. This is for situations like this:
Say, Magnum is annoying you with lots of tells. You set up a trigger:
Match: Magnum tells you, *
Send: tell Magnum I am ignoring you, don't bother
Omit from output: checked
The idea here is that you silently ignore the tells, and don't see the response. Otherwise you would still see your response, which would probably be just as annoying.
If you want to work around that, call a script and do the send in there.
Back to my script, I can now present messages according to my party status. Here's one example:
Sub Display_End_Inspiration (thename, theoutput, arrWildcards)
If World.GetVariable("InParty") Then
World.EchoInput = vbsFalse
LogSend "party emote no longer feels inspired."
End If
World.EchoInput = vbsTrue
End Sub
(There are calls made from some of the above routines to other routines I have not quoted)
If EchoInput ever fails for some reason (and it did a ton in that older version that was bugged), I can turn it back on quickly with an alias:
Sub Echo_On (thename, theoutput, arrWildcards)
World.EchoInput = vbsTrue
End Sub
As you can see in my "Inparty" code, I sometimes put a "World.EchoInput" in a subroutine even though I never turned it off... that was mostly a holdever from the bugged version, and I had almost every routine turn it back on just before the 'End Sub'.
Sub Display_Ends (thename, theoutput, arrWildcards)
If World.GetVariable("InParty") Then
World.EchoInput = vbsFalse
select case thename
case "inspiretrig" (or whatever you called it)
LogSend "party emote no longer feels inspired."
case ... (the rest of the labels, one after another)
end select
End If
World.EchoInput = vbsTrue
End Sub
I find it is often a lot easier to fix related stuff when you put it in one place. ;) Your tag line should be:
Something to consider. It will be much more complex though, as I have started to implement timestamps for most spells:
Sub Grab_GodShield (thename, theoutput, arrWildcards)
SS_GS = Now()
SC_GS = arrWildcards(2)
End Sub
Sub Display_End_Godshield (thename, theoutput, arrWildcards)
Dim TimeStamp
If SS_GS <> Empty Then
SD_GS = TimeDiff(SS_GS, Now())
TimeStamp = " (" & SD_GS & " - " & SC_GS & ")."
End If
If World.GetVariable("InParty") Then
World.EchoInput = vbsFalse
LogSend "party emote no longer has a Godshield." & TimeStamp
Else
World.Note "END: GodShield" & TimeStamp
End If
SS_GS = Empty
World.EchoInput = vbsTrue
End Sub
Even more complex, is the dropping of Health Blessing or Aura of Resistance, where I auto flee if it dropped while in Combat:
Sub Grab_HealthBlessing (thename, theoutput, arrWildcards)
Dim Minutes
SS_HB = Now()
SC_HB = arrWildcards(2)
If SD_HB <> Empty Then
Minutes = Mid(SD_HB, 4, 2)
Minutes = CInt(Minutes) - 3
World.AddTimer "Warning_HB_Timer", 0, Minutes, 0, "", 5, "Display_HealthBlessing_Warning"
End If
End Sub
Sub Display_End_HealthBlessing (thename, theoutput, arrWildcards)
Dim TimeStamp
FleeNow "Display_End_HealthBlessing", theoutput, arrWildcards
If SS_HB <> Empty Then
SD_HB = TimeDiff(SS_HB, Now())
TimeStamp = " (" & SD_HB & " - " & SC_HB & ")."
End If
If World.GetVariable("InParty") Then
World.EchoInput = vbsFalse
LogSend "party emote no longer has blessed health." & TimeStamp
Else
World.Note "END: Health Blessing" & TimeStamp
End If
SS_HB = Empty
World.EchoInput = vbsTrue
End Sub
Sub Display_HealthBlessing_Warning (TimerName)
If World.GetVariable("InParty") Then
World.EchoInput = vbsFalse
LogSend "party emote expects Health Blessing will drop within 3 minutes."
Else
World.Note "WARNING: Health Blessing will drop within 3 minutes."
End If
End Sub
Still, it might be worthwile to write just a few subroutines to handle all spells dropping. This too, is part of something I was thinking I could clean up and offer as a "Plugin".