|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Fri Dec 14, 2007 9:51 pm
Temporary Triggers |
I'm wondering if there would be a more simple way to do all this by using temporary triggers and a single alias.
The goal: Start my regeneration spell. If it fails, recast it. When mana is full, perform two spells that don't require error checking. Start process all over.
Here's what I'm thinking:
Have a single autoTrain alias. This alias creates three temporary triggers.
(#TEMP docs say that a #TEMP will occur once and delete once it executes, which works perfectly in this case)
Trigger 1: Executes on text "spell failed" or "spell fizzled" or "fumbled spell"
This trigger waits 5 seconds and re-executes the autoTrain alias.
Trigger 2: Executes on text "not enough mana"
This trigger uses my "heal" alias, waits 5 seconds, and re-executes the autoTrain alias.
Trigger 3: Executes on text "You cast regeneration"
Since this trigger executed, the other two will not. This trigger should DELETE the first two temporary triggers (since this trigger executed, it will be deleted automatically) and create a new temporary trigger.
The temporary trigger that shoudl be created is:
Trigger: Executes on text "Mana: 400/400" (which will always happen)
This trigger does three things:
1. Does "cast light"
2. Waits 5 seconds and then does "cast levitate"
3. Waits 5 more seconds and then does "autoTrain" (the initial alias), restarting the whole process.
***
A few questions:
1. Are there any problems with my logic, or should this work?
2. Is there a way to make a #TEMP trigger delete itself if it's not triggered within a certain amount of time?
3. Is there a way to delete #TEMP trigger (from another trigger)?
4. Is there a way to make a single trigger do different actions based on different text?
Additionally, I've seen that you can make "SCRIPTS" in CMUD? Would that be a better way to do this? |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Dec 14, 2007 10:22 pm |
I would recommend you make a class folder with some options for the action and leave it disabled until you attempt the action. For example (in pseudo-code, sorta):
Code: |
#CLASS MySpells
#ALIAS regeneration {
cast 'regeneration'
#T+ MySpells|regeneration
}
#CLASS 0
#CLASS MySpells|regeneration disable
#ALARM *5 {
#T- MySpells|regeneration
}
#TRIGGER {You cast regeneration} {
#SAY "Regeneration successful"
#T- MySpells|regeneration
}
#TRIGGER {{not enough mana|spell failed|spell fizzled|fumbled spell}} {
#SAY "Regeneration failed, retry..."
#T- MySpells|regeneration
}
#CLASS 0
|
Obviously, I didn't include a new 5 second timer or the heal alias, so you can adapt this idea to expand it into something you really want. I'd recommend you stay away from #TEMP triggers, though, as you can end up with a bunch of unused duplicates if you're not careful. Hope this helps. It was just quick, off-the-top-of-my-head code. |
|
|
|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Fri Dec 14, 2007 10:37 pm |
I'm having problems disabling the triggers via code (not sure what I'm doing wrong).
This works: #ALARM recast +5 {AutoTrain/castRegen}
This does not: #T- {AutoTrain/manaLow};
This also does not work: #T- {AutoTrain|manaLow};
Any idea what I'm doing wrong? |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Dec 14, 2007 11:57 pm |
Your alarm doesn't have a #T- in it. Try #T- AutoTrain|manaLow (without the braces), and see if that makes a difference.
|
|
|
|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Sat Dec 15, 2007 12:05 am |
The alarm works perfect ... it's disabling the trigger that doesn't work.
|
|
|
|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Sat Dec 15, 2007 12:20 am |
Hmm. It's strange. If I do #T- castFail (my first castFail trigger - located inside my AutoShare class gets disabled).
If I do #T- AutoTrain/castFail
or
#T- AutoTrain|castFail
Nothing happens. :(
Any ideas? |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Sat Dec 15, 2007 12:29 am |
Use
#T- "AutoTrain|castFail"
and see if using quotes changes anything.
Prog |
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Sat Dec 15, 2007 12:37 am |
It doesn't work either. I'm very confused about what I'm doing wrong. I changed the name of the alias in the AutoShare class to something, so now there is only one trigger (in the AutoTrain class) named castFail.
#T- castFail works. But I can't figure out why I can't specify the class. :( |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Dec 15, 2007 8:34 am |
I actually saw this problem as well last night after I downloaded 2.18 and tried some stuff out. I won't have time to test it more for a while, but just to say that I've seen this as well. There's something here.
|
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Sun Dec 16, 2007 3:36 am |
this seems to work for me, just copy and paste into the command line:
Code: |
#alias autoTrain {
#say training...
#temp at1 {{spell failed|spell fizzled|fumbled spell}} {
#alarm ala1 {+5} {autoTrain}
}
#temp at2 {not enough mana} {
heal
#alarm ala1 {+5} {autoTrain}
}
#temp at3 {You cast regeneration} {
#untrigger at1
#untrigger at2
#temp at4 {Mana: 400/400} {
cast light
#alarm ala2 {+5} {
cast levitate
#alarm ala1 {+5} {autoTrain}
}
}
}
} |
Also, probably an alias to stop it, something like: #alias notrain {#untrigger at1;#untrigger at2;#untrigger at3;#untrigger at4} |
|
|
|
|
|