I don't know too much about LUA and tables so I thought I would just put my idea up here and see if someone can tell me if it is possible and give me an idea of how I might accomplish it.
Okay so what I have is a list of targets that I want to attack. Some of these targets can be in the same room at the same time.
Lets assume your attack line is thus: "attack target" now obviously target is whatever you are targeting.
What I want to know is if there would be a way to set it up so that when you hit your attack it checks your list of targets against what is in the room and then if there is a positive hit it launches the attack. I also want it to go through the list in a certain order so you can prioritize targets automatically.
Thoughts?
Is this possible?
Re: Is this possible?
That is all quite doable, but without a bit more information it would be difficult to tell you how to proceed, really. If you get us a sampling of data we may be able to set up some skeleton code for you.
Re: Is this possible?
I am guessing this would be a multi stage of learning so lets start out with what I think should be the "easy" part...
I need to make a table/database with a list of enemies.
and an easy way to add to the list based on the target # of each target... and to prioritize them from 1-5 with 1 being high priority and 5 being low priority for targeting when they are in the room.
so I would want the command to add them to the table to be something like this:
addtarget <target#> <Priority 1-5>
I need to make a table/database with a list of enemies.
and an easy way to add to the list based on the target # of each target... and to prioritize them from 1-5 with 1 being high priority and 5 being low priority for targeting when they are in the room.
so I would want the command to add them to the table to be something like this:
addtarget <target#> <Priority 1-5>
Re: Is this possible?
table.insert(table,item,position) for the quick add.
Re: Is this possible?
Define this in a Script:
As is often the case, I make no guarantees. I wrote this in the forum itself and did not test anything.
Then, in your Alias:
That's part one, I suppose. Part two is generating the list of enemies in the room using either GMCP or Info Here. Basically, you would want to add each enemy's UID to its table in the priority list with something like...
I ran out of time, but I should be able to provide more help later if you'd like.
As is often the case, I make no guarantees. I wrote this in the forum itself and did not test anything.
Re: Is this possible?
okay i understand the part about the alias...
I don't understand what the script is doing? I have it in a script though XD
I also have no clue what to do with the table.insert part??? Where do I put it? What does it do? How do I use it?
Thanks
I don't understand what the script is doing? I have it in a script though XD
I also have no clue what to do with the table.insert part??? Where do I put it? What does it do? How do I use it?

Re: Is this possible?
The Script part simply initializes the enemy_table that we need to store our data. It could be done anywhere, but having it in a Script means it fires when the profile starts up.
Add this to the Script:
IH Capture is the trigger that actually does the work, and I can't give this to you verbatim because I don't know what the lines look like. Basically, though, as long ihCapture is true, it will try to parse the regex line provided. This then adds the enemy's ID to the appropriate table in enemy_table.
Finally, Close IH Gate turns off IH Gate and sets ihCapture to true when it runs into the prompt.
I am making the assumption here that you're on an IRE MuD. If not, this will require heavy adapting. It will still most likely need to be adapted for your specific needs, but the principles are sound. Untested, of course.
Just to make sure it's completely clear, here are screenshots: http://imgur.com/a/udIvO#0
Now that I've done most of the work for you, I'm going to leave it as an exercise for you to figure out the attack alias.
Add this to the Script:
Now, you need to trigger on Info Here (or GMCP). Every time you move, you should send( "info here" ). This is the trigger setup:
To walk you through it, the Gate simply says "Yes, we are now in an Info Here block." By setting Fire Length to 99, it's basically telling Mudlet to run the Script of this trigger for 99 more lines after the first one is true. It also checks all child triggers for each of those 99 lines, which is why this works.
IH Capture is the trigger that actually does the work, and I can't give this to you verbatim because I don't know what the lines look like. Basically, though, as long ihCapture is true, it will try to parse the regex line provided. This then adds the enemy's ID to the appropriate table in enemy_table.
Finally, Close IH Gate turns off IH Gate and sets ihCapture to true when it runs into the prompt.
I am making the assumption here that you're on an IRE MuD. If not, this will require heavy adapting. It will still most likely need to be adapted for your specific needs, but the principles are sound. Untested, of course.
Just to make sure it's completely clear, here are screenshots: http://imgur.com/a/udIvO#0
Now that I've done most of the work for you, I'm going to leave it as an exercise for you to figure out the attack alias.
Re: Is this possible?
I am playing Achaea... for info here there is no opening line, it just goes directly into the list of objects in the room and then at the end it says: "Number of objects: X" This is the only static part of info here... but it is at the bottom instead of the tope... maybe better to use GMCP instead of using info here then?
Re: Is this possible?
Make an IH alias. Set ihCapture to true in there instead of the opening trigger.
Alternatively, you can backtrack lines, but this is far more work.
Alternatively, you can backtrack lines, but this is far more work.
-
- Posts: 2
- Joined: Tue May 08, 2012 2:32 pm
Re: Is this possible?
If I'm running some triggers like this and maybe I clear all of the enemies in that room before the triggers end, could I possibly stop the attacking without deactivating this?
Send ("attack "..target)
tempTimer(3.18, [[send("attack "..target)]])
tempTimer(6.36, [[send("attack "..target)]])
tempTimer(9.54, [[send("diag me")]])
tempTimer(10.24, [[send("attack "..target)]])
tempTimer(13.42, [[send("attack "..target)]])
tempTimer(16.6, [[send("attack "..target)]])
tempTimer(19.78, [[send("diag me")]])
tempTimer(20.49, [[send("attack "..target)]])
tempTimer(23.57, [[send("attack "..target)]])
tempTimer(26.75, [[send("attack "..target)]])
tempTimer(29.94, [[send("diag me")]])
Send ("attack "..target)
tempTimer(3.18, [[send("attack "..target)]])
tempTimer(6.36, [[send("attack "..target)]])
tempTimer(9.54, [[send("diag me")]])
tempTimer(10.24, [[send("attack "..target)]])
tempTimer(13.42, [[send("attack "..target)]])
tempTimer(16.6, [[send("attack "..target)]])
tempTimer(19.78, [[send("diag me")]])
tempTimer(20.49, [[send("attack "..target)]])
tempTimer(23.57, [[send("attack "..target)]])
tempTimer(26.75, [[send("attack "..target)]])
tempTimer(29.94, [[send("diag me")]])