|
sheetan Beginner
Joined: 07 May 2007 Posts: 19
|
Posted: Thu May 31, 2007 7:43 pm
help in a trigger |
Hi,
i was trying to make a trigger, but i'm a bit of a newbie in zMUD, and i couldn't find any way to make this...my question is:
Say i look in a room and see for example:
An Elf
i align the elf, a command which shows me his alignment and race...example:
Elf is Moral
Elf is Sindarin
is therre a way where i can make it to permanently show it in such a way for example "An Elf [moral/sindarin]" and keep it?
or would that just take too much?
Thanks alot |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu May 31, 2007 8:23 pm |
Not really, because "An Elf" is too generic. There's no way to store it permanently. You could fake it by having the trigger perform the align command, gag the whole output, and then reprint the line with the race and alignment added.
#trig {An Elf} {align}
#cond {Elf is (%w)} {} {within|param=5}
#cond {Elf is (%w)} {#4 #gag;#echo %ansi(grey)"An Elf ["%t1"/"%t2"]"} {within|param=1}
The #gag command is repeated 4 times to gag the race, the alignment, the prompt, and the original "an elf" line. |
|
|
|
sheetan Beginner
Joined: 07 May 2007 Posts: 19
|
Posted: Thu May 31, 2007 8:35 pm |
okay...i think i understood a bit of it..but an elf was an example, isn't there a way so that whatever I align it will show me as it did with the elf?...because well, in my MUD, aligns are not usually triggered, it's just not normal
|
|
|
|
sheetan Beginner
Joined: 07 May 2007 Posts: 19
|
Posted: Thu May 31, 2007 8:39 pm |
btw...the command you gave me didn't work too...I don't know why
|
|
|
|
hogarius Adept
Joined: 29 Jan 2003 Posts: 221 Location: islands.genesismuds.org
|
Posted: Thu May 31, 2007 8:47 pm |
Sheetan, if an elf is in a room, will that same elf always be in that room, and will it always have the same characteristics when you use the align command?
|
|
|
|
sheetan Beginner
Joined: 07 May 2007 Posts: 19
|
Posted: Fri Jun 01, 2007 8:45 am |
It will have the same characteristics always, and it will stay in the same room(it doesn't move) unless it is killed...i'll give a better example:
You have come upon the entrance to a settlement of some sort. To
the west you spot the Brandywine flowing lazily past you. In front of
you, you can see a wooden fence surrounding a few buildings, a small
hill as well as a huge oak. There is also a path going through a wooden
archway. It seems to lead to what looks like the center of the settlement
in which you see a campfire burning brightly.
The Brandywine River is west.
The sun shines brightly in the western sky.
A light wind blows from the southwest, and clouds form overhead.
There is water to the north, west and southwest.
The only obvious exits are enter, east and south.
A fat elf
align elf
Elf is Moral.
Elf is a sindar.
what I'm aiming for is after having aligned this specific elf ( which is an example of any other monster in the game) i'm trying to get this
You have come upon the entrance to a settlement of some sort. To
the west you spot the Brandywine flowing lazily past you. In front of
you, you can see a wooden fence surrounding a few buildings, a small
hill as well as a huge oak. There is also a path going through a wooden
archway. It seems to lead to what looks like the center of the settlement
in which you see a campfire burning brightly.
The Brandywine River is west.
The sun shines brightly in the western sky.
A light wind blows from the southwest, and clouds form overhead.
There is water to the north, west and southwest.
The only obvious exits are enter, east and south.
A fat elf[moral/sindar]
or something similar to this
so my question is...is there a way for this to be done, or am I asking for too much? |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Jun 01, 2007 5:52 pm |
Question for you Sheetan, are you trying to save magic points by not having to call the align every time or do you not want to have to type it for every mob you come across?
I'll try and layout a solution for both.
I'll deal with the latter first. For that Fang's solution get's you 80 - 90 % there. Note that I've added some items to handle slight variations in the out put so it should be more generic.
Quote: |
#TRIG {The {only|} obvious exit{s|} {are|is} *} {}
#cond {{An|A} *(%w)} {align %1}
#cond {* is (%w)} {} {within|param=5}
#cond {(%w*) is (%w)} {
#4 #gag
#echo %ansi( grey)"An %1 [" %t1 "/" %t3 "]"} {within|param=1} |
Then next option is a bit more complicated. It requires storing the values for each mob in a variable so that it only needs to be called once. The drawback to this is that it assumes if you encounter the same creature in a different room, the alignment info will be the same. What it does is it looks to see it has the value already and if it does, substitutes it. If it does not, all the align command gag the output lines and replace them, and add the result to the DB variable for the next time.
Quote: |
#TRIG {The {only|} obvious exit{s|} {are|is} *} {}
#cond {{An|A} (*(%w))} {
#IF (%iskey( @AlignMobs, "%1")) {
#SUB {%db( @AlignMobs, "%1")} {#T+ AlignCheck; align %2}
#TRIG {AlignCheck} {* is (%w)} {} {within|param=5}
#cond {(%w*) is (%w)} {
#4 #gag
#ADDKEY AlignMobs {"%1 [" %t1 "/" %t3 "]"}
#echo %ansi( grey)"An %1 [" %t1 "/" %t3 "]"
} {within|param=1}
#T- AlignCheck
}
|
I hope that helps. Please note the code is untested, but you should get the general idea. |
|
_________________ Asati di tempari! |
|
|
|
sheetan Beginner
Joined: 07 May 2007 Posts: 19
|
Posted: Fri Jun 01, 2007 7:49 pm |
no...it didn't work:(...for some reason, the whole thing is just not being saved, wherever I check!...and the answer is...I want, after typing the "align" on a mob, to save the align for this specific mob in the way previously mentioned, so that i don't have to align a mob i already aligned before...I don't want to trigger it or anything like this!
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Jun 01, 2007 8:26 pm |
Your going to have to trigger it. That's how zMUD knows to substitute it. When I get time I'll to simulate you output and see what the problem is.
|
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Jun 01, 2007 8:51 pm |
It's hard to tell with the pretty print on exactly what that script is doing, but it looks like it's trying to create a trigger from within another trigger (I advise leaving pretty print off while using Rorso's colouriser in bbcode mode, since the forums will eat the spacing). I'm not sure if that was intentional, but if it wasn't, you've got some unmatched or mismatched braces there, Tech. Your #sub command has two parameters, but the second one is a list of commands instead of text to substitute. Your trigger is then creating the AlignCheck trigger. You're also gagging on the first line of the align, rather than the second, which will probably cause problems. Not sure what's going on there, but something's definitely amiss.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Jun 02, 2007 12:29 am |
Hmmm, it seems I had more than a few parantheses out of place.
This is tested and works.
Code: |
#TRIGGER {The {only|} obvious exit{s|} {are|is} *} {}
#COND {{An|A} (* (%w))(*)} {#IF (%iskey( @AlignMobs, "%2")) {#PSUB " ~[ "%db( @AlignMobs, Elf)" ~]" %x3} {#T+ AlignCheck;; align %2}}
#TRIGGER "AlignCheck" {* is (%w)} {} "" {within|param=5}
#COND {(%w*) is {a|an} (%w*).} {#GAG -6;#GAG;#ADDKEY AlignMobs {%1=%t1 "/" %t3};#echo %ansi( grey)"An %1 [" %t1 "/" %t3 "]";#T- AlignCheck} {within|param=1}
|
|
|
_________________ Asati di tempari! |
|
|
|
sheetan Beginner
Joined: 07 May 2007 Posts: 19
|
Posted: Sun Jun 03, 2007 5:49 am |
i give up....i don't think it will work!!
this one didn't work |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Jun 03, 2007 6:46 am |
Instead of running from the command line try creating the trigger from the GUI based on what is posted here. But I've tested that and it works so I'm not sure what else to tell you.
|
|
_________________ Asati di tempari! |
|
|
|
|
|