|
Rudolph Newbie
Joined: 08 Sep 2005 Posts: 1
|
Posted: Fri Sep 09, 2005 1:24 am
Looking for a better way |
Im writing a reactionary trigger to handle fights when I am away from the keyboard. There are approximately 22 different possible messages I can get from the mud, and right now I have them all as single triggers. For example:
#TRIGGER {You slash (*) deeply} {
#SAY In deeply
#IF ({%1} != {@tokill}) {#ABORT 1}
#IF (@mana > @manastab) {stab}
#SAY Its all good :)
#IF (@hp < @hprun) {
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
#SAY ""
#SAY "Ummmm...time to run!!"
#SAY ""
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
retreat north
}
}
#TRIGGER {Your wild slash at (*) misses} {
#SAY In wild slash
#IF ({%1} != {@tokill}) {#ABORT 1}
#IF (@mana > @manastab) {stab}
#SAY Its all good :)
#IF (@hp < @hprun) {
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
#SAY ""
#SAY "Ummmm...time to run!!"
#SAY ""
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
retreat north
}
}
#TRIGGER {Blood spurts from (*) as} {
#SAY In blood spurt
#IF ({%1} != {@tokill}) {#ABORT 1}
#IF (@mana > @manastab) {stab}
#SAY Its all good :)
#IF (@hp < @hprun) {
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
#SAY ""
#SAY "Ummmm...time to run!!"
#SAY ""
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
retreat north
}
}
I already have a variable @tokill that contains the name of the mob Im expecting to fight. And I only want to fight him/her.
Like I said, there are a number of lines that can cause this function to fire. Im looking for a way to consolidate it into one trigger, so if I want to change some options, I can without having to change 22 triggers. For example, I'd like to do something like this:
#TRIGGER {@TOKILL} {
#SAY Checking attack
#IF (amIfighting(@tokill)) {
#IF (@mana > @manastab) {doattack()}
#IF (@hp < @hprun) {
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
#SAY ""
#SAY "Ummmm...time to run!!"
#SAY ""
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
retreatnow()
}
}
Notice how I use functions to (a) check if this is one of the valid fighting strings, against the value in @tokill, (b) specify my attack, and (c) execute my retreat.
Can I do something like this? Can anyone help point me to the right direction, or do I still need 20 triggers? If I need 20 triggers, the ability to make functions for the options would STILL be very valuable!! like this:
#TRIGGER {You slash (*) deeply} {
#SAY In deeply
#IF ({%1} != {@tokill}) {#ABORT 1}
#IF (@mana > @manastab) {doattack()}
#SAY Its all good :)
#IF (@hp < @hprun) {
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
#SAY ""
#SAY "Ummmm...time to run!!"
#SAY ""
#SAY "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
retreatnow()
}
}
Anyone?? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Sep 09, 2005 8:07 am |
Use an alias containing all your current code, then call it from each of the triggers.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
|
|
|
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
|
|