|
lvlorph Beginner
Joined: 26 Nov 2001 Posts: 20 Location: USA
|
Posted: Thu Dec 06, 2001 5:11 pm
Several Ridiculously Simple Questions! |
Alright folks, I have two questions for all you Zmud masterminds out there, :P
(1) OK, I'm basically trying to set up some sort of basic dueling script using triggers to make things a bit easier. Here's what I have so far, and they aren't exactly working the way I'd like them to. I'll represent the trigger line as (a) and the command as (b). For this first trigger, I'm trying to auto-kick the opponent if I come across them standing in a room.
(a) %1 %2 the %3 is standing here.
(b) #IF (%1 == @enemy) {scan} {kick @enemy}
Btw, I've got a variable "enemy" set up and working correctly. My problem here is that it seems to try to kick "enemy" regardless of who happens to be standing there. (The %1 is the person's name and the %2 is their title, ie: Sally Jones the High Elven Enchantress-Matriarch (invisible) is standing here where the last name is optional.) Really, I'd like it to do absolutely nothing if the IF condition is not met; is there a way to have a null set of brackets?
(2) I'd like for my second trigger to hunt down the opponent should he flee. Here's what I've got.
(a) %1 panics, and attempts to flee!
(b) #IF (%1 == @enemy) {scan} {hunt @enemy;hunt @enemy;kick @enemy}
Again, it encounters the same problem here. I do have some C++ background, and hence I figured the == would work for the comparison.
(3) And the third trig is supposed to trip the opponent if he/she enters the room.
(a) %1 has arrived.
(b) #IF (%1 == @enemy) {scan} {trip @enemy}
Yet again, the trigger seems fond of going off regardless of who enters the room.
(4) OK, those are my triggers thus far. I'd also like to know if there is some way to group the three and toggle when they are on/off. Currently, I have to individually disable/enable each of them. Further, I'd like for them to be disabled when I log on (by default).
I am, however, open to suggestions. If you guys know of a better way to make a dueling script, I'm all ears. As you probably tell by now, I'm quite the novice when it comes to ZMUD...:P
Thanks, I really appreciate this.
Raknid of Age of Chaos |
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Thu Dec 06, 2001 6:32 pm |
It would appear in your first trigger you have the actions reversed. The TRUE action should be first, the FALSE action should be second. To do nothing in the event of a false value, use #NOOP or just leave the FALSE action out.
#IF (%1 == @enemy) {kick @enemy} {#NOOP}
Likewise for your second and third triggers, the TRUE and FALSE actions are reversed.
TRUE goes first, FALSE goes second.
To group the three, place them in a CLASS. The class can be turned on and off with the #T+ and #T- commands. In the Settings Editor, select the class folder and check "Disable class when connecting to a MUD"
Troubadour |
|
|
|
lvlorph Beginner
Joined: 26 Nov 2001 Posts: 20 Location: USA
|
Posted: Thu Dec 06, 2001 7:10 pm |
Excellent. I'll make those changes ASAP. And by the way, is this the best way of setting up a dueling script?
|
|
|
|
lvlorph Beginner
Joined: 26 Nov 2001 Posts: 20 Location: USA
|
Posted: Thu Dec 06, 2001 7:25 pm |
OK, here's what my class looks like. Is everything right?
#CLASS {Fight} {disable}
#VAR enemy {dra}
#TRIGGER {%1 has arrived.} {#IF (%1 == @enemy) {trip @enemy} {#NOOP}} "" {disable}
#TRIGGER {%1 %2 the %3 is standing here.} {#IF (%1 == @enemy) {kick @enemy} {#NOOP}} "" {disable}
#TRIGGER {%1 panics, and attempts to flee!} {#IF (%1 == @enemy) {
hunt @enemy
hunt @enemy
kick @enemy
} {#NOOP}} "" {disable}
#CLASS 0
And what would I type to turn it on? Just "#T+ fight"? |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Fri Dec 07, 2001 12:23 am |
I'm not quite sure those triggers will work seeing as how you're not setting any variables in your trigger patterns. Try this:
#CLASS {Fight} {disable}
#VAR enemy {dra}
#TRIGGER {(%w) has arrived.} {#IF (%1 == @enemy) {trip @enemy} {#NOOP}} "" {disable}
#TRIGGER {(%w) * the * is standing here.} {#IF (%1 == @enemy) {kick @enemy} {#NOOP}} "" {disable}
#TRIGGER {(%w) panics, and attempts to flee!} {#IF (%1 == @enemy) {hunt @enemy;hunt @enemy;kick @enemy} {#NOOP}} "" {disable}
#CLASS 0
Yes, to turn the class on, just type #t+ Fight
Iljhar |
|
|
|
lvlorph Beginner
Joined: 26 Nov 2001 Posts: 20 Location: USA
|
Posted: Fri Dec 07, 2001 6:02 am |
Alright, here's what I've got. But still, it seems to fire when it's not supposed to at times. And further, it's a bit slow.. Any suggestions?
#CLASS {Fight} {disable}
#VAR enemy {Jakian}
#TRIGGER {(%w) has arrived.} {#IF (%w == @enemy) {trip @enemy} {#NOOP}} "" {disable}
#TRIGGER {(%w) * the * is standing here.} {#IF (%w == @enemy) {kick @enemy} {#NOOP}} "" {disable}
#TRIGGER {(%w) panics, and attempts to flee!} {#IF (%w == @enemy) {
hunt @enemy
hunt @enemy
kick @enemy
} {#NOOP}} "" {disable}
#CLASS 0 |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Fri Dec 07, 2001 6:55 am |
Okay, you use %d, %w, *, %t, %x, etc to capture variables in the pattern part of a trigger. You use %1, %2, etc to retrieve those variables in the inside of the value of the trigger. So change your triggers back to what I wrote earlir.
What do you mean it fires when it's not supposed to, can you give us some examples?
What OS are you running? What version of zMUD do you have? How much RAM do you have? Do you have a lot of applications running alongside zMUD? How slow is slow?
Iljhar |
|
|
|
lvlorph Beginner
Joined: 26 Nov 2001 Posts: 20 Location: USA
|
Posted: Fri Dec 07, 2001 7:12 am |
Alright, I changed it back. The comment I made about it firing when it's not supposed to (ie: when someone other than the enemy walks into the room) may just be attributed to the slower reaction time. I have 256 MB RAM, running version 6.16 of ZMUD, but the system is a laptop. How slow is slow? In duels, people beat me to the first attack often...though it seems like a trig should be faster. I appreciate all your help thus far, and it seems to work most of the time, but I'd just like to make sure it runs completely smoothly. Sorry to bug you so much.
|
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Fri Dec 07, 2001 8:39 am |
One thing you could do is instead of using wildcards for the enemy's name and checking it with #IF is to place {@enemy} into the trigger pattern instead. The {@enemy} is expanded in the pattern, so the trigger only fires if your opponent enters, flees, or is standing there. Be sure to place the @enemy in brackets.
#CLASS {Fight} {disable}
#VAR enemy {Jakian}
#TRIGGER {{@enemy} has arrived.} {trip @enemy}
#TRIGGER {{@enemy} %w the %w is standing here.} {kick @enemy}
#TRIGGER {{@enemy} panics, and attempts to flee!} {
hunt @enemy
hunt @enemy
kick @enemy
}
#CLASS 0
Troubadour |
|
|
|
Palomar Apprentice
Joined: 11 Oct 2000 Posts: 138 Location: Portugal
|
Posted: Fri Dec 07, 2001 3:56 pm |
Just one question: since when "==" is used to test equality? Shouldn't it be "="? I have always used "=". It is what the help files say, anyway.
Palomar |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Dec 07, 2001 6:03 pm |
I agree, Palomar. "==" might work (I haven't tested it) but it's certainly not in the list of expressions. There's no need to assume something will work based on your C++ background since zMUD provides a comprehensive helpfile detailing the syntax it does use.
LightBulb |
|
|
|
lvlorph Beginner
Joined: 26 Nov 2001 Posts: 20 Location: USA
|
Posted: Fri Dec 07, 2001 8:10 pm |
Thanks for all your input guys. I went ahead and copy-pasted the simpler of the two codes. It nows looks like this:
#CLASS {Fight} {disable}
#VAR enemy {Jakian}
#TRIGGER {{@enemy} has arrived.} {trip @enemy}
#TRIGGER {{@enemy} %w the %w is standing here.} {kick @enemy}
#TRIGGER {{@enemy} panics, and attempts to flee!}
{
hunt @enemy
hunt @enemy
kick @enemy
}
#CLASS 0 |
|
|
|
|
|