Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ DeleteLines not working for me
DeleteLines not working for me
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Hoffer1955
(4 posts) Bio
|
Date
| Thu 23 Jul 2015 10:27 PM (UTC) |
Message
| I'm having trouble getting the DeleteLines() function to work in my plugin I am writing. Here is my trigger:
<trigger
enabled="y"
keep_evaluating="y"
match="^(.+) (\d+)\% is tanking (.+)"
omit_from_output="n"
regexp="y"
repeat="n"
send_to="12"
sequence="100"
>
<send>
delete_output(2)
ColourNote("cyan","black","%1 is tanking %3 and is at %2\% health")</send>
</trigger>
Originally I had the trigger omit the line from the output and replace it with my own, but I want to actually remove more than one line from the output once the trigger activates. I assume DeleteLines() is the best way to do this? The delete_output() is just a script function that calls DeleteLines(2).
Here's what happens when the trigger activates:
You fail to hit the Air Queen with your first attack.
The Air Queen is burned on the head with your flames causing slight damage.
The Air Queen is burned on the head with your flames causing slight damage.
The Air Queen is burned on the wing with your flames causing insignificant damage.
You are impacted on the leg by the Air Queen's whirlwind causing modest damage.
You are impacted on the head by the Air Queen's whirlwind causing middling damage.
You dodge out of the way of the Air Queen's third attack.
The Air Queen is in terrible condition[25-35%].
<1995hp 926sp 3309st>
Hoffer 51% is tanking the Air Queen
Hoffer is tanking the Air Queen and is at 51% health
The Air Queen is in terrible condition[25-35%].
<1995hp 926sp 3309st>
What I'm trying to accomplish is delete the 1st line after the prompt (Hoffer 51%...) and the two lines below my ColourNote(). I know the ordering of the lines is kind of messed up, but I can't get the DeleteLines() function to actually delete anything from the ouput, no matter what number I throw into the function. What am I doing wrong? | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Fri 24 Jul 2015 09:42 PM (UTC) |
Message
|
Quote:
Warning - do NOT call DeleteLines from a trigger, alias or timer using send-to-script. For design reasons this will not work. In version 3.76 you will cause the client to crash if you do this. In version 3.77 upwards it will silently fail (ie. do nothing).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Hoffer1955
(4 posts) Bio
|
Date
| Reply #2 on Fri 24 Jul 2015 10:47 PM (UTC) |
Message
| It says in the documentation:
Quote:
If you want to call DeleteLines from a trigger you must call a function in your script file (or plugin script), not directly from send-to-script.
That's what I tried to do by having the trigger call a function in the script section. Here's the function in the script section:
function delete_output (lines)
DeleteLines(lines)
end
Thanks for the help. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #3 on Fri 24 Jul 2015 11:28 PM (UTC) |
Message
| I see. You aren't allowed to use send-to-script to delete lines, so you called a function to do it. Nope. That just moves the problem slightly. You aren't allowed to delete lines from send-to-script, no matter how many function calls you make.
You are allowed to do it if you don't use send-to-script, but put a function name in the "script" box for the trigger, and call it that way. Those functions are called at a different time, when the client allows you to delete lines.
A function like:
function MyTrigger (name, line, wildcards, styles)
-- code here
end -- function MyTrigger
Put that in your script file, and put MyTrigger as the script name in the trigger. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
13,036 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top