|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Tue Nov 19, 2002 6:23 pm
Achaean newbie seeks autoheal |
Ok, I am going to ask a stupid n00b question, since i am not very familiar with the ZMud scripting language syntax. I would like to learn how to trigger an action (say Meditate to recover mana, or sleep to recover health), when Mana or health drop below a certain point. I have set up health and mana variables, using #trigger {(%d)h, (%d)m} {#var HP %1; #var Mana %2},
but I don't know the syntax to script an if VAR is less than VAR (i.e. Health less than min Health, etc.) trigger. The Achaea status line displays:
530h, 500m ex
ex representing recovery of equilibrium, using a green, yellow, and red ANSI for warning. It would be cool if someone could also tell me how to set up an ANSIcolor based trigger. Any and all help (even just links to articles that address these issues) would be greatly appreciated. Thanks for your time.
"To start press any key... Where's the anykey?" |
|
|
|
Daniel Beginner
Joined: 13 Oct 2000 Posts: 20 Location: Germany
|
Posted: Tue Nov 19, 2002 6:34 pm |
Hi Batman,
you can use instead of the #VAR assignmend directly this:
#if (%1 < 100) {sleep}
asuming you want a min health of 100.
Nicer is to have this a bit more dynamic by declaring a threshold a which you want to sleep.
#var hp_threshold 100
and then use the same trigger but with #trigger {(%d)h, (%d)m} {#if (%1 < @hp_threshold) {sleep};#if (%2 < mana_threshold) {meditate}}
This has the possibility that you send a sleep and meditate if both criteria are forfilled.
Hope this helps
Daniel |
|
|
|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Tue Nov 19, 2002 6:52 pm |
Thanks. It definitely helped me with the syntax of if statements. Of course, me lacking foresight, didn't think that it would repeatedly send the command until it rose above the x_threshold. Meditate and sleep both being on/off commands, it then repeatedly turns them on and off, resulting in spam type results. You really did help me a long way towards solving it, I just didn't state the problem accurately. Thank you.
"To start press any key... Where's the anykey?" |
|
|
|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Tue Nov 19, 2002 7:37 pm |
Ok, here's solution so far. I am sure the algorithm is clumsy, but I am rather limited in my knowledge of ZMud. Any comments or help would be appreciated.
Detect Mana/Meditate
#trigger {(%d)h, (%d)m} {#if (%2 < @manamin){meditate; #t- manawatch} {manawatch}
Detect when meditation has completed:
#trigger {Cease your meditation} {#t+ manawatch}
Detect if meditation is broken prematurely:
#trigger {break your meditation} {meditate}
As mentioned before, anyway to condense this or make it cleaner is welcome. Thanks again to Daniel.
"To start press any key... Where's the anykey?" |
|
|
|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Tue Nov 19, 2002 7:41 pm |
Also, any suggestions on how to delay it firing meditate until after the phrase you have "recovered equilibrium" or "you have recovered balance", maybe using #COND would also be great. BTW I am using ZMud's latest Beta
"To start press any key... Where's the anykey?" |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Nov 19, 2002 9:05 pm |
Just a comment.
Triggers that put you to sleep are extremely dangerous.
LightBulb
Senior Member |
|
|
|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Tue Nov 19, 2002 10:44 pm |
Yes, Lightbulb, that's why I want to be careful in the implementation. However, my character is too low level to heal any other way, and would never enable this trigger if I was AFK. The mobs I'm chasing won't follow me from room to room, so I tried the following with no success. I did search for expressions, but didn't find any that were close enough in topic for me to learn from.
Ok, this will be another easy one for you guys to bat out of the park. Discovered the multi-state functionality of ZMud triggers, but am having trouble grasping the exact syntax of expression state triggers. Let's say I want to use an if statement to compare two variables, say HP and HPmin. Do I need to expand the variables, use paren's, or what. Here is what I tried without success
Opened new trigger dialog box, set type to expression.
In pattern entered: #if @HP<@HPmin
Then in value entered:
#t- autoheal; flee (an alias that derives from var emerexit, which grabs the first exit from the room description); sleep
I then contain it in a class called autoheal. However, whenever I exit in the direction stored as the emerexit variable, it activates the trigger above. What am i doing wrong.
"To start press any key... Where's the anykey?" |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Nov 20, 2002 4:57 am |
I can think of at least three other ways that a low-level character can heal in Achaea. But as long as you're leaving the battle first, it should be safe enough.
If you want solutions that use the beta features, post on the Beta forum.
This should be part of a prompt trigger. Command line version:
#TR {^(%d)h, (%d)m} {#IF (%1 < @HPmin) {#T- autoheal;flee;sleep} {autoheal} {nocr|prompt}
LightBulb
Senior Member |
|
|
|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Wed Nov 20, 2002 5:22 pm |
Hey Lightbulb,
Yeah, i know, but I don't want to spend lots of gold on health vials, etc. Sleep is cheap and free. Thank you for updating the code. What does the {nocr|prompt} do at the end?
"To start press any key... Where's the anykey?" |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Nov 20, 2002 7:51 pm |
Changes the options from the default of Trigger on: Newline-on, Prompt-off to Trigger on: Newline-off, Prompt-on
LightBulb
Senior Member |
|
|
|
|
|