Unknown2005-09-10 19:29:31
I'm working on making my own curing system, and right now I'm working on catching the prompt and mapping each state/health/mana/etc. to a variable. I don't know how to bring up just a compiler for ZMud scripts so I'm working with the Settings editor... this script is based on one someone sent to me from an example in the forums, and I modified it a bit, but this is what I've got.
In the Pattern Field, I have: ^(\\d+)h, (\\d+)m, (\\d+)e, (\\d+)p, (\\d+)en, (\\d+)w, (+)
And my Value is:
#var health %1
#var mana %2
#var ego %3
#var power %4
#var endurance %5
#var willpower %6
#var promptcheck %7
#if (%pos( e, @promptcheck)) {#var eq 1} {
#var eq 0
#var able 0
}
#if (%pos( l, @promptcheck)) {#var lbal 1} {
#var lbal 0
#var able 0
}
#if (%pos( r, @promptcheck)) {#var rbal 1} {
#var rbal 0
#var able 0
}
#if (%pos( x, @promptcheck)) {#var balance 1} {
#var balance 0
#var able 0
}
#if (%pos( d, @promptcheck)) {#var deaf 1} {#var deaf 0}
#if (%pos( b, @promptcheck)) {#var blind 1} {#var blind 0}
#if (%pos( p, @promptcheck)) {#var prone 1} {#var prone 0}
#if (%pos( k, @promptcheck)) {#var kafe 1} {#var kafe 0}
#if @prone=0 {#if @paralysis=0}{#var able 0}
#if @balance=1 {#if @eq=1 {#if @prone=0 {#var able 1}}}
I've been trying to see if it's working, and it seems to work well enough for states. But when I use a #show @health or mana or ego, all I get is %1 on screen, or 0, never the numeric value that it should be... anyone know what I'm doing wrong? also, I've seen scripts with {nocr|prompt} at the end of them. What does that do? I also have this set to a regular expression. I was wondering if I have to change something given that for it to work right. I've searched throughout the forum and the ZMud help files, but I can't find the answer... thanks for any advice you can give.
In the Pattern Field, I have: ^(\\d+)h, (\\d+)m, (\\d+)e, (\\d+)p, (\\d+)en, (\\d+)w, (+)
And my Value is:
#var health %1
#var mana %2
#var ego %3
#var power %4
#var endurance %5
#var willpower %6
#var promptcheck %7
#if (%pos( e, @promptcheck)) {#var eq 1} {
#var eq 0
#var able 0
}
#if (%pos( l, @promptcheck)) {#var lbal 1} {
#var lbal 0
#var able 0
}
#if (%pos( r, @promptcheck)) {#var rbal 1} {
#var rbal 0
#var able 0
}
#if (%pos( x, @promptcheck)) {#var balance 1} {
#var balance 0
#var able 0
}
#if (%pos( d, @promptcheck)) {#var deaf 1} {#var deaf 0}
#if (%pos( b, @promptcheck)) {#var blind 1} {#var blind 0}
#if (%pos( p, @promptcheck)) {#var prone 1} {#var prone 0}
#if (%pos( k, @promptcheck)) {#var kafe 1} {#var kafe 0}
#if @prone=0 {#if @paralysis=0}{#var able 0}
#if @balance=1 {#if @eq=1 {#if @prone=0 {#var able 1}}}
I've been trying to see if it's working, and it seems to work well enough for states. But when I use a #show @health or mana or ego, all I get is %1 on screen, or 0, never the numeric value that it should be... anyone know what I'm doing wrong? also, I've seen scripts with {nocr|prompt} at the end of them. What does that do? I also have this set to a regular expression. I was wondering if I have to change something given that for it to work right. I've searched throughout the forum and the ZMud help files, but I can't find the answer... thanks for any advice you can give.
Unknown2005-09-10 20:32:01
You need to make it Regular expression because this pattern is for regex.
It needs to be a prompt trigger (check prompt and uncheck newline in options in trigger settings) because, being a prompt, it doesn't end with new line.
It needs to be a prompt trigger (check prompt and uncheck newline in options in trigger settings) because, being a prompt, it doesn't end with new line.
Unknown2005-09-10 22:49:05
Be sure to check your braces, too. I noticed a problem with this line:
Should be:
(Although I'm not sure if you meant #var able 0 or #var able 1, since you're not prone or paralyzed...)
There's a comma after the willpower part of your pattern, too, and there shouldn't be.
CODE
#if @prone=0 {#if @paralysis=0}{#var able 0}
Should be:
CODE
#if @prone=0 {#if @paralysis=0 {#var able 0}}
(Although I'm not sure if you meant #var able 0 or #var able 1, since you're not prone or paralyzed...)
There's a comma after the willpower part of your pattern, too, and there shouldn't be.
Unknown2005-09-11 04:56:43
Thanks guys, I think I got it working alright. But now that I've fixed that problem, I have another one. I'm working on an auto-sipping system. And I'm not sure if this is going to work right.
#CLASS {curing|autosip}
#VAR healthsip {@healthmax-450}
#REGEX {Health : (/d+)/(/d+)} {#var @healthmax %2}
#IF @health < @healthsip {#IF @hmbbal 1 (dh)))
#CLASS 0
Where @health is my current health that I'm tracking through my prompt catch, hmbbal is my health/mana/bromide balance, and dh is my alias for drinking health. When I bring up score, the expression should take my max health from the score message and store it, right?
Well, the real question is about the healthsip variable, and the less than thing in the if function. How do I get ZMud to do that calculation/comparison? Because I don't think it's right the way I have it now.
#CLASS {curing|autosip}
#VAR healthsip {@healthmax-450}
#REGEX {Health : (/d+)/(/d+)} {#var @healthmax %2}
#IF @health < @healthsip {#IF @hmbbal 1 (dh)))
#CLASS 0
Where @health is my current health that I'm tracking through my prompt catch, hmbbal is my health/mana/bromide balance, and dh is my alias for drinking health. When I bring up score, the expression should take my max health from the score message and store it, right?
Well, the real question is about the healthsip variable, and the less than thing in the if function. How do I get ZMud to do that calculation/comparison? Because I don't think it's right the way I have it now.
Unknown2005-09-11 18:43:08
1. /d+ does not equal \\d+
2. You probably should use %eval to force the value of healthsip to be a number, as expected.
3. Don't use @ with the #var command unless you want to make a variable with a name equal to the value of that variable. (Confusing probably, I know, but it's a common side effect and not usually what you intended.)
4. Your #IF command needs to be in your prompt trigger to work properly.
5. Don't start a block with { and end it with ). They're not always interchangeable.
You'll probably need to add a few things to it for it to fit with your other code, but I hope you get the idea.
2. You probably should use %eval to force the value of healthsip to be a number, as expected.
3. Don't use @ with the #var command unless you want to make a variable with a name equal to the value of that variable. (Confusing probably, I know, but it's a common side effect and not usually what you intended.)
4. Your #IF command needs to be in your prompt trigger to work properly.
5. Don't start a block with { and end it with ). They're not always interchangeable.
CODE
#CLASS {curing|autosip}
#VAR healthsip {%eval(@healthmax-450)}
#REGEX {Health : \\d+/(\\d+)} {#var healthmax %1}
#REGEX {^(\\d+)h, (\\d+)m} {#var health %1;#var mana %2;#IF @hmbal {#IF @health < @healthsip {dh}}} "" {nocr|prompt}
#CLASS 0
#VAR healthsip {%eval(@healthmax-450)}
#REGEX {Health : \\d+/(\\d+)} {#var healthmax %1}
#REGEX {^(\\d+)h, (\\d+)m} {#var health %1;#var mana %2;#IF @hmbal {#IF @health < @healthsip {dh}}} "" {nocr|prompt}
#CLASS 0
You'll probably need to add a few things to it for it to fit with your other code, but I hope you get the idea.