and now for something a bit more advanced. (rescue scripts)

Post Reply
sil
Posts: 6
Joined: Thu Feb 07, 2013 2:54 am

and now for something a bit more advanced. (rescue scripts)

Post by sil »

Hi again. I don't want to be a bother, but I really have no clue how to even start figuring out how to do what i want to do with a rescue trigger

I'll start with what i'm looking for.

a table of members of my group who when they are being attacked i can type in an alias to have them rescued.

I would like to be able to add the members of the group to a table in order of importance (like put bob first because he's a healer and joe last because he's another tank)

the syntax of someone getting his is

Hoil easily ducks under the dangerous looking rogue's lame kick.
The dangerous looking rogue attacks Hoil. [1 hits]

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few scratches>
Hoil attacks the dangerous looking rogue. [0 hits]

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few scratches>

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few scratches>

You feel your skill in 2h slashing improving.
-=[You attack the dangerous looking rogue.]=- [2 hits]

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few wounds>

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few wounds>
The dangerous looking rogue attacks Hoil. [0 hits]

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few wounds>
A slack-jawed prostitute attacks the dangerous looking rogue. [0 hits]

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few wounds>
Hoil attacks the dangerous looking rogue. [0 hits]

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few wounds>

Hoil says in common 'zzZzssZtraonge'

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: few wounds>

-=[You attack the dangerous looking rogue.]=- [1 hits]

< 1275h/1275H 250v/250V Pos: standing >
< T: Hoil TP: sta TC: few scratches E: rogue EP: sta EC: nasty wounds>

Hoil's face turns pale as the dangerous looking rogue slams his head into his face.
The dangerous looking rogue attacks Hoil. [0 hits]

or if the batttle is initiated

A giant tarantula suddenly attacks Hoil!

So if hoil is on the list, i want to rescue him

I would want it to say

rescue hoil all

problem is is that he might get hit a few times before the rescue goes through.... i would need it to trigger once.

So yea. If someone can lead me in the right direction that would be awesome.

If you need anymore info or i forgot something please let me know.

Thanks again.

sil
Posts: 6
Joined: Thu Feb 07, 2013 2:54 am

Re: and now for something a bit more advanced. (rescue scrip

Post by sil »

Ok after doing some research i have come up with the following

Scripts

myrescues = {}

aliases
^radd (.*)$

table.insert( myrescues, matches[2] )
echo( "Added a new rescue:" .. matches[2] .. "\n" )

trigger

it's not setting off the trigger.. im having trouble making it recognize the pattern correctly..

attacks (/w+).

this is what it looks like in the mud

A militia guard attacks Brunk. [1 hits]


if table.contains(rescuelist, matches[2]) then
send ("rescue " .. matches[2] .. " all")
end


am i on the right track?

tarkenton
Posts: 30
Joined: Thu Feb 07, 2013 7:33 am

Re: and now for something a bit more advanced. (rescue scrip

Post by tarkenton »

Try something like this for matching in the trigger, and make sure you change the match type to regexp. According to http://gskinner.com/RegExr/ it matches the line.

Code: Select all

^(.*) attacks (\w+). (.*)$
Also, for your bit of script inside the trigger itself, wouldn't you need to use myrescues instead of rescuelist? Also, I think you'll need to use matches[3] instead of matches[2]if you use the regexp I gave you.

sil
Posts: 6
Joined: Thu Feb 07, 2013 2:54 am

Re: and now for something a bit more advanced. (rescue scrip

Post by sil »

Thank you!! I got it working!! It's basic, but it serves the purpose.

One quick question.

What is and where can I type something to clear the list totally?

Thanks!

tarkenton
Posts: 30
Joined: Thu Feb 07, 2013 7:33 am

Re: and now for something a bit more advanced. (rescue scrip

Post by tarkenton »

This is just me guessing, haven't tried it yet, but I'd think making an alias whose command/code in it is rescuelist = {} would clear it. I'll double check this after I get some sleep.

Golem
Posts: 30
Joined: Thu Feb 07, 2013 6:46 pm

Re: and now for something a bit more advanced. (rescue scrip

Post by Golem »

That will work in most of the basic cases, however the best way to do it is to assign nil values to all of the table's keys.

Post Reply