So I'm trying to make a trigger with two unknowns(I've also tried it with one unknown). I want to kill a monster in the room. The monster is the unknown.
---
Example:
You are in the plains of Ishtar. This is an open area where the wind sweeps
across the plain and whips your clothing about you. The long bluegrass waves
about and rustles about your ankles tickling you as you walk.
Obvious exits: east, north, west, south
Two rabbits are here.
---
Pattern: ^(.*) (.*) (is|are) here\.$
Type: Perl Regex
Script: send("kill " .. matches[3])
I get no response. I have highlighting on too.
Also I don't understand the types. I havn't seen anything in the manuals for them either.
trigger with an unknown
trigger with an unknown
Last edited by mattness on Sun May 20, 2012 3:03 am, edited 1 time in total.
Re: trigger with an unknown
Upon leaving the area I got a response:
You are at the entrance to Ishtar the land of newbies. The creatures
within are waiting to be slain by newbies. Have Fun.
Note: Type 'map' whenever you are lost
Obvious exits: north, east, west
A swirling portal and a newbie machine (Type 'pull handle') are here.
kill handle')
> No handle') here!
P.S. - I dont' know how to add the color to the post, which would be helpful.
You are at the entrance to Ishtar the land of newbies. The creatures
within are waiting to be slain by newbies. Have Fun.
Note: Type 'map' whenever you are lost
Obvious exits: north, east, west
A swirling portal and a newbie machine (Type 'pull handle') are here.
kill handle')
> No handle') here!
P.S. - I dont' know how to add the color to the post, which would be helpful.
Last edited by mattness on Sun May 20, 2012 2:43 am, edited 1 time in total.
Re: trigger with an unknown
The Save button does wonders! Got it working. lol
Re: trigger with an unknown
If there are more than one monster in the room it returns the plural version(naturally). How do I make it return the singular version?
Problem:
> You are in the forest of Ishtar. This forest is a massive stand of conifers.
Pine, spruce and hemlock stand tall and majestic all around you. A thick bed of
pine needles are on the ground and keep everything from growing.
Obvious exits: east, north, west, south
Two hares are here.
kill hares
The corpse of a hare is on the ground.
> the corpse of a hare is not a living thing!
Example:
Two hares are here.
kill hare
Problem:
> You are in the forest of Ishtar. This forest is a massive stand of conifers.
Pine, spruce and hemlock stand tall and majestic all around you. A thick bed of
pine needles are on the ground and keep everything from growing.
Obvious exits: east, north, west, south
Two hares are here.
kill hares
The corpse of a hare is on the ground.
> the corpse of a hare is not a living thing!
Example:
Two hares are here.
kill hare
Re: trigger with an unknown
I think what I need to do here is store the two unknowns as variables and if they match a pattern then send text.
Re: trigger with an unknown
What I did was just build a key/value table for all the targets I encounter.
Example:
Granted I have no idea if your mud supports gmcp and what items it stores with it if it does, but I pull room items from gmcp. Makes things like this way easier.
Example:
Then when I'm bashing, I check to see if if any of the mobs in the room match a mob in my table, if it does it sets my target variable to that mob's value in the table. So if I entered a room while bashing and saw a brown rabbit, my target would get set to rabbit.
Granted I have no idea if your mud supports gmcp and what items it stores with it if it does, but I pull room items from gmcp. Makes things like this way easier.
Re: trigger with an unknown
You can reduce your patten to something like this:
^(.+) are here$
Then split matches[2] by spaces and select the last element which should be your mob. Then check the last letter for an s and try both variants.
^(.+) are here$
Then split matches[2] by spaces and select the last element which should be your mob. Then check the last letter for an s and try both variants.
Re: trigger with an unknown
Both ideas are far above my skill level to code, but I like the table idea because when I travel across town or anything else I come in contact with my trigger activates. Not a good idea to kill the banker(or get killed by the banker more likely.)
What do I do with the variable Targets{}? And what is gmcp?
What do I do with the variable Targets{}? And what is gmcp?
Re: trigger with an unknown
Thats one thing you could do with the table
Re: trigger with an unknown
What is k and v?