|
jackleu Newbie
Joined: 28 May 2007 Posts: 2
|
Posted: Mon May 28, 2007 11:22 am
how to set trigger + if please? |
i want to set a trigger, if the hitpoint is > 80 , then i'll exercise 10
screen will show:
=====
hitpoint : 122/ 122 (100%)
=====
i set:
#trigger {^hitpoint : (%d)/(%d) (100%)} {%1>80;exercise 10}
of course it wont work, i just mess up......it is my first time playing mud.....
can anybody help me please?
thank you |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon May 28, 2007 11:33 am |
You've got more spaces in the pattern than the trigger.
I'm guessing there isn't a space after the /, so...
hitpoint : 122/122 (100%)
And the percentage in brackets would change
This should work
#TR {^hitpoint : (%d)/(%d) ~(%d~%~)} {#IF (%1 > 80) {exercise 10}} |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
jackleu Newbie
Joined: 28 May 2007 Posts: 2
|
Posted: Mon May 28, 2007 12:09 pm |
thank you for helping me
but it still not working
i dont know is it because of the space problem
hitpoint : 122/ 122 (100%)
there are 2 space after hitpoint, then :, then 2 space, 122/ and 2 space, then122, 1 space, (100%)
but if the first 122 is decreased, let say to 90, then the screen will show
hitpoint : 90/ 122 (100%)
there will be 3 space between : and 90
how to deal with this please?
--------------
also, can i just use something like:
TR {^hitpoint : (%d)} {#IF (%1 > 80) {exercise 10}}
just take the current hitpoint in account and dont bother the thing after?
thank you |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon May 28, 2007 12:44 pm |
You could just use the first part of the line...
Try
Code: |
#TR {^hitpoint :%s(%d)/} {#IF (%1 > 80) {exercise 10}} |
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon May 28, 2007 12:49 pm |
Something to note, if you're posting something where the number of spaces matter then use the
Code: |
[code]a b c d e f[/code] |
tag to preserve spacing. In normal BB posts then duplicate spacing is removed
But using the code tags then
Code: |
1 space
2 spaces
3 spaces |
are all different |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon May 28, 2007 7:56 pm |
Code: |
hitpoint : 122/ 122 (100%)
there are 2 space after hitpoint, then :, then 2 space, 122/ and 2 space, then122, 1 space, (100%)
but if the first 122 is decreased, let say to 90, then the screen will show
hitpoint : 90/ 122 (100%)
|
I would use fixed width pattern matching
Code: |
#TRIGGER "prompt" {hitpoint :(&5)/(&5) ~(%d~%~)} {
hpcur=%trim(%1)
hpmax=%trim(%2)
hpper=%trim(%3)
#IF (@hpcur>80) {exercise 10}
} "" {prompt|nocr} |
|
|
|
|
|
|