Two questions

Post Reply
Epitagh
Posts: 18
Joined: Sun Sep 19, 2010 1:26 am

Two questions

Post by Epitagh »

Alright, I have two questions that I am just going to put in here.

First, there is supposedly an error in this trigger and I am not sure what it is.

Pattern : ^(\w+) flits into view directly overhead\.$

if skycall == true then
send("wt " .. matches[2] .. " is flying above.")
if matches[2] == matches[enemies]table then
send("wt PREPARING TO PULL DOWN " .. matches[2])
aatarget = matches[2]
end
end


It is suppose to match whatever is in matches[2] to see if it is in the enemies table in one of my scripts. But I get an error from it. I have never used matches[]table so I am not sure if I am using it right, but someone told me that is what it is suppose to do.

My second question is if it is possible to use the mudlet mapper for Aetolia, to make a script that runs to areas in a specific order and performs one command to check for something, then run to the next one if the check failed. I don't need to run all over the area, just need to run into say... Mamashi Grasslands, send command "leylines" and if leylines comes up with 0 results, move on to the next one. I have not looked at the mudlet mapper scripts, and wanted to know if it is possible before I try.

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Two questions

Post by Manni »

I would recommend getting a name highlighter like this one here, and modify it for your game. It's fairly easy to modify, mostly copy&paste existing code and tweak it where necessary.

you can use any enemies table if you have one, but the one above saves the tables that it uses.

Using an enemies table, your script would look something like:
Code: [show] | [select all] lua
Pattern : ^(\w+) flits into view directly overhead\.$

if skycall then 
  send("wt " .. matches[2] .. " is flying above.")
  
  if cityEnemies[matches[2]] then
    send("wt PREPARING TO PULL DOWN " .. matches[2])
    aatarget = matches[2]
  end
end

Epitagh
Posts: 18
Joined: Sun Sep 19, 2010 1:26 am

Re: Two questions

Post by Epitagh »

Thank you very much. I will probably work on that a bit later. I am specifically aiming for certain people at the moment.

Delrayne
Posts: 159
Joined: Tue Jun 07, 2011 7:07 pm
Contact:

Re: Two questions

Post by Delrayne »

Not a professional by any means but it looks to me like you need to change those send()'s to echo/cecho()'s. Send() sends commands to the game like send("kill " .. matches[2]). Echo() or cecho() just send something to the client that you want to see, it doesn't send anything to the game an example would be echo("I want to see these word in this situation because the game doesn't make it standout enough"). Now I doubt that is what is causing your error. If I had to guess it's an uninitialized variable but I hope this helps either way.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Two questions

Post by tsuujin »

Epitagh wrote:Alright, I have two questions that I am just going to put in here.

First, there is supposedly an error in this trigger and I am not sure what it is.

Pattern : ^(\w+) flits into view directly overhead\.$
Code: [show] | [select all] lua
if skycall == true then 	
    send("wt " .. matches[2] .. " is flying above.")
    if matches[2] == matches[enemies]table then
        send("wt PREPARING TO PULL DOWN " .. matches[2])
        aatarget = matches[2]
    end
end
First off, please use the Lua tags to denote code blocks, it makes it much easier to see what's going on.

The problem seems to be in the first nested if statement ("if matches[2] == matches[enemies]table then")
What you're actually doing here is saying:

if the second indexed element in the matches table is equal to the enemies element in the matches table

which doesn't make any sense. The matches table will never have an "enemies" element. Then you add the keyword "table" which is not syntactically correct. I think what you're trying to do is something like:
Code: [show] | [select all] lua
if enemies[matches[2]] then
However, I don't know for certain because you haven't provided any information on how you've set up your enemies table.

Post Reply