Newbie Rescue Trigger Question

Post Reply
gylippus
Posts: 7
Joined: Mon Jul 06, 2015 11:21 am

Newbie Rescue Trigger Question

Post by gylippus »

I barely know what I am doing and any help is appreciated.

I am trying to make a basic rescue trigger. In the prompt on my mud it will show tank name like this: TN: Brasidas

My idea was to make a perl regex trigger so I did this:

matching pattern: TN: (\w+) type perl regex

code

target = matches[2]
if target ~= Brasidas then
send("stand")
send("rescue " .. target)
end


When I use this code and use highlight function it highlights the name right after TN: so I know it is capturing the name BUT it will rescue everyone. No matter what the name is it will send the rescue. So basically I end up rescuing myself since my tanks name is Brasidas. To me, this code is saying if the person who needs to be rescued is NOT named Brasidas then execute but apparently I am completely wrong.

2nd questions - sometimes the rescue fails and it will send a message like 'you have failed the rescue'. If I get the first part to work I want to make sure it will try again just in case of failure. A success message is something like 'you have rescued (insert player's name).

Any help is appreciated. Thank you.

Moderator Edit: A previous post from the same new user contained an earlier version of this with some of the same content - it has been deleted to avoid repetition! Please can new users who have not had their first post approved hang on until it is before they repost the same or more information - it is possible to revise the original when you get approved {i.e. when someone works out that you are a human and not a spambot...}
Last edited by SlySven on Sat Jan 02, 2016 12:33 pm, edited 1 time in total.
Reason: Advise this (and other users) not to repost while awaiting approval

Drevarr
Posts: 43
Joined: Tue Aug 06, 2013 12:07 am
Location: GA, USA

Re: Newbie Rescue Trigger Question

Post by Drevarr »

Assuming you have the exact code in your post your issue is with the variable: Brasidas. I'm assuming you really wanted "Brasidas" rather than a variable Brasidas.
Code: [show] | [select all] lua
target = matches[2]
display (target)
if target ~= "Brasidas" then
	send("stand")
	send("rescue " .. target)
end
or add a tank variable for more flexibility
Code: [show] | [select all] lua
tank = "Brasidas"
Code: [show] | [select all] lua
target = matches[2]
display (target)
if target ~= tank then
	send("stand")
	send("rescue " .. target)
end

Drevarr the Old

Post Reply