|
discordia Newbie
Joined: 05 Dec 2003 Posts: 8 Location: USA
|
Posted: Sat Jan 31, 2004 6:45 am
#IF and math functions |
Currently, I've been slowly driven insane by trying to get this script to work. I've been working on an "autosipper" system for the MUD i play on (Achaea). The mana portion works oddly enough while the health portion refuses to work at all. Here is my code.
I've tried using 4 others "perfectly working" code and nothing. I'm starting to think I have a bad copy of Zmud but I've reinstalled and no dice. I've also double check my triggers, alias, etc, for any duplicates, everything is clear.
Code: |
#CLASS {Auto Healing}
#ALIAS mpvial {#IF {@maxmn - @msip > @mn} {
sip mana
healbal = 1
} {}}
#ALIAS hpvial {#IF {@maxhp - @hsip > @hp} {
sip health
healbal = 1
} {}}
#VARIABLE hp {3138}
#VARIABLE mn {3534}
#VARIABLE wp {16570}
#VARIABLE maxhp {3138}
#VARIABLE maxmn {3534}
#VARIABLE maxed {14590}
#VARIABLE maxwp {16570}
#VARIABLE healbal {0}
#VARIABLE msip {500}
#VARIABLE hsip {500}
#VARIABLE en {14590}
#TRIGGER {The elixir flows down your throat without effect.} {healbal = 1}
#TRIGGER {Your mind feels stronger and more alert.} {healbal = 1}
#TRIGGER {The elixir heals and soothes you.} {healbal = 1}
#TRIGGER {You may drink another health or mana elixir.} {healbal = 0}
#TRIGGER {%1h, %2m, %3e, %4w (%w)~-} {
#GAG
hp=%1
mn=%2
ed=%3
wp=%4
#IF {@healbal=0} {
hpvial
mpvial
}
}
#TRIGGER {What is it that you wish to drink?} {healbal = 1}
#CLASS 0
|
Any help is appriciated.
Thanks,
Heidi |
|
|
|
Evangelist Adept
Joined: 10 Oct 2000 Posts: 224 Location: USA
|
Posted: Sat Jan 31, 2004 8:02 am |
#CLASS {Auto Healing}
#ALIAS mpvial {#IF {(@maxmn - @msip) > @mn} {
sip mana
healbal = 1
} {}}
#ALIAS hpvial {#IF {(@maxhp - @hsip) > @hp} {
sip health
healbal = 1
} {}}
Try it like that? I am not sure if that will work or not, but it might. |
|
|
|
Evangelist Adept
Joined: 10 Oct 2000 Posts: 224 Location: USA
|
Posted: Sat Jan 31, 2004 8:07 am |
Forgot to ask.
Is the trigger setup right? %1h, %2m, etc?
have you tried using something besides %1, %2? Maybe %d for numbers? (I think it is %d)
Also, a sample output of the mud might help a little. There might be another way to do it. Personally, the hp/mana triggers I use set their own values for max and current because I switch equipment alot and always forgot to change values so I had to automate it. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Jan 31, 2004 8:36 am |
for both alias's replace some {} with () as shown below
Code: |
#ALIAS mpvial {#IF <font color="green">([@maxmn - @msip] > @mn)</font id="green"> {sip mana;healball=1}} |
Expressions should be grouped in ()'s and you can use []'s to group expresions so it will evalute [@maxmn - @msip] before it checks if its greater or less or what not.
And for your Prompt trigger
Code: |
#TRIGGER {(%d)h, (%d)m, (%d)e, (%d)w (%w)~-} {#GAG;hp=%1;mn=%2;ed=%3;wp=%4;#if <font color="green">(</font id="green">@healbal=0<font color="green">)</font id="green"> {mpvial;hpvial}} |
|
|
|
|
discordia Newbie
Joined: 05 Dec 2003 Posts: 8 Location: USA
|
Posted: Sat Jan 31, 2004 10:24 am |
I tried both the offered methods and got Syntax Errors...
For example
Code: |
#IF ([@maxmn - @msip] > @mn) {sip mana;healball=1}}
^ syntax error
|
Any reason why? I tried spacing out too.
When I did this
Code: |
#IF {[@maxmn - @msip] > @mn} {sip mana;healball=1} {}
|
No syntax errors, but then the mana one quit working.
I'm just at a loss here. Technically if the mana one works, wouldn't the health? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Jan 31, 2004 10:41 am |
*whap self* Use () instead of []
Code: |
#IF ((@maxmn-@msip)>@mn) {sip mana;healball=1}} |
|
|
|
|
SolReapr Beginner
Joined: 03 Sep 2003 Posts: 13 Location: USA
|
Posted: Sat Jan 31, 2004 11:04 am |
#CLASS {Auto Healing}
#ALIAS mpvial {#IF {@maxmn-@msip > @mn} {
sip mana
healbal = 1
} {#NOOP}}
#ALIAS hpvial {#IF {@maxhp-@hsip > @hp} {
sip health
healbal = 1
} {#NOOP}}
#VARIABLE hp {3138}
#VARIABLE mn {3534}
#VARIABLE wp {16570}
#VARIABLE maxhp {3138}
#VARIABLE maxmn {3534}
#VARIABLE maxed {14590}
#VARIABLE maxwp {16570}
#VARIABLE healbal {0}
#VARIABLE msip {500}
#VARIABLE hsip {500}
#VARIABLE en {14590}
#TRIGGER {The elixir flows down your throat without effect.} {healbal = 1}
#TRIGGER {Your mind feels stronger and more alert.} {healbal = 1}
#TRIGGER {The elixir heals and soothes you.} {healbal = 1}
#TRIGGER {You may drink another health or mana elixir.} {healbal = 0}
#TRIGGER {&{hp}h, &{mn}m, &{en}e, &{wp}w %w~-} {
#GAG
#IF (@healbal=0) {
hpvial
mpvial
} {#NOOP}
}
#TRIGGER {What is it that you wish to drink?} {healbal = 1}
#CLASS 0
#TRIGGER {%1h, %2m, %3e, %4w (%w)~-} <- You shouldn't use %1,%2 etc in the trigger patterns. As Evangelist noted you need to use %d for numbers instead. With this trigger pattern the value of the hp variable becomes whatever is in the (%w) position of your prompt. (Note: %w matches a word not a numeric value)
Edit: Fixed a typo |
|
|
|
discordia Newbie
Joined: 05 Dec 2003 Posts: 8 Location: USA
|
Posted: Sat Jan 31, 2004 12:39 pm |
OMG, it finally works and thanks for all the change help but I think what did it was this.
In the Class Script, mpvial was listed before hpvial. I switched them around and it worked.
That seems weird that it would do that but oh well. It works and I'm happy.
Thanks again for the great tips on how i should format future scripts and now that I know this I'll be able to work the class script better.
*hugs*
Heidi |
|
|
|
|
|