|
Dumond Newbie
Joined: 01 Nov 2004 Posts: 4
|
Posted: Mon Nov 01, 2004 5:27 pm
Need help creating a trigger |
I am trying to strip a single word or even first three letters of a word from a line of mud output. When i look a direction i get the following output:
You see nothing special.
You see the Atlantean Palace Guard, the Atlantean Palace Guard, the Atlantean Palace Guard and the Atlantean Palace Guard.
I want to load atlantean or atl into a variable @fltgt.
another example is:
You see nothing special.
You see a Troll, the Crawler and a Troll.
I want to capture the first mob not all mobs..so in the second case just Troll
Any assistance would be greatly appreciated
Thanks in advance |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Nov 02, 2004 12:16 am |
For Troll
#TR "see" {You see (*).} {#VAR mob %word(%word( "%1", 1, ","),%numwords(%word( "%1", 1, ","))} |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Tue Nov 02, 2004 2:03 am |
Try this.
#TRIGGER {You see nothing special.} {}
#CONDITION {You see {a|an|the} (*).} {fltgt = %word("%1",1," ")} |
|
|
|
Dumond Newbie
Joined: 01 Nov 2004 Posts: 4
|
Posted: Tue Nov 02, 2004 4:35 am |
Thanks for the posts.
Nexela,
Is that capturing all of the mob names into an array?? if so how do i access them.
Vorax,
Good call on the a, an, the. I got this to work before these posts but it took multiple triggers for the a|an|the.. i will have to try and get your version working.
Also now that i think about it...it would be nice to be able to target the last mob in the room first. I am using this trigger on a ranger character to fire on mobs in the next room...so if i target the first and he enters my room to attack me..i may fire on a second character..not really great to bring multiple of these monsters in at one time..hehe
So I have a basic trigger working..now does anyone have any suggestions for being able the last mob in the room?
Ok the more I think about this it is much harder than I initially thought. If there are multiple named mobs in the other room...i need to be able to count each type so i can fire on the last one. I.E. if there are 5 ogres, 3 trolls, and a rat..they will display something like:
ogre, a troll, ogre, rat, ogre, a troll, a troll, ogre, ogre
so i would need to be able to count each type up so i can fire on 5.ogre or 3.troll.
If you are willing to tackle this or point me in the right direction to do this i would appreciate it..and if not..thanks for your help so far. |
|
|
|
fightcancer Beginner
Joined: 01 Nov 2004 Posts: 17
|
Posted: Wed Nov 03, 2004 5:00 pm |
First off, I'm an amateur coder.
Second, I thought of a way u may be able to attack the last monster. Use lists. Everytime the TRIGGER ID's a monster, it should add that name of the monster to a string using %additem (not #ADDITEM). Your list variable might be something like @Monsters.
In your example above, the list was heterogenous, and u probably want to break the mobs up into categories. so ya might want to use %countlist. (?) If the list had been all the same monster, then u could use something like the code below.
So you've got 9 ogres in the list and u want to attack ogre number 9. Use %numitems to count how many items are in your list. Then issue a command to attack that monster--something like
"kill %numitems.%item(Monsters,%numitems(Monsters))"
I'm expecting the code to send this command: kill 9.ogre
Hope this helps. |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Thu Nov 04, 2004 11:02 am |
Quote: |
So you've got 9 ogres in the list and u want to attack ogre number 9. Use %numitems to count how many items are in your list. Then issue a command to attack that monster--something like
"kill %numitems.%item(Monsters,%numitems(Monsters))" |
Should be more like:
kill %numitems(Monsters).%item(@Monsters,%numitems(Monsters)) |
|
|
|
|
|