Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
SRPrice
Beginner


Joined: 19 Jul 2007
Posts: 18

PostPosted: Mon Aug 20, 2007 9:26 pm   

Multi-state Trig or multiple trigs?
 
I am trying to write a trigger or series of triggers, but I'm at a loss as to the best way to proceed.

Scenario:
Grouping with a friend. Friend is leading the group and is using a specific skill.
Skill gives output on leaving 1 room, and entering the next which would aggro any mobs in that room.
Easy enuf to make a trigger to fire a few spells, however, what about to the ability to NOT cast if that room is empty.

Perhaps, let me give mud out put to see if that clarifies what I'm talking about.

Quote:
PlayerA screams and charges West!
You follow PlayerA.

Misty Room
[Exits: west]
PlayerA is here.
A ghost floats about the mist.
A ghost floats about the mist.
A ghost floats about the mist.
PlayerA charges into the room swinging wildly!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!
PlayerA 's death charge **wounds** a Ghost!


If you'll notice, there is a message that the group leader is charging the next room, and also another message as you follow and enter the room. Also, if there are mobs in that room, they are all hit for anywhere between 1-5 times per mob.

Now, if that same skill is used, but the room is empty, this is the output.

Quote:
PlayerA screams and charges West!
You follow PlayerA.

Misty Room
[Exits: west]
PlayerA is here.
PlayerA charges into the room swinging wildly!


What I would like to do, is in the 1st scenario where there are mobs, to give a string of attack command, spells, etc. Perhaps even something like fire an alias x times per mob in the room. However, would also want it to simply do nothing in the 2nd scenario when there are no mobs in the room.

The problem I'm running into now, is triggering off of "PlayerA charges into the room in a frenzy!" which causes me to cast when nothing is there, or triggering on "PlayerA 's death charge **wounds** a Ghost!" but doing that w/o over spamming commands.

So is this something that can be done via a multistate trigger, or would this require multiple triggers to function properly?


What I have so far is: (yes i know it is incomplete.)
#TRIGGER {^(%w) screams and charges *!} {} "autocaster|AC"
#COND {^(%w)'s death charge *} {c fireball}


I have a variable set up so I can assign who the group leader is, because if there are other players in the area using this same skill, then I don't want it going off for them, and I wanted to be able to define the other party member w/o re-writing the trig.

So I think I need an:
#IF {%1 = @Groupleader} {next series of command}


So any thoughts or suggestions? I'm not sure if this is really that difficult or if I've just been thinking about it too much. But any assistance would be appreciated.

I'm currently at the "trying to figure how to do this" phase.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Aug 20, 2007 10:26 pm   
 
#TRIGGER {^@Groupleader screams and charges *!} {#var Attack 1} "autocaster|AC"
#COND {^@{Groupleader}'s death charge *} {#if (@attack=1) {c fireball;#var Attack 0}}

I was assuming that there was not a space after PlayerA's name so that it would NOT look like this PlayerA 's. when I made this.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Aug 20, 2007 10:37 pm   
 
Well, actually that one isn't so good. You need something to set it back to the proper state if there is nothing in the room...

#TRIGGER {^@Groupleader screams and charges %w!} {} "autocaster|AC"
#COND {^@{Groupleader} charges into the room swinging wildly!} {#var Attack 1}
#COND {^@{Groupleader}'s death charge} {#if (@attack=1) {c fireball;#var Attack 0}} {within|param=1}

This one is much better. If there is nothing in the room that is ok and the trigger resets itself to the first state. Also you do not need a * to match the end of a script if you are not anchoring the end.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
SRPrice
Beginner


Joined: 19 Jul 2007
Posts: 18

PostPosted: Tue Aug 21, 2007 1:03 am   
 
Cool thanks.. definately a start.

One question tho. With the current "fireball" cast per "death charge" message. If the room had 1 mob and was hit 4 times by the "death charge", then would this cast 4 fireballs, or just 1 and stop?

I can work it either way, either by making it cast a multispell alias, or by letting it fire 1 spell for each hit. Just curious before I plug it in and give it a test.

And also to clarify, you have the variable "@Groupleader" in the Trigger itself, so in this trigger there's no need for an #IF statement to check the groupleader? If that's the case, then I think I can actually clean up some code elsewhere.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Aug 21, 2007 1:06 am   
 
The trigger will fire once (if it's going to fire) and then disable itself.

And yes, @Groupleader will be expanded when zMUD checks the trigger pattern, so there's no need for the #if.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net