 |
Tyrinath Newbie
Joined: 29 Jul 2007 Posts: 3
|
Posted: Mon Jul 30, 2007 2:46 am
Prioritizing Trigger |
Hey, first of all, I'm new to the world of trigger making etc, so I'm not entirely up to scratch on all the commands and features I can use to make things magically happen - So I was wondering if anyone had the knowledge and time to help me with a little issue I'm trying to resolve.
What I want to create is a trigger that will take in information when I enter a room, then prioritize the information and deal with it accordingly. An example of which is if I'm leading a group through a zone, I may walk into a room with a variety of creatures, some that are more deadly than others and will aggro on weak players in the group. So I'd want the trigger to see what monsters are actually there, then determine from a list or something which is the most troublesome, and deal with that first.
Example:
'A very aggressive demon stands here snarling at you'
'A wimpy looking demon cowers here in fear'
'A demon stands here with fire burning in his eyes'
What I'd want to make, is a class or some-such that would contain the above three descriptions, and somehow give them a tag that shows their difficulty, then if I walk into a room with all three of them, it would attack the most difficult first, then repeat until all were dealt with.
Is this kind of trigger possible? I understand it might be a bit complex, which is why I'm having trouble creating anything myself, so if anyone has the time and patience to perhaps try and help and explain how I can make it work, It'd be very appreciated. :) |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jul 30, 2007 3:09 am |
It's very possible, and it doesn't need to be too complex. The trouble is if you can have more than one thing with the same short name but different levels of aggro-ness (like in your example). If that doesn't actually happen in the MUD, something like this might work.
Inside a class that's disabled at startup, you have a load of triggers that look like this:
#trig {A very aggressive demon stands here snarling at you} {#var MobList %additem("100-demon",@MobList)}
where the number is the monster's "danger rating" with lower numbers being less dangerous. This number can be from 000 to 999, and "10" needs to be "010". Then have a trigger to turn the class on and off, like this:
#trig {the exit line of your rooms} {MobList=""#t+ classname;#alarm +2 {#t- classname}}
Then finally, your alias to pick something to kill
#alias killsomething {kill %right(%item(%sort(@MobList),1),4)}
This works by sorting the moblist in descending order, taking the first item from the resulting list, and then trimming off the first four characters. There are other ways to do it, but this is the simplest I could think of.
NB: Version 2 of CMUD will include a new #sort command that'll keep the list sorted even when you add items to it. Excellent for scripts like this. |
|
|
 |
Tyrinath Newbie
Joined: 29 Jul 2007 Posts: 3
|
Posted: Mon Jul 30, 2007 3:32 am |
I think I understand the majority of that, I should be able to tweak around with some of the things I already have an encorporate that into it, however there is one or two things that confuse me about it, and I apologize if they're silly misunderstandings. ;p
The line where you say: #trig {the exit line of your rooms} {MobList=""#t+ classname;#alarm +2 {#t- classname}} - Now, it's the "exit line of your room" part that I'm trying to determine. How exactly would that be defined? I mean, if I give the example of,
A Dark Passage
The dark passage leads deeper into castles dungeons
Exits: West, North
A very aggressive demon stands here snarling at you
A wimpy looking demon cowers here in fear
From that example, what would be determined as the exit line of the room? I was thinking something like "Exits" etc, but then the mobs themselves appear after that, so I thought that might not work correctly. Also, with the alias, is that something that I would actually have to use, or is it purely just for sorting them, or better yet, would it automatically respond and do the action itself? |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4718 Location: Pensacola, FL, USA
|
Posted: Mon Jul 30, 2007 4:00 am |
I would assume that there are no prompts until after the room and contents, including the mobs.
If that is the case... use the prompt to turn it off. |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jul 30, 2007 4:02 am |
The mobs are supposed to appear after the exit line (the exit line trigger uses #t+ to turn on the class of mob-detecting triggers). Your exit line in this case is "Exits: West, North" but since exits change all the time, you'd probably be best using a pattern of "^Exits:", perhaps with case sensitivity turned on.
|
|
|
 |
Tyrinath Newbie
Joined: 29 Jul 2007 Posts: 3
|
Posted: Mon Jul 30, 2007 2:19 pm |
Okay, thanks for the help so far! Now, I've been given a section of triggers by a friend, who uses zMud 7.21, but obviously I've had to convert it to work in CMud, now the difficulty is that I don't think the commands used are entirely compatible, and I can't get these triggers to work in order to continue tweaking and working on them to add in this feature I'm trying to build. I'd put the triggers up here but I'm respecting the wishes of the creater to not make them public, is there anyone I can send them to privately in order to help me make them compatible?
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jul 30, 2007 5:28 pm |
Read this section of the CMUD manual. If that doesn't help with conversion, you could also try (once you've imported the broken triggers) running the compatability report, which will flag up things that might be broken from the list of changes (like "%1").
If you still can't fix it, are the triggers all similar? If they are, you could post one of them and we could help you fix that, which could get you started on the other ones. |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|